[object Object]

← back to Designer Line

add price ↑/↓ + title z→a + sku z→a sort options to commerce grid

f7ab35868499a273e76f3295ad6a5cb2eb22049d · 2026-05-19 18:34:23 -0700 · Steve Abrams

Brings the commerce sort <select> closer to the canonical DW sort pattern
(Steve's standing rule). COALESCE(net_price, retail_price) so trade pricing
sorts first when available, else MSRP. Existing localStorage persist /
hydrate behavior on the sort key carries through unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit f7ab35868499a273e76f3295ad6a5cb2eb22049d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 19 18:34:23 2026 -0700

    add price ↑/↓ + title z→a + sku z→a sort options to commerce grid
    
    Brings the commerce sort <select> closer to the canonical DW sort pattern
    (Steve's standing rule). COALESCE(net_price, retail_price) so trade pricing
    sorts first when available, else MSRP. Existing localStorage persist /
    hydrate behavior on the sort key carries through unchanged.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 public/commerce.html | 4 ++++
 server.js            | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/public/commerce.html b/public/commerce.html
index 2c33afc..6f33dd9 100644
--- a/public/commerce.html
+++ b/public/commerce.html
@@ -72,8 +72,12 @@
   <select id="sort">
     <option value="newest">newest</option>
     <option value="title">title a→z</option>
+    <option value="title-desc">title z→a</option>
     <option value="vendor">vendor a→z</option>
     <option value="sku">sku a→z</option>
+    <option value="sku-desc">sku z→a</option>
+    <option value="price-asc">price ↑</option>
+    <option value="price-desc">price ↓</option>
   </select>
 
   <label>density</label>
diff --git a/server.js b/server.js
index 3319c7b..8b7954b 100644
--- a/server.js
+++ b/server.js
@@ -42,8 +42,12 @@ app.get('/api/commerce/products', async (req, res) => {
     const orderBy = {
       'newest': 'updated_at_shopify DESC NULLS LAST',
       'title': 'title ASC',
+      'title-desc': 'title DESC',
       'vendor': 'vendor ASC, title ASC',
       'sku': 'sku ASC NULLS LAST',
+      'sku-desc': 'sku DESC NULLS LAST',
+      'price-asc': 'COALESCE(net_price, retail_price) ASC NULLS LAST',
+      'price-desc': 'COALESCE(net_price, retail_price) DESC NULLS LAST',
     }[sort] || 'updated_at_shopify DESC NULLS LAST';
     params.push(lim);
     const { rows } = await pool.query(

← d7d7eb8 guard static root from serving .bak / .pre-* / .orig snapsho  ·  back to Designer Line  ·  Add per-site favicon (kills /favicon.ico 404) ae5df42 →