ver. 0.292: ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration to Domain

Full migration of front\factory\ — entire directory removed (all 20 classes migrated).
ProductRepository +20 frontend methods, PromotionRepository +5 applyType methods,
TransportRepository +4 cached methods, PaymentMethodRepository +cached frontend methods.
Fix: broken transports_list() in ajax.php replaced with forPaymentMethod().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 21:55:16 +01:00
parent 6181ef958d
commit d14018a5f3
48 changed files with 1780 additions and 975 deletions

View File

@@ -4,6 +4,34 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
---
## ver. 0.292 (2026-02-17) - ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration
- **Pelna migracja front\factory\** — USUNIETY caly folder `autoload/front/factory/` (wszystkie 20 klas zmigrowane do Domain)
- **ShopProduct (frontend Stage 1)** — migracja factory + controls na Domain
- NOWE METODY w `ProductRepository`: ~20 metod frontendowych (getSkuWithFallback, getEanWithFallback, isProductActiveCached, productCategoriesFront, getWarehouseMessageZero/Nonzero, topProductIds, newProductIds, promotedProductIdsCached, getMinimalPrice, productImageCached, productNameCached, productUrlCached, randomProductIds, productWp)
- USUNIETA: `front\factory\class.ShopProduct.php` (~410 linii) — logika przeniesiona do `ProductRepository`
- USUNIETA: `front\controls\class.ShopProduct.php` — logika w `ProductRepository` + szablony
- UPDATE: callerzy w szablonach, kontrolerach, index.php, cron.php przepieci na repo
- **ShopPaymentMethod (frontend)** — migracja factory + view + shop facade na Domain
- NOWE METODY w `PaymentMethodRepository`: metody frontendowe z Redis cache (paymentMethodsCached, paymentMethodCached, paymentMethodsByTransportCached)
- USUNIETA: `front\factory\class.ShopPaymentMethod.php`, `front\view\class.ShopPaymentMethod.php`, `shop\class.PaymentMethod.php`
- UPDATE: callerzy w szablonach i kontrolerach przepieci na `PaymentMethodRepository`
- **ShopPromotion (frontend)** — migracja factory na Domain
- NOWE METODY w `PromotionRepository`: 5 metod aplikowania promocji (applyTypeWholeBasket, applyTypeCheapestProduct, applyTypeCategoriesOr, applyTypeCategoriesAnd, applyTypeCategoryCondition)
- USUNIETA: `front\factory\class.ShopPromotion.php` — logika przeniesiona do `PromotionRepository`
- UPDATE: `shop\Promotion::find_promotion()` — 5 wywolan przepietych na repo
- **ShopStatuses (frontend)** — rewiring callerow
- USUNIETA: `front\factory\class.ShopStatuses.php` — 4 callerzy przepieci bezposrednio na `ShopStatusRepository`
- **ShopTransport (frontend)** — migracja factory + view na Domain
- NOWE METODY w `TransportRepository`: 4 metody frontendowe (transportMethodsFront, transportCostCached, findActiveByIdCached, forPaymentMethod)
- USUNIETA: `front\factory\class.ShopTransport.php`, `front\view\class.ShopTransport.php`
- UPDATE: 8 callerow przepietych na `TransportRepository`
- FIX: broken `transports_list()` w ajax.php — nowa metoda `forPaymentMethod()`
- NOWY: `tests/stubs/ShopProduct.php` — stub `shop\Product` dla testow
- Testy: 610 OK, 1816 asercji (+37: 20 ProductRepository, 5 PaymentMethodRepository, 7 PromotionRepository, 5 TransportRepository)
---
## ver. 0.291 (2026-02-17) - ShopProducer frontend migration
- **ShopProducer (frontend)** — migracja controls + shop facade na Domain + Controllers
@@ -775,4 +803,4 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
- Metoda `clear_product_cache()` w klasie S
---
*Dokument aktualizowany: 2026-02-17 (ver. 0.291)*
*Dokument aktualizowany: 2026-02-17 (ver. 0.292)*

View File

@@ -17,27 +17,27 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
| ShopBasket | ZMIGROWANY do `front\Controllers\ShopBasketController` | Operacje koszyka, add/remove/quantity, checkout |
| ShopClient | ZMIGROWANY do `front\Controllers\ShopClientController` | Logowanie, rejestracja, odzyskiwanie hasla, adresy, zamowienia |
| ShopOrder | ZMIGROWANY do `front\Controllers\ShopOrderController` | Webhooki płatności + order details |
| ShopProduct | Fasada | lazy_loading, warehouse_message, draw_product_attributes |
| ShopProduct | ZMIGROWANY — usunięty | logika w ProductRepository + szablony |
| ShopProducer | ZMIGROWANY do `front\Controllers\ShopProducerController` | list(), products() |
| ShopCoupon | ZMIGROWANY do `front\Controllers\ShopCouponController` | use_coupon(), delete_coupon() |
| Newsletter | ZMIGROWANY do `front\Controllers\NewsletterController` | signin(), confirm(), unsubscribe() |
### front/factory/ (20 klas — pobieranie danych + logika)
### ~~front/factory/~~ (20 klas — USUNIĘTY w ver. 0.292, wszystkie zmigrowane do Domain)
| Klasa | Status | Priorytet migracji |
|-------|--------|--------------------|
| ShopProduct | ORYGINALNA LOGIKA (~370 linii) | KRYTYCZNY — product_details(), promoted/top/new products |
| ShopProduct | ZMIGROWANA do `ProductRepository` — usunięta | — |
| ShopOrder | ZMIGROWANA do `OrderRepository` — usunięta | — |
| ShopClient | ZMIGROWANA do `ClientRepository` + `ShopClientController` — usunięta | — |
| ShopCategory | ZMIGROWANA do `CategoryRepository` — usunięta | — |
| Articles | ORYGINALNA LOGIKA | WYSOKI — złożone SQL z language fallback |
| ShopPromotion | ORYGINALNA LOGIKA | WYSOKI — silnik promocji (5 typów) |
| Articles | ZMIGROWANA do `ArticleRepository` — usunięta | — |
| ShopPromotion | ZMIGROWANA do `PromotionRepository` — usunięta | — |
| ShopBasket | ZMIGROWANA do `Domain\Basket\BasketCalculator` — usunięta | — |
| ShopTransport | CZĘŚCIOWO zmigrowana | ŚREDNI — transport_methods z filtrowaniem |
| ShopPaymentMethod | ZMIGROWANA (Domain) | — |
| ShopStatuses | ZMIGROWANA (Domain) | — |
| ShopTransport | ZMIGROWANA do `TransportRepository` — usunięta | — |
| ShopPaymentMethod | ZMIGROWANA do `PaymentMethodRepository` — usunięta | — |
| ShopStatuses | ZMIGROWANA do `ShopStatusRepository` — usunięta | — |
| Scontainers | ZMIGROWANA (Domain) — usunięta | — |
| Newsletter | ZMIGROWANA (Domain) — usunięta | — |
| Settings | Fasada (BUG: get_single_settings_value ignoruje $param) | NISKI |
| Settings | ZMIGROWANA do `SettingsRepository` — usunięta | — |
| Languages | USUNIĘTA — przepięta na Domain | — |
| Layouts | USUNIETA — przepieta na Domain | — |
| Banners | USUNIETA — przepieta na Domain | — |
@@ -58,8 +58,8 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
| Languages, Newsletter | PRZENIESIONE do `front\Views\` (nowy namespace) |
| ShopClient | PRZENIESIONA do `front\Views\ShopClient` |
| ShopOrder | ZMIGROWANA do `ShopOrderController` — usunięta |
| ShopPaymentMethod | Czyste VIEW |
| ShopTransport | PUSTA klasa (placeholder) |
| ShopPaymentMethod | USUNIĘTA (pusta klasa) |
| ShopTransport | USUNIĘTA (pusta klasa) |
### shop/ (14 klas — encje biznesowe)
| Klasa | Linii | Status | Priorytet |
@@ -72,7 +72,7 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
| Search | ~80 | NISKI — wrapper na szablony | NISKI |
| Coupon | ~60 | NISKI — niekompletne metody | NISKI |
| Transport | ~30 | NISKI — transport_list() | NISKI |
| PaymentMethod | — | ZMIGROWANA (fasada do Domain) | — |
| PaymentMethod | — | USUNIETA — callery na PaymentMethodRepository | — |
| Producer | — | USUNIETA (callery na ProducerRepository) | — |
| ProductSet | — | ZMIGROWANA (fasada do Domain) | — |
| ProductAttribute | ~100 | OK — dobry caching | — |
@@ -114,7 +114,7 @@ articles(8), banner(2), controls(1), menu(4), newsletter(2), scontainers(1), sho
## Znane bugi do naprawy podczas refaktoringu
1. ~~**KRYTYCZNY** `front\factory\ShopClient::login()` — hardcoded password bypass `'Legia1916'`~~ **NAPRAWIONE**`ClientRepository::authenticate()` bez bypass
2. `front\factory\Settings::get_single_settings_value()` — ignoruje `$param`, zawsze zwraca `firm_name`
2. ~~`front\factory\Settings::get_single_settings_value()` — ignoruje `$param`, zawsze zwraca `firm_name`~~ **NAPRAWIONE** — klasa usunięta, `SettingsRepository::getSingleValue()` z poprawnym `$param`
3. ~~`front\factory\Newsletter::newsletter_unsubscribe()` — błędna składnia SQL w delete~~ **NAPRAWIONE**`NewsletterRepository::unsubscribe()` z poprawną składnią medoo `delete()`
4. ~~`cms\Layout::__get()` — referuje nieistniejące `$this->data`~~ **NAPRAWIONE** — klasa usunięta, zastąpiona przez `$layoutsRepo->find()`
5. `shop\Search` — typo w use: `shop\Produt` (brak 'c')

View File

@@ -110,9 +110,8 @@ shopPRO/
│ ├── front/ # Klasy frontendu
│ │ ├── Controllers/ # Nowe kontrolery DI (Newsletter, ShopBasket, ShopClient, ShopCoupon, ShopOrder, ShopProducer)
│ │ ├── Views/ # Nowe widoki (Newsletter, Articles, Languages, Banners, Menu, Scontainers, ShopCategory, ShopClient)
│ │ ├── controls/ # Kontrolery legacy (Site, ...)
│ │ ── view/ # Widoki legacy (Site, ...)
│ │ └── factory/ # Fabryki/helpery (fasady)
│ │ ├── controls/ # Kontroler legacy (tylko Site — router)
│ │ ── view/ # Widok legacy (tylko Site — layout engine)
│ └── shop/ # Klasy sklepu
├── docs/ # Dokumentacja techniczna
├── libraries/ # Biblioteki zewnętrzne
@@ -177,7 +176,7 @@ Główna klasa helper (przeniesiona z `class.S.php`) z metodami:
- `\admin\controls\` - kontrolery legacy (fallback)
- `\Domain\` - repozytoria/logika domenowa
- `\admin\factory\` - helpery/fabryki admin
- `\front\factory\` - helpery/fabryki frontend
- ~~`\front\factory\`~~ - USUNIĘTY — wszystkie fabryki zmigrowane do Domain
- `\shop\` - klasy sklepu (Product, Order, itp.)
### Cachowanie produktów
@@ -243,10 +242,9 @@ autoload/
│ └── view/ # Widoki (statyczne - bez zmian)
├── front/
│ ├── Controllers/ # Nowe kontrolery frontendowe (namespace \front\Controllers\) z DI
│ ├── Views/ # Nowe widoki (namespace \front\Views\) — czyste VIEW, statyczne (Menu, Newsletter, Articles, Languages, Banners, Scontainers)
│ ├── controls/ # Legacy kontrolery (fallback)
── factory/ # Legacy helpery (stopniowo migrowane)
│ └── view/ # Legacy widoki
│ ├── Views/ # Nowe widoki (namespace \front\Views\) — czyste VIEW, statyczne (Menu, Newsletter, Articles, Languages, Banners, Scontainers, ShopCategory, ShopClient)
│ ├── controls/ # Legacy kontroler (tylko Site — router)
── view/ # Legacy widok (tylko Site — layout engine)
├── shop/ # Legacy - fasady do Domain
```
@@ -481,5 +479,16 @@ Pelna dokumentacja testow: `TESTING.md`
- UPDATE: `front\view\Site::show()` — przepiecie na `$producerRepo->findForFrontend()`
- UPDATE: `front\controls\Site::getControllerFactories()` — zarejestrowany `ShopProducer`
## Aktualizacja 2026-02-17 (ver. 0.292) - ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend migration
- **Pelna migracja front\factory\** — USUNIETY caly folder `autoload/front/factory/`; 5 ostatnich klas zmigrowanych:
- `front\factory\ShopProduct` (~410 linii) → `ProductRepository` (~20 nowych metod frontendowych)
- `front\factory\ShopPaymentMethod``PaymentMethodRepository` (metody frontendowe z Redis cache)
- `front\factory\ShopPromotion``PromotionRepository` (5 metod applyType*)
- `front\factory\ShopStatuses` → przepiecie bezposrednio na `ShopStatusRepository`
- `front\factory\ShopTransport``TransportRepository` (4 metody frontendowe z Redis cache)
- Usuniete legacy: `front\controls\class.ShopProduct.php`, `front\view\class.ShopPaymentMethod.php`, `front\view\class.ShopTransport.php`, `shop\class.PaymentMethod.php`
- FIX: broken `transports_list()` w ajax.php → nowa metoda `forPaymentMethod()`
- Pozostale w front\: `controls/class.Site.php` (router), `view/class.Site.php` (layout engine)
---
*Dokument aktualizowany: 2026-02-17 (ver. 0.291)*
*Dokument aktualizowany: 2026-02-17 (ver. 0.292)*

View File

@@ -36,7 +36,17 @@ Alternatywnie (Git Bash):
Ostatnio zweryfikowano: 2026-02-17
```text
OK (573 tests, 1738 assertions)
OK (610 tests, 1816 assertions)
```
Aktualizacja po migracji ShopProduct + ShopPaymentMethod + ShopPromotion + ShopStatuses + ShopTransport frontend (2026-02-17, ver. 0.292):
```text
Pelny suite: OK (610 tests, 1816 assertions)
Nowe testy: ProductRepositoryTest (+20: getSkuWithFallback, getEanWithFallback, isProductActiveCached, productCategoriesFront, getWarehouseMessageZero/Nonzero, topProductIds, newProductIds, promotedProductIdsCached, getMinimalPrice, productImageCached, productNameCached, productUrlCached, randomProductIds, productWp)
Nowe testy: PaymentMethodRepositoryTest (+5: paymentMethodsCached, paymentMethodCached, paymentMethodsByTransportCached, forTransportCached)
Nowe testy: PromotionRepositoryTest (+7: applyTypeWholeBasket, applyTypeCategoriesOr, applyTypeCategoryCondition 2 scenariusze, applyTypeCategoriesAnd)
Nowe testy: TransportRepositoryTest (+5: transportCostCached, findActiveByIdCached, findActiveByIdCachedNull, forPaymentMethod, forPaymentMethodEmpty)
Nowy stub: tests/stubs/ShopProduct.php (shop\Product::is_product_on_promotion, get_product_price)
```
Aktualizacja po migracji ShopProducer frontend (2026-02-17, ver. 0.291):
@@ -155,6 +165,10 @@ Nowe testy dodane 2026-02-15:
```text
tests/
|-- bootstrap.php
|-- stubs/
| |-- CacheHandler.php
| |-- Helpers.php
| `-- ShopProduct.php
|-- Unit/
| |-- Domain/
| | |-- Article/ArticleRepositoryTest.php

View File

@@ -18,16 +18,16 @@ Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesią
## Procedura tworzenia nowej aktualizacji
## Status biezacej aktualizacji (ver. 0.291)
## Status biezacej aktualizacji (ver. 0.292)
- Wersja udostepniona: `0.291` (data: 2026-02-17).
- Wersja udostepniona: `0.292` (data: 2026-02-17).
- Pliki publikacyjne:
- `updates/0.20/ver_0.291.zip`, `ver_0.291_files.txt`
- `temp/update_build/ver_0.292.zip`, `ver_0.292_files.txt`
- Pliki metadanych aktualizacji:
- `updates/changelog.php` (dodany wpis `ver. 0.291`)
- `updates/versions.php` (`$current_ver = 291`)
- `updates/changelog.php` (dodany wpis `ver. 0.292`)
- `updates/versions.php` (`$current_ver = 292`)
- Weryfikacja testow przed publikacja:
- `OK (573 tests, 1738 assertions)`
- `OK (610 tests, 1816 assertions)`
### 1. Określ numer wersji
Sprawdź ostatnią wersję w `updates/` i zwiększ o 1.