ver. 0.294: Remove all 12 legacy autoload/shop/ classes (~2363 lines)

Complete Domain-Driven Architecture migration:
- Phase 1-4: Transport, ProductSet, Coupon, Shop, Search, Basket,
  ProductCustomField, Category, ProductAttribute, Promotion
- Phase 5: Order (~562 lines) + Product (~952 lines)
- ~20 Product methods migrated to ProductRepository
- Apilo sync migrated to OrderAdminService
- Production hotfixes: stale Redis cache (prices 0.00), unqualified
  Product:: refs in LayoutEngine, object->array template conversion
- AttributeRepository::getAttributeValueById() Redis cache added

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 02:05:39 +01:00
parent c72ba388a0
commit e1cb421aaf
74 changed files with 2176 additions and 2669 deletions

View File

@@ -34,7 +34,7 @@ class ShopBasketController
unset( $basket[ $product_hash ] );
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
\Shared\Helpers\Helpers::set_session( 'basket', $basket );
@@ -51,11 +51,11 @@ class ShopBasketController
$basket_transport_method_id = \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' );
$basket[ $product_hash ][ 'quantity' ]++;
\shop\Basket::check_product_quantity_in_stock( $basket, false );
\Domain\Basket\BasketCalculator::checkProductQuantityInStock( $basket, false );
$basket = \Shared\Helpers\Helpers::get_session( 'basket' );
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
\Shared\Helpers\Helpers::set_session( 'basket', $basket );
@@ -76,7 +76,7 @@ class ShopBasketController
if ( $basket[ $product_hash ][ 'quantity' ] < 1 )
unset( $basket[ $product_hash ] );
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
\Shared\Helpers\Helpers::set_session( 'basket', $basket );
@@ -97,9 +97,9 @@ class ShopBasketController
if ( $basket[ $product_hash ][ 'quantity' ] < 1 )
unset( $basket[ $product_hash ] );
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
\shop\Basket::check_product_quantity_in_stock( $basket, false );
\Domain\Basket\BasketCalculator::checkProductQuantityInStock( $basket, false );
$basket = \Shared\Helpers\Helpers::get_session( 'basket' );
@@ -116,7 +116,7 @@ class ShopBasketController
public function basketAddProduct()
{
$basket = \shop\Basket::validate_basket( \Shared\Helpers\Helpers::get_session( 'basket' ) );
$basket = \Domain\Basket\BasketCalculator::validateBasket( \Shared\Helpers\Helpers::get_session( 'basket' ) );
$values_tmp = json_decode( \Shared\Helpers\Helpers::get( 'values' ), true );
$values = [];
$attributes = [];
@@ -144,7 +144,7 @@ class ShopBasketController
if ( \Shared\Helpers\Helpers::is_array_fix( $attributes ) )
{
$values['parent_id'] = $values[ 'product-id' ];
$values['product-id'] = \shop\Product::get_product_id_by_attributes( $values[ 'product-id' ], $attributes );
$values['product-id'] = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getProductIdByAttributes( $values[ 'product-id' ], $attributes );
$values['attributes'] = $attributes;
}
@@ -164,7 +164,7 @@ class ShopBasketController
$basket[ $product_code ]['message'] = $values['product-message'];
$basket[ $product_code ]['custom_fields'] = $custom_fields;
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
\Shared\Helpers\Helpers::set_session( 'basket', $basket );
@@ -174,7 +174,7 @@ class ShopBasketController
'result' => 'ok',
'basket_mini_count' => \Domain\Basket\BasketCalculator::countProductsText( \Domain\Basket\BasketCalculator::countProducts( $basket ) ),
'basket_mini_value' => \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ),
'product_sets' => \shop\Product::product_sets_when_add_to_basket( (int)$values['product-id'] )
'product_sets' => ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->productSetsWhenAddToBasket( (int)$values['product-id'] )
] );
exit;
}
@@ -261,7 +261,7 @@ class ShopBasketController
{
global $lang_id, $settings;
if ( \shop\Basket::check_product_quantity_in_stock( \Shared\Helpers\Helpers::get_session( 'basket' ) ) )
if ( \Domain\Basket\BasketCalculator::checkProductQuantityInStock( \Shared\Helpers\Helpers::get_session( 'basket' ) ) )
{
header( 'Location: /koszyk' );
exit;
@@ -286,7 +286,7 @@ class ShopBasketController
{
$client = \Shared\Helpers\Helpers::get_session( 'client' );
if ( \shop\Basket::check_product_quantity_in_stock( \Shared\Helpers\Helpers::get_session( 'basket' ) ) )
if ( \Domain\Basket\BasketCalculator::checkProductQuantityInStock( \Shared\Helpers\Helpers::get_session( 'basket' ) ) )
{
header( 'Location: /koszyk' );
exit;
@@ -357,13 +357,13 @@ class ShopBasketController
$payment_method_id = \Shared\Helpers\Helpers::get_session( 'payment_method_id' );
$basket_transport_method_id = \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' );
if ( \shop\Basket::check_product_quantity_in_stock( $basket ) )
if ( \Domain\Basket\BasketCalculator::checkProductQuantityInStock( $basket ) )
{
header( 'Location: /koszyk' );
exit;
}
$basket = \shop\Promotion::find_promotion( $basket );
$basket = (new \Domain\Promotion\PromotionRepository($GLOBALS['mdb']))->findPromotion( $basket );
return \Shared\Tpl\Tpl::view( 'shop-basket/basket', [
'basket' => $basket,