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>
7.3 KiB
STATE.md
Current Position
Milestone: v0.1 Naprawa nowego layoutu strony produktu
Phase: 2 of 2 (Product actions fixes) — Planning
Plan: 02-03 (customization save + success modal) created, awaiting approval
Status: PLAN created. Plan 02-02 zamknięty PARTIAL, Plan 02-03 fokus na end-to-end UX.
Last activity: 2026-04-23 — Created .paul/phases/02-product-actions-fixes/02-03-PLAN.md — scope: customization + modal (cena + cache-buster wydzielone do 02-04/02-05)
Progress:
- Milestone: [█████████░] 85% (Phase 1 zamknięty; Phase 2 plan 02-01 zamknięty, plan 02-02 PARTIAL, plan 02-03 w PLAN)
- Phase 1: [██████████] 100%
- Phase 2: [██████████░] 70% (plan 02-01 closed, plan 02-02 PARTIAL, plan 02-03 w PLAN stage; 02-04/02-05 do zaplanowania)
UWAGA: Milestone NIE jest ready na usunięcie IP gate (REMOTE_ADDR == '89.69.31.86'). Plan 02-03 jest kluczowy dla production readiness.
Loop Position
Current loop state:
PLAN ──▶ APPLY ──▶ UNIFY
✓ ○ ○ [Plan 02-03 created, awaiting approval]
Session Continuity
Last session: 2026-04-23
Stopped at: Plan 02-03 PLAN.md created
Next action: Review plan .paul/phases/02-product-actions-fixes/02-03-PLAN.md, potwierdzić scope (customization + modal, bez ceny i cache-busta), następnie /paul:apply .paul/phases/02-product-actions-fixes/02-03-PLAN.md
Resume file: .paul/phases/02-product-actions-fixes/02-03-PLAN.md
Accumulated Context
Decisions (Phase 01)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-23 | Rozszerzenie scope Task 1 o wrapper <form id="add-to-cart-or-refresh"> |
Bez niego PS nie może AJAX-ować wariantu — konieczne do realizacji AC-2 |
| 2026-04-23 | Ręczny AJAX w custom.js zamiast fake .product-actions |
PS core handler szuka formy przez .product-actions — unikam dodawania problematycznej klasy (kolizja stylów), piszę własny flow |
| 2026-04-23 | Edytuj tylko custom.scss, nie custom.css |
User ma własny watcher SCSS — manualne zmiany w CSS są nadpisywane |
| 2026-04-23 | In-place DOM update zamiast full redirect | User feedback "na starym layoucie działało bez reloadu" — history.pushState + manual replace .product-prices / .product_image_wrapper |
| 2026-04-23 | action=refresh (nie productrefresh) |
Empiryczne probowanie endpointów — productrefresh zwracał pustą odpowiedź |
Decisions (Phase 02 — Plan 02-01)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-23 | Priorytet: piece/crop przed add-to-cart | User zmienił priorytety z ROADMAP — konfigurator fragmentu krytyczny dla produktu („na wymiar") |
| 2026-04-23 | #piece reużywany z shared partial product-cover-thumbnails.tpl |
Pierwotna próba dodania osobnego <div id="piece"> tworzyła duplikat ID — rozwiązanie: reuse istniejącego + inherit stylowania ze starego SCSS |
| 2026-04-23 | Override totalpriceinfospecific + prod na no-op w nowym layoucie |
⚠️ WYWOŁAŁO regresję squaremeter customization flow: hook wymaga discretion=on + dimension fields ktore były synchronizowane przez tę funkcję. Plan 02-02 ujawnił że customization nie zapisuje się. Do fix'u w Plan 02-03. |
| 2026-04-23 | DOM stubs wstrzykiwane przez JS (nie template) | Smarty template cache + FTP sync delay — JS deploy'uje się niezawodniej. |
| 2026-04-23 | Piece NIE auto-init'uje się na load — pojawia się tylko po kliknięciu trigger'a popupu | User feedback w trakcie checkpoint — zmiana wymaganej behawiorystyki vs pierwotny plan |
| 2026-04-23 | Defensive .pp_stick_parent guard w fancybox handler |
Element istnieje tylko w starym layoucie — bez guard'a popup aborts przed $.fancybox() w nowym |
Decisions (Phase 02 — Plan 02-02)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-23 | Plan 02-02 = submission + cart widget (bez ceny) | Cena wydzielona do Plan 02-03 dla scope 2-3 task. W trakcie APPLY odkryto że customization + modal TEŻ są w Plan 02-03. |
| 2026-04-23 | Task 1 = live diagnosis (checkpoint:human-verify) | Playwright ujawnił: button+qty są POZA formą #add-to-cart-or-refresh — PS core closest('form') zwraca 0, POST nigdy nie wychodzi. |
| 2026-04-23 | Wybór S3 (własny AJAX submit handler) | S2 (restrukturyzacja form) naruszałoby Bootstrap grid + shared partial risk. S3 bezpieczniejsze. |
| 2026-04-23 | Capture-phase native addEventListener (useCapture=true) zamiast jQuery .on() |
Pierwsza iteracja dubluje POST (PS core i nasz oba firują). Capture phase fires PRZED bubble — całkowicie blokuje PS core. Verified. |
| 2026-04-23 | Manual blockcart refresh po emit('updatedCart') | Natural PS listener nie odświeżał widget w nowym layoucie. Defensive $.get fallback działał. |
| 2026-04-23 | Inline script mirror w product.tpl + idempotency guard | Browser cache serwuje old custom.js (transferSize=0). Inline HTML response zawsze fresh. Guard window.__p02p02Bound chroni przed double-register. |
| 2026-04-23 | UNIFY Plan 02-02 jako PARTIAL | Core POST działa ale: (a) customization nie zapisuje się — squaremeter hook gate'owany discretion=on z brakującymi polami, (b) success modal brak — wymaga osobny POST do /module/ps_shoppingcart/ajax. Delegowane Plan 02-03. |
Open observations (do kolejnych planów Phase 02)
- Plan 02-03 (wymagany dla production) — Customization + modal + cena + cache-buster:
- Przywrócić squaremeter dimension flow zamiast Plan 02-01 no-op override (
totalpriceinfospecific/prod). Synchronizować pola:discretion=on,dim,qty,qty_alth,product_total_price_calc,extrafeevalue,wastevalue,calculated_total,grand_calculated_total,converted_ea,directinput,qty_alt,qty_altd,width_module,height_module,unittype_module. - Po udanym POST do
/koszyk→ drugi POST do/module/ps_shoppingcart/ajax?action=add-to-cart→ pokazać modal (resp.modal HTML) z "Kontynuuj zakupy / Przejdź do koszyka". - Cena per-sqm calculation w UI (live update przy zmianie piece dimensions / qty).
- Systemowy cache-buster
?v=<mtime>dla<script src=custom.js>tag'a — znaleźć miejsce rejestracji (theme.yml ma puste assets — rejestracja via hook/override do znalezienia). Pozwoli wycofać inline mirror z product.tpl.
- Przywrócić squaremeter dimension flow zamiast Plan 02-01 no-op override (
- Plan 02-04+ — Puste bloki:
.product-protect,.product-installation,.product-order-sample— wypełnić treścią. - Re-verify po Plan 02-01 (przed git commit phase'a):
- AC-5: stary layout (IP != 89.69.31.86) bez regresji
- AC-4: zmiana wariantu kolorystycznego → AJAX refresh →
#piecere-rendered → dragElement re-binds - Mirror button end-to-end w nowym layoucie
- Piece-size-view "50x50" placeholder po kliknieciu popup (cosmetic).
- Resize handles bezpośrednio na
#piece(deferred bonus).
Skill audit
SPECIAL-FLOWS.md nadal nie skonfigurowane (rekomendacja z 02-01 niespełniona). Plan 02-02 podkreślił krytyczność Playwright MCP (diagnoza struktury DOM, event phases, customization flow — niemożliwe bez live debug).
Pattern Ustalony: Structure-first diagnosis przed implementacją — sprawdzić DOM relationships, event flow, POST payload requirements. Oszczędza iteracje.
Rekomendacja: Utworzyć SPECIAL-FLOWS.md z Playwright MCP jako required skill dla Plan 02-03+ — customization flow wymaga end-to-end testów POST → DB state → UI re-render.