feat(new-layout): add-to-cart handler + piece configurator (Phase 02 plans 01-02)

Plan 02-01 (piece/crop configurator, complete):
- #piece reuse z shared partial product-cover-thumbnails.tpl
- 8 hidden inputs (is_crop, crop_pos_x/y, crop_width/height, piece_bg_top/left, is_reflection) w formie #add-to-cart-or-refresh
- Defensive setup w custom.js: setTimeout(600) init, no-op override totalpriceinfospecific/prod, DOM stubs
- CSS scope pod body#product .product-size-data .product-size-data--new

Plan 02-02 (add-to-cart submission, PARTIAL):
- Capture-phase native addEventListener (useCapture=true) blokuje PS core crash
  (button poza formą w nowym layoucie — closest('form') zwracało 0)
- Manualny AJAX POST: form.serialize() + qty + add=1&action=update do /pl/koszyk
- Fancybox-blocker port z custom.js:327 (nie odpalał się bo selector 0 matches)
- Manual sync is_crop/crop_width/height przed POST (obejście crash checkedHandler)
- prestashop.emit('updatedCart') + defensive blockcart refresh fetch
- Loading spinner + success flash CSS
- Inline handler mirror w product.tpl z idempotency guard (window.__p02p02Bound)
  — cache-buster dla browser cachowanego custom.js

Deferred do Plan 02-03 (customization + modal blocker dla production):
- Customization nie zapisuje się (squaremeter hook gate'owany discretion=on + brak dimension fields)
- Success modal (wymaga POST do /module/ps_shoppingcart/ajax)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 23:33:45 +02:00
parent 161c090ef0
commit 7ac795ba3f
24 changed files with 5447 additions and 2569 deletions

View File

@@ -0,0 +1,35 @@
# 2026-04-23
## Co zrobiono
- [Phase 01 / Plan 01] Naprawa wariantu kolorystycznego w nowym layoucie strony produktu (IP-gated `REMOTE_ADDR == '89.69.31.86'`)
- Task 1: wrapper markup w `product.tpl``<div class="product-variants-data--new">` + `<form id="add-to-cart-or-refresh">` (token/id_product/id_customization) + `<div class="product-variants-grid">`
- Task 2: styling SCSS pod scope `body#product .product-variants-data--new` wg Figma 27:9867 (grid 3×1 / 2×1 <768 px, Inter 14/25 #8c8c8c left, active outline #7d6e4f)
- Task 3: delegowany click+change handler w `custom.js` — własny AJAX `action=refresh` + in-place DOM update (pushState + replace `.product-prices`, `.product_image_wrapper` + emit `updatedProduct`)
- Scope addition (uzgodniony): form `add-to-cart-or-refresh` w nowym layoucie — bez niej PS nie mógł AJAX-ować wariantu
- Bootstrap PAUL w projekcie: PROJECT.md, ROADMAP.md, STATE.md, phase dir
- Feedback memory: edytuj tylko `custom.scss`, nie `custom.css` (user ma lokalny watcher)
- Deferred do Phase 02+: add-to-cart w nowym layoucie, konfigurator „piece", puste bloki rozmiar/odbicie/montaż/próbka/zabezpiecz
- [Phase 02 / Plan 01] Port konfiguratora „piece" (wybór fragmentu tapety + mirror) do nowego layoutu — popup trigger + fancybox zgodnie z Figma, 8 hidden inputów (`is_crop`, `is_reflection`, `crop_pos_x/y`, `crop_width/height`, `piece_bg_top/left`) w formie `#add-to-cart-or-refresh`
- Task 1: markup w gałęzi `== '89.69.31.86'` — hidden inputs w formie, `.piece-summary` anchor w `.product-size-data`, mirror button, hidden state (checkbox/width/height/position divs)
- Task 2: custom.js defensive setup — setTimeout(600) init z override `totalpriceinfospecific`/`prod` na no-op + wstrzyknięcie DOM stubs (`#totalpriceinfo`, `#custom-wallpaper-price*`, `#quantity_wanted*`), `prestashop.on('updatedProduct')` re-bind dragElement po variant AJAX, defensive `.pp_stick_parent` guard w fancybox handler
- Task 3: CSS scoped pod `.product-size-data .product-size-data--new` (flex layout, `.piece-summary` trigger, mirror button hover)
- 5 ukrytych problemów wykrytych w live Playwright debug: duplikat `#piece` (reuse z shared partial), CSS `:has()` edge case, ready queue fighting, inline-script crash (module hook), brakujący `.pp_stick_parent`
- User feedback w trakcie checkpoint: piece nie auto-init'uje się na load — pojawia się dopiero po kliknięciu trigger'a popupu
- Deferred do re-verify: AC-4 (AJAX variant re-init), AC-5 (stary layout regresja), mirror button end-to-end
## Zmienione pliki
- `themes/ayon/templates/catalog/product.tpl`
- `themes/ayon/assets/css/custom.scss`
- `themes/ayon/assets/js/custom.js`
- `.paul/PROJECT.md`
- `.paul/ROADMAP.md`
- `.paul/STATE.md`
- `.paul/phases/01-product-variants-fix/01-01-PLAN.md`
- `.paul/phases/01-product-variants-fix/01-01-SUMMARY.md`
- `.paul/phases/02-product-actions-fixes/02-01-PLAN.md`
- `.paul/phases/02-product-actions-fixes/02-01-SUMMARY.md`
- `.claude/memory/MEMORY.md`
- `.claude/memory/feedback_scss_only.md`