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:
35
.paul/ROADMAP.md
Normal file
35
.paul/ROADMAP.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# ROADMAP.md
|
||||
|
||||
## Milestone v0.1 — Naprawa funkcji w nowym layoucie strony produktu
|
||||
|
||||
Status: In progress (Phase 1 / 2 complete)
|
||||
|
||||
Cel: przywrócić pełną funkcjonalność strony produktu w nowym wyglądzie (IP 89.69.31.86) bez naruszania starego.
|
||||
|
||||
### Phase 01 — Product variants (wariant kolorystyczny) — **✅ Complete (2026-04-23)**
|
||||
- Wizualnie: blok `.product-variants` w `.product-box.product-variants-data` wyglada jak `d:\temp\Frame 33.png` / Figma 27:9867 (3 kafelki z obrazem + podpis pod spodem, responsive 2×1 < 768 px). ✓
|
||||
- Funkcjonalnie: kliknięcie miniatury zmienia wariant produktu — AJAX `action=refresh` + in-place DOM update (obraz + cena + URL przez `history.pushState`), bez reloadu. ✓
|
||||
- Dotyczy tylko gałęzi `REMOTE_ADDR == '89.69.31.86'` w `product.tpl` oraz scope'owanego CSS/JS. Stary layout nietknięty.
|
||||
- Summary: `.paul/phases/01-product-variants-fix/01-01-SUMMARY.md`
|
||||
|
||||
### Phase 02 — Product actions fixes (piece + add-to-cart + empty blocks) — **Planning**
|
||||
|
||||
Plan 02-01 (in planning): Konfigurator „piece" (crop + odbicie lustrzane) w nowym layoucie — port funkcjonalności ze starego layoutu z zachowaniem identycznego kontraktu DOM (hidden inputs `is_crop`, `crop_pos_x/y`, `crop_width/height`, `piece_bg_top/left`) dla serializacji do koszyka. Drag + resize przez inputy + mirror, re-init po AJAX refresh wariantu. Scope limit: zero nowych zależności, zero zmian w starym layoucie.
|
||||
- Plan file: `.paul/phases/02-product-actions-fixes/02-01-PLAN.md`
|
||||
|
||||
Plan 02-02 (**PARTIAL — closed 2026-04-23**): Add-to-cart submission działa (POST → cart saves item), ale customization nie zapisuje się i success modal nie pojawia. Core infrastructure: capture-phase native handler w custom.js + inline mirror w product.tpl (cache-buster), idempotency guard, blockcart refresh. 5 AC pass (technicznie), ale feature niekompletne z perspektywy UX.
|
||||
- Plan file: `.paul/phases/02-product-actions-fixes/02-02-PLAN.md`
|
||||
- Summary: `.paul/phases/02-product-actions-fixes/02-02-SUMMARY.md`
|
||||
|
||||
Plan 02-03 (**wymagany dla production** — kolejny do zaplanowania): Customization + success modal + cena per-sqm + systemowy cache-buster.
|
||||
- Root cause: Plan 02-01 override `totalpriceinfospecific` na no-op wyłączył squaremeter flow → customization hook `hookActionObjectCartUpdateBefore` gate'owany `discretion=on` + wiele pól (`dim`, `qty`, `qty_alth`, `product_total_price_calc`, `extrafeevalue`, `wastevalue`, `calculated_total`, etc.) nie jest wypełnianych.
|
||||
- Zakres:
|
||||
1. Przywrócić squaremeter dimension flow w nowym layoucie (alternatywa dla `totalpriceinfospecific`) — UI dimension input'ów + live kalkulacja + synchronizacja hidden inputs.
|
||||
2. Cena per-sqm kalkulacja (zależna od #1).
|
||||
3. Success modal po add-to-cart przez POST do `/module/ps_shoppingcart/ajax?action=add-to-cart` → render modal (resp.modal HTML).
|
||||
4. Systemowy cache-buster `?v=<mtime>` dla `<script src=custom.js>` — znaleźć miejsce rejestracji (theme.yml ma puste assets). Pozwoli wycofać inline mirror z product.tpl.
|
||||
- Blocker dla publikacji nowego layoutu: TAK (produkcja wymaga modal + customization detail w koszyku).
|
||||
|
||||
Kolejne plany w Phase 02 (po 02-03):
|
||||
- Plan 02-04+ — Puste bloki `.product-protect`, `.product-installation`, `.product-order-sample` + potencjalnie brakujące elementy PS `updatedProduct` flow (`.js-product-images2-modal`, `.product-customization`, itd.)
|
||||
- Opcjonalny add-on — resize handles bezpośrednio na `#piece` (bonus feature, user zgłosił w rozmowie).
|
||||
Reference in New Issue
Block a user