Six sort options on category/tag pages, controlled by ?sort=: newest Newest first (default — created_timestamp desc) oldest Oldest first (created_timestamp asc) price_asc Price low → high (price_in_cents asc) price_desc Price high → low (price_in_cents desc) title Alphabetical A→Z (lowercased title) popular Most popular (28d) (PageSession views with visible_ms ≥ 7s) Rendered as a <select> right-aligned above the grid. Capability-driven: plain GET form works without JS (button appears via <noscript>), JS-on auto-submits on change. Both shop_tag.j2 and home.j2 (filtered branch only — lanes keep their editorial order) get the dropdown. views/shop.py — new SORT_OPTIONS list + _sort_key_from_request + _sort_products + _popular_view_counts helpers. Sort runs in Python on the already-filtered list, so it's O(N log N) on the tagged subset not the whole shop catalog. The 'popular' option fires one extra PageSession aggregate query scoped to the filtered product_ids; ~tens of ms on indexed (shop_id, product_id, created_timestamp). Doesn't address fox's bigger ask: Netflix-style truly-responsive SERP layout with left nav + description-excerpt rows that works at every resolution. That's a real redesign — proposing it next. |
||
|---|---|---|
| .. | ||
| lib | ||
| models | ||
| scripts | ||
| static | ||
| templates | ||
| tests | ||
| views | ||
| __init__.py | ||
| config_jinja2.py | ||
| request_methods.py | ||
| routes.py | ||