← back to Designer Wallcoverings
Daisy Bennett: reconcile SKUs to GRS- (no DW); retitle all 63 as Pattern+Material+Color (dedup material, fix Antika-Antika/Morrocan/ampersands)
ece3218f73a03d17a0bc1e85bd8e592659f02b84 · 2026-07-06 13:48:46 -0700 · Steve
Files touched
A scripts/wallquest-refresh/rebuild-titles-daisy-bennett.cjs
Diff
commit ece3218f73a03d17a0bc1e85bd8e592659f02b84
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Jul 6 13:48:46 2026 -0700
Daisy Bennett: reconcile SKUs to GRS- (no DW); retitle all 63 as Pattern+Material+Color (dedup material, fix Antika-Antika/Morrocan/ampersands)
---
.../rebuild-titles-daisy-bennett.cjs | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/scripts/wallquest-refresh/rebuild-titles-daisy-bennett.cjs b/scripts/wallquest-refresh/rebuild-titles-daisy-bennett.cjs
new file mode 100644
index 00000000..27e12ec4
--- /dev/null
+++ b/scripts/wallquest-refresh/rebuild-titles-daisy-bennett.cjs
@@ -0,0 +1,41 @@
+const https = require('https');
+const { execSync } = require('child_process');
+const TOK = process.env.SHOPIFY_ADMIN_TOKEN;
+const DOMAIN = 'designer-laboratory-sandbox.myshopify.com';
+const LIMIT = parseInt(process.env.LIMIT || '999', 10);
+const MAT = { GRS:'Grasscloth', PWV:'Paperweave', RAF:'Raffia', LIN:'Linen', CORK:'Cork', ABA:'Abaca', MIC:'Mica', SIS:'Sisal' };
+const SMALL = new Set(['a','an','the','and','but','or','for','in','on','at','of','to','with']);
+const tc = s => (s||'').split(/\s+/).filter(Boolean).map((w,i)=>(i>0&&SMALL.has(w.toLowerCase()))?w.toLowerCase():w.charAt(0).toUpperCase()+w.slice(1)).join(' ');
+function cleanColor(pattern, color) {
+ let c = (color||'').replace(/\bmorrocan\b/ig,'Moroccan').replace(/\s*&\s*/g,' and ').replace(/\s+/g,' ').trim();
+ if (c.toLowerCase() === (pattern||'').toLowerCase()) c = ''; // drop tautology
+ return c;
+}
+function shopify(method, path, body) {
+ return new Promise((res, rej) => { const data = body ? JSON.stringify(body) : null;
+ const req = https.request({ hostname: DOMAIN, path: `/admin/api/2024-10/${path}`, method,
+ headers: { 'X-Shopify-Access-Token': TOK, 'Content-Type': 'application/json', ...(data?{'Content-Length':Buffer.byteLength(data)}:{}) } },
+ r => { let d=''; r.on('data',c=>d+=c); r.on('end',()=>{ try{const j=JSON.parse(d); r.statusCode<300?res(j):rej(new Error(r.statusCode+' '+d.slice(0,120)));}catch(e){rej(e);} }); });
+ req.on('error', rej); if (data) req.write(data); req.end(); });
+}
+(async () => {
+ const rows = execSync(`PGPASSWORD=DW2024SecurePass psql -h 127.0.0.1 -U dw_admin -d dw_unified -tA -F'\t' -c "SELECT dw_sku,pattern_name,color_name,shopify_product_id FROM daisy_bennett_catalog WHERE on_shopify AND shopify_product_id IS NOT NULL ORDER BY dw_sku"`).toString().trim().split('\n').map(l=>l.split('\t'));
+ let n=0, ok=0;
+ const MAT_IN_PATTERN = /grass|abaca|cork|raffia|linen|mica|sisal|paper.?weave|weave|hemp|jute|bamboo|netting|\bfiber\b|silk|wool/i;
+ for (const [sku, pattern, color, pid] of rows) {
+ if (n++ >= LIMIT) break;
+ const prefix = sku.split('-')[0];
+ // only inject material when the pattern name doesn't already mention a material
+ const material = MAT_IN_PATTERN.test(pattern||'') ? '' : (MAT[prefix] || '');
+ const c = cleanColor(pattern, color);
+ const title = `${tc(pattern)}${material?' '+material:''}${c?' '+tc(c):''} | Phillipe Romano`.replace(/\s+/g,' ').trim();
+ try {
+ await shopify('PUT', `products/${pid}.json`, { product: { id: Number(pid), title } });
+ // keep catalog color clean too
+ execSync(`PGPASSWORD=DW2024SecurePass psql -h 127.0.0.1 -U dw_admin -d dw_unified -tAc "UPDATE daisy_bennett_catalog SET color_name='${c.replace(/'/g,"''")}' WHERE dw_sku='${sku}'"`);
+ ok++; if (ok<=4 || ok%20===0) console.log(` ✅ ${sku} → "${title}"`);
+ await new Promise(r=>setTimeout(r,220));
+ } catch(e){ console.error(` ❌ ${sku}: ${e.message}`); }
+ }
+ console.log(`\nretitled ${ok}/${rows.length} with material injected`);
+})().catch(e=>{console.error('FATAL',e.message);process.exit(1);});
← d6339904 Add --reslug mode (34 clean handles) + read-only PR dedup au
·
back to Designer Wallcoverings
·
Daisy Bennett + Sag Harbor: enforce 8-yard order increments 47004a53 →