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 22530df501
commit 69e78ca248
74 changed files with 2176 additions and 2669 deletions

View File

@@ -123,7 +123,7 @@
</thead>
<tbody>
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> best_sales_products ) ): foreach ( $this -> best_sales_products as $row ):?>
<? $product = \shop\Product::getFromCache( (int)$row['parent_product_id'], ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() );?>
<? $product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( (int)$row['parent_product_id'], ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() );?>
<tr>
<td>
<?
@@ -132,7 +132,7 @@
echo '<img src="'. $product['images'][0]['src'] . '">';
?>
</td>
<td><?= $product -> language['name'];?></td>
<td><?= $product['language']['name'];?></td>
<td class="text-center"><?= $row['quantity_summary'];?></td>
<td class="text-right"><?= number_format( $row['sales'], 2, '.', " " );?> zł</td>
</tr>
@@ -158,7 +158,7 @@
</thead>
<tbody>
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> most_view_products ) ): foreach ( $this -> most_view_products as $row ):?>
<? $product = new \shop\Product( $row['id'] );?>
<? $product = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->findCached( $row['id'] );?>
<tr>
<td>
<?

View File

@@ -73,7 +73,7 @@ $orderId = (int)($this -> order['id'] ?? 0);
<div class="panel-body">
<div>Kwota zamówienia <b><?= $this -> order[ 'summary' ];?> zł</b></div>
<? if ( $this -> coupon ):?>
<div>Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon -> name;?> - <?= $this -> coupon -> amount;?> <?= $this -> coupon -> type == 1 ? '%' : 'zł';?></span></div>
<div>Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon['name'];?> - <?= $this -> coupon['amount'];?> <?= $this -> coupon['type'] == 1 ? '%' : 'zł';?></span></div>
<? endif;?>
<br>
<div><?= strip_tags( $this -> order[ 'transport' ] );?>: <b><?= $this -> order[ 'transport_cost' ];?> zł</b></div>
@@ -168,11 +168,11 @@ $orderId = (int)($this -> order['id'] ?? 0);
<tr class="order-product-details">
<td class="product-image">
<? if ( $product['product_id'] ):?>
<img src="<?= \shop\Product::getProductImg( (int)$product_id );?>">
<img src="<?= ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getProductImg( (int)$product_id );?>">
<? endif;?>
</td>
<td>
<a href="<?= \shop\Product::getProductUrl( (int)$product_id );?>" target="_blank"><?= $product[ 'name' ];?></a>
<a href="<?= ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getProductUrl( (int)$product_id );?>" target="_blank"><?= $product[ 'name' ];?></a>
<br />
<div class="atributes">
<?= $product[ 'attributes' ];?>

View File

@@ -177,11 +177,11 @@ $orderId = (int)($this -> order['id'] ?? 0);
<tr class="order-product-details">
<td class="product-image">
<? if ( $product['product_id'] ):?>
<img src="<?= \shop\Product::getProductImg( (int)$product['product_id'] );?>">
<img src="<?= ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getProductImg( (int)$product['product_id'] );?>">
<? endif;?>
</td>
<td>
<a href="<?= \shop\Product::getProductUrl( (int)$product['product_id'] );?>" target="_blank"><?= $product[ 'name' ];?></a>
<a href="<?= ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getProductUrl( (int)$product['product_id'] );?>" target="_blank"><?= $product[ 'name' ];?></a>
<br />
<div class="atributes">
<?= $product[ 'attributes' ];?>

View File

@@ -29,7 +29,8 @@
$attributes = explode( '|', $product['permutation_hash'] );
foreach ( $attributes as $attribute ):
$attribute_tmp = explode( '-', $attribute );
echo \shop\ProductAttribute::getAttributeName( (int)$attribute_tmp[0], $this -> default_language ) . ' - <b>' . \shop\ProductAttribute::get_value_name( (int)$attribute_tmp[1], $this -> default_language ) . '</b>';
$attrRepo = new \Domain\Attribute\AttributeRepository( $GLOBALS['mdb'] );
echo $attrRepo->getAttributeNameById( (int)$attribute_tmp[0], $this -> default_language ) . ' - <b>' . $attrRepo->getAttributeValueById( (int)$attribute_tmp[1], $this -> default_language ) . '</b>';
if ( $attribute != end( $attributes ) )
echo ', ';
endforeach;