feat(02-product-actions-fixes): Phase 02 complete — customization, price label, structure fix

Plan 02-03: Customization save + success modal (5/5 AC)
- 26-field squaremeter POST payload (verbose PL dim, qty_alt/qty_alth)
- Chain POST /module/ps_shoppingcart/ajax -> Bootstrap #blockcart-modal
- Critical fix: moved {/block} so inline script actually renders
- __p02p02InFlight re-entrancy guard

Plan 02-04: Live cena per-sqm label obok "Dodaj do koszyka" (5/5 AC)
- .p02p04-total-price label, gorna .current-price static
- Separate __p02p04Bound + setInterval reconciliation
- Poll-retry prestashop.on registration

Plan 02-05: Struktura materialu w POST payload (4/4 AC)
- Enumerate [name^="group["] spoza formy, doklej do payload
- Fix: group_5 select w .product-bar-box nie trafial do koszyka

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 00:55:05 +02:00
parent 7ac795ba3f
commit ac03f807c1
13 changed files with 1583 additions and 64 deletions

View File

@@ -3,32 +3,32 @@
## 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-23Created `.paul/phases/02-product-actions-fixes/02-03-PLAN.md` — scope: customization + modal (cena + cache-buster wydzielone do 02-04/02-05)
Phase: 2 of 2 (Product actions fixes) — **COMPLETE** (02-01/02/03/04/05 closed)
Plan: 02-05 (struktura materiału w POST payload) — UNIFY ✓
Status: Phase 02 COMPLETE. 5 plans shipped + verified. Ready for phase transition + milestone finalization.
Last activity: 2026-04-24Plan 02-05 UNIFY complete. Phase transition pending.
Progress:
- Milestone: [█████████] 85% (Phase 1 zamknięty; Phase 2 plan 02-01 zamknięty, plan 02-02 PARTIAL, plan 02-03 w PLAN)
- Milestone: [█████████] 99% (Phase 1 ; Phase 2 ✓; pending transition/IP gate removal)
- 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)
- Phase 2: [██████████] 100% (02-01 ✓, 02-02 PARTIAL closed, 02-03 ✓, 02-04 ✓, 02-05 ✓; 02-06 cache-buster deferred nice-to-have)
**UWAGA:** Milestone NIE jest ready na usunięcie IP gate (`REMOTE_ADDR == '89.69.31.86'`). Plan 02-03 jest kluczowy dla production readiness.
**MILESTONE READINESS:** Ready na transition + IP gate removal. Plan 02-06 (cache-buster) nie jest blocker.
## Loop Position
Current loop state:
```
PLAN ──▶ APPLY ──▶ UNIFY
[Plan 02-03 created, awaiting approval]
[Plan 02-05 loop closed — Phase 02 COMPLETE]
```
## 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`
Last session: 2026-04-24
Stopped at: Plan 02-05 UNIFY ✓ — Phase 02 (Product actions fixes) COMPLETE. 5 plans shipped, 2 files modified (custom.js + product.tpl).
Next action: Phase transition (git commit feat(02-product-actions-fixes)) → milestone completion decision (IP gate removal).
Resume file: `.paul/phases/02-product-actions-fixes/02-05-SUMMARY.md`
## Accumulated Context
@@ -53,6 +53,36 @@ Resume file: `.paul/phases/02-product-actions-fixes/02-03-PLAN.md`
| 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-05)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-24 | Enumerate wszystkie `[name^="group["]` spoza formy zamiast hardcode group[5] | Future-proof — kolejne PS attribute groups automatycznie pokryte bez dalszych zmian kodu. |
| 2026-04-24 | Defensive `closest('#add-to-cart-or-refresh').length` check | Unika double-include gdyby przyszly refactor przesunął select do formy. Robustne. |
| 2026-04-24 | Filter radio/checkbox przez `:checked` | `[name^="group["]` łapie wszystkie radios z grupy (nie-checked też). Bez filtra payload by zawierał sprzeczne wartości. |
### Decisions (Phase 02 — Plan 02-04)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-24 | Scope pivot mid-task: label obok "Dodaj do koszyka" zamiast nadpisywania `.current-price` | User polecenie w trakcie Task 3 verification: "właściwą cenę jako napis obok Dodaj do koszyka. Ta cena u góry od xxx zł niech będzie stała." Gorna cena zostaje static info, konkretna suma blisko buttona. |
| 2026-04-24 | Separate `__p02p04Bound` guard zamiast shared `__p02p02Bound` (vs. pierwotny plan) | Stale-cache safety: gdy browser cache'uje stare custom.js (bez P04) + fresh product.tpl (z P04 inline), shared guard by zablokowal inline rejestracje. Separate guard = niezalezna rejestracja. |
| 2026-04-24 | Synchronous `__p02p04TryInitial()` zamiast `jQuery(document).ready` | jQuery ready w inline script wewnatrz Smarty `{block name='content'}` nie firuje konsekwentnie (function defined, callback nigdy nie wywolany). Synchronous call + interval early-return pokrywa DOM-not-ready case. |
| 2026-04-24 | setInterval 10×500ms (5s okno) zamiast single retry | Squaremeter init overwrituje `.current-price` po pierwszym recalc. Pure interval reliably pokrywa late-override + late DOM stubs injection. Po expire user ma pelna reaktywnosc na input events. |
| 2026-04-24 | Poll-retry rejestracja `prestashop.on('updatedProduct')` | `window.prestashop` moze nie istniec w momencie inline script parse (bundle loads po). Poll co 200ms az dostepny. AC-4 dziala niezawodnie. |
| 2026-04-24 | Inline `style=""` na labelce zamiast SCSS edit | Unika dependency na user watcher + SCSS build. MVP widocznosc. Pozniejszy plan moze przeniesc do tokenow motywu. |
### Decisions (Phase 02 — Plan 02-03)
| Data | Decyzja | Wpływ |
|---|---|---|
| 2026-04-24 | Playwright capture z flipped IP → ground truth 26-field OLD payload | Bez tego pominęlibyśmy verbose dim format i kluczowe pola (qty_alt/qty_alth osobno od qty). |
| 2026-04-24 | Move inline script INSIDE `{block name='content'}` | **KRYTYCZNE:** Smarty `{extends}` renderuje TYLKO blocki. Inline script z Plan 02-02 był MIĘDZY `{/block}` i `{/if}` — dead code przez cały czas. Plan 02-02 AC-3 przechodził przez custom.js, nie przez "inline mirror". |
| 2026-04-24 | basePrice przez `meta[property="product:price:amount"]` fallback | `#product_base_price`/`#product_fixed_price` są w shared OLD partial, nie w NEW layout. Meta tag działa w obu. |
| 2026-04-24 | `__p02p02InFlight` re-entrancy guard | `__p02p02Bound` nie wystarczył — POST firował 2×. Guard reset przez `complete:` callback. Root cause doubling niepotwierdzony, ale guard skuteczny. |
| 2026-04-24 | Manual FTP upload via curl | ftp-kr VSCode extension nie łapie edycji z Claude Code Edit tool (watcher issue). `curl -T ftp://` jako work-around. |
| 2026-04-24 | Używać verbose Polish dim string (nie "200x150") | Squaremeter customization display w cart oczekuje tego formatu. |
### Decisions (Phase 02 — Plan 02-02)
| Data | Decyzja | Wpływ |