- $prices = $this -> product -> getDefaultCombinationPrices();
+ $prices = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getDefaultCombinationPrices( $this -> product );
if ( $prices )
{
if ( $prices['price_brutto_promo'] ):?>
- = \shop\Shop::shortPrice( $prices['price_brutto'] );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> zł
- = \shop\Shop::shortPrice( $prices['price_brutto_promo'] );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto_promo'] );?> zł
else:?>
- = \shop\Shop::shortPrice( $prices['price_brutto'] );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> zł
endif;
}
else
{
- if ( $this -> product -> price_brutto_promo ):?>
+ if ( $this -> product['price_brutto_promo'] ):?>
- = \shop\Shop::shortPrice( $this -> product -> price_brutto );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto'] );?> zł
- = \shop\Shop::shortPrice( $this -> product -> price_brutto_promo );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto_promo'] );?> zł
else:?>
- = \shop\Shop::shortPrice( $this -> product -> price_brutto );?> zł
+ = \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto'] );?> zł
endif;
};?>
diff --git a/templates/shop-search/products.php b/templates/shop-search/products.php
index 4841ada..e393bc6 100644
--- a/templates/shop-search/products.php
+++ b/templates/shop-search/products.php
@@ -7,7 +7,7 @@
if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
- 'product' => \shop\Product::getFromCache( $product_id, $lang_id )
+ 'product' => (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product_id, $lang_id )
] );
endforeach; endif;?>
\ No newline at end of file
diff --git a/tests/Unit/Domain/Promotion/PromotionRepositoryTest.php b/tests/Unit/Domain/Promotion/PromotionRepositoryTest.php
index 11ed56c..c9ec713 100644
--- a/tests/Unit/Domain/Promotion/PromotionRepositoryTest.php
+++ b/tests/Unit/Domain/Promotion/PromotionRepositoryTest.php
@@ -181,15 +181,6 @@ class PromotionRepositoryTest extends TestCase
// Frontend: basket promotion logic (migrated from front\factory\ShopPromotion)
// =========================================================================
- private function mockPromotion(array $data): object
- {
- return new class($data) {
- private $data;
- public function __construct($data) { $this->data = $data; }
- public function __get($key) { return isset($this->data[$key]) ? $this->data[$key] : null; }
- };
- }
-
private function makeBasket(array $items): array
{
$basket = [];
@@ -212,12 +203,12 @@ class PromotionRepositoryTest extends TestCase
$mockStmt->method('fetchAll')->willReturn([['category_id' => 1]]);
$mockDb->method('query')->willReturn($mockStmt);
- $promotion = $this->mockPromotion([
+ $promotion = [
'discount_type' => 1,
'amount' => 10,
'include_coupon' => 0,
'include_product_promo' => 0,
- ]);
+ ];
$basket = $this->makeBasket([
['id' => 1],
@@ -244,14 +235,14 @@ class PromotionRepositoryTest extends TestCase
$mockStmt->method('fetchAll')->willReturn([['category_id' => 5]]);
$mockDb->method('query')->willReturn($mockStmt);
- $promotion = $this->mockPromotion([
- 'categories' => json_encode([5]),
- 'condition_categories' => json_encode([10]),
+ $promotion = [
+ 'categories' => [5],
+ 'condition_categories' => [10],
'discount_type' => 1,
'amount' => 15,
'include_coupon' => 1,
'include_product_promo' => 0,
- ]);
+ ];
$basket = $this->makeBasket([['id' => 1]]);
@@ -282,14 +273,14 @@ class PromotionRepositoryTest extends TestCase
);
$mockDb->method('query')->willReturn($mockStmt1);
- $promotion = $this->mockPromotion([
- 'categories' => json_encode([5]),
- 'condition_categories' => json_encode([10]),
+ $promotion = [
+ 'categories' => [5],
+ 'condition_categories' => [10],
'discount_type' => 1,
'amount' => 20,
'include_coupon' => 0,
'include_product_promo' => 0,
- ]);
+ ];
$basket = $this->makeBasket([
['id' => 1],
@@ -316,14 +307,14 @@ class PromotionRepositoryTest extends TestCase
$mockStmt->method('fetchAll')->willReturn([['category_id' => 99]]); // nie pasuje do condition_categories
$mockDb->method('query')->willReturn($mockStmt);
- $promotion = $this->mockPromotion([
- 'categories' => json_encode([5]),
- 'condition_categories' => json_encode([10]),
+ $promotion = [
+ 'categories' => [5],
+ 'condition_categories' => [10],
'discount_type' => 1,
'amount' => 20,
'include_coupon' => 0,
'include_product_promo' => 0,
- ]);
+ ];
$basket = $this->makeBasket([['id' => 1]]);
@@ -353,14 +344,14 @@ class PromotionRepositoryTest extends TestCase
);
$mockDb->method('query')->willReturn($mockStmt);
- $promotion = $this->mockPromotion([
- 'categories' => json_encode([5]),
- 'condition_categories' => json_encode([10]),
+ $promotion = [
+ 'categories' => [5],
+ 'condition_categories' => [10],
'discount_type' => 1,
'amount' => 25,
'include_coupon' => 1,
'include_product_promo' => 0,
- ]);
+ ];
$basket = $this->makeBasket([
['id' => 1],
diff --git a/tests/Unit/front/Controllers/ShopOrderControllerTest.php b/tests/Unit/front/Controllers/ShopOrderControllerTest.php
index 2c54ef6..16fa7dc 100644
--- a/tests/Unit/front/Controllers/ShopOrderControllerTest.php
+++ b/tests/Unit/front/Controllers/ShopOrderControllerTest.php
@@ -4,21 +4,24 @@ namespace Tests\Unit\front\Controllers;
use PHPUnit\Framework\TestCase;
use front\Controllers\ShopOrderController;
use Domain\Order\OrderRepository;
+use Domain\Order\OrderAdminService;
class ShopOrderControllerTest extends TestCase
{
private $repository;
+ private $adminService;
private $controller;
protected function setUp(): void
{
$this->repository = $this->createMock(OrderRepository::class);
- $this->controller = new ShopOrderController($this->repository);
+ $this->adminService = $this->createMock(OrderAdminService::class);
+ $this->controller = new ShopOrderController($this->repository, $this->adminService);
}
public function testConstructorAcceptsRepository(): void
{
- $controller = new ShopOrderController($this->repository);
+ $controller = new ShopOrderController($this->repository, $this->adminService);
$this->assertInstanceOf(ShopOrderController::class, $controller);
}
@@ -37,7 +40,8 @@ class ShopOrderControllerTest extends TestCase
$constructor = $reflection->getConstructor();
$params = $constructor->getParameters();
- $this->assertCount(1, $params);
+ $this->assertCount(2, $params);
$this->assertEquals('Domain\Order\OrderRepository', $params[0]->getType()->getName());
+ $this->assertEquals('Domain\Order\OrderAdminService', $params[1]->getType()->getName());
}
}
diff --git a/updates/changelog.php b/updates/changelog.php
index d2a6063..d0f8c6c 100644
--- a/updates/changelog.php
+++ b/updates/changelog.php
@@ -1,3 +1,13 @@
+
ver. 0.294 - 18.02.2026
+- UPDATE - usuniecie 12 legacy klas z autoload/shop/ (~2363 linii) — pelna migracja na Domain-Driven Architecture
+- UPDATE - class.Order.php: logika Apilo sync i email statusu przeniesiona do OrderAdminService
+- UPDATE - class.Product.php: ~20 metod przeniesionych do ProductRepository, calculate_basket_product_price do BasketCalculator
+- FIX - findCached(): stale Redis cache z obiektami \shop\Product powodowal ceny 0,00 zl
+- FIX - LayoutEngine: niekwalifikowane Product::getFromCache() resolwaly do \front\Product
+- FIX - szablony: konwersja object access na array access po migracji Product
+- UPDATE - AttributeRepository::getAttributeValueById() — dodano Redis cache
+- CLEANUP - katalog autoload/shop/ pusty, zero referencji \shop\ w aktywnym kodzie
+
ver. 0.293 - 17.02.2026
- UPDATE - front\controls\Site przemianowany na front\App (router, camelCase: checkUrlParams, pageTitle)
- UPDATE - front\view\Site przemianowany na front\LayoutEngine (layout engine, camelCase: cookieInformation)
diff --git a/updates/versions.php b/updates/versions.php
index 861e4e9..6de390c 100644
--- a/updates/versions.php
+++ b/updates/versions.php
@@ -1,5 +1,5 @@
-$current_ver = 293;
+$current_ver = 294;
for ($i = 1; $i <= $current_ver; $i++)
{