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:
@@ -1,6 +1,6 @@
|
||||
<? global $lang_id, $mdb;?>
|
||||
<?
|
||||
$attributes = \shop\Product::get_product_attributes( $this -> product['product_combinations'] );
|
||||
$attributes = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->getProductAttributes( $this -> product['product_combinations'] );
|
||||
$dictionariesRepository = new \Domain\Dictionaries\DictionariesRepository( $mdb );
|
||||
?>
|
||||
<script class="footer" type="text/javascript">
|
||||
@@ -19,21 +19,21 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<div id="image-big">
|
||||
<? if ( $this -> product -> new_to_date and $this -> product -> new_to_date >= date( 'Y-m-d' ) ):?>
|
||||
<? if ( $this -> product['new_to_date'] and $this -> product['new_to_date'] >= date( 'Y-m-d' ) ):?>
|
||||
<div class="new"><?= \Shared\Helpers\Helpers::lang( 'nowosc' );?></div>
|
||||
<? endif;?>
|
||||
<? if ( file_exists( substr( $this -> product -> images[0]['src'], 1 ) ) ):?>
|
||||
<? if ( file_exists( substr( $this -> product['images'][0]['src'], 1 ) ) ):?>
|
||||
<a image-id="0">
|
||||
<img src="/thumb/625/0<?= $this -> product -> images[0]['src'];?>" alt="">
|
||||
<img src="/thumb/625/0<?= $this -> product['images'][0]['src'];?>" alt="">
|
||||
</a>
|
||||
<? else:?>
|
||||
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="gallery">
|
||||
<? for ( $i = 0; $i < count( $this -> product -> images ); $i++ ): if ( file_exists( substr( $this -> product -> images[$i]['src'], 1 ) ) ):?>
|
||||
<a href="<?= $this -> product -> images[$i]['src'];?>" class="item" data-fancybox="product" id="image-<?= $i;?>" i="<?= $i;?>">
|
||||
<img src="/thumb/180/0<?= $this -> product -> images[$i]['src'];?>" src="" alt="<?= $this -> product -> images[$i]['alt'];?>">
|
||||
<? for ( $i = 0; $i < count( $this -> product['images'] ); $i++ ): if ( file_exists( substr( $this -> product['images'][$i]['src'], 1 ) ) ):?>
|
||||
<a href="<?= $this -> product['images'][$i]['src'];?>" class="item" data-fancybox="product" id="image-<?= $i;?>" i="<?= $i;?>">
|
||||
<img src="/thumb/180/0<?= $this -> product['images'][$i]['src'];?>" src="" alt="<?= $this -> product['images'][$i]['alt'];?>">
|
||||
</a>
|
||||
<? endif; endfor;?>
|
||||
</div>
|
||||
@@ -45,36 +45,36 @@
|
||||
'lang_id' => $this -> lang_id,
|
||||
'settings' => $this -> settings
|
||||
] );?>
|
||||
<h1><?= $this -> product -> language['name'];?></h1>
|
||||
<h1><?= $this -> product['language']['name'];?></h1>
|
||||
<div class="prices">
|
||||
<? if ( $this -> product -> price_brutto_promo ):?>
|
||||
<? if ( $this -> product['price_brutto_promo'] ):?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto_promo );?> <span class="small">zł</span>
|
||||
<?= \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto_promo'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<div class="price-old">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto );?> <span class="small">zł</span>
|
||||
<?= \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<div class="price-minimal">
|
||||
Najniższa cena w ciągu ostatnich 30 dni: <strong><?= \shop\Shop::shortPrice( ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getMinimalPriceCached( (int)$this -> product['id'], $this -> product -> price_brutto_promo ) );?> zł</strong>
|
||||
Najniższa cena w ciągu ostatnich 30 dni: <strong><?= \Shared\Helpers\Helpers::shortPrice( ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getMinimalPriceCached( (int)$this -> product['id'], $this -> product['price_brutto_promo'] ) );?> zł</strong>
|
||||
</div>
|
||||
<? if ( $this -> product -> weight > 0 && $this -> product -> product_unit_id ):?>
|
||||
<? if ( $this -> product['weight'] > 0 && $this -> product['product_unit_id'] ):?>
|
||||
<div class="price_weight">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto_promo / $this -> product -> wegiht * 1 );?> <?= $this -> product -> product_unit;?>
|
||||
<?= \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto_promo'] / $this -> product['wegiht'] * 1 );?> <?= $this -> product['product_unit'];?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? else:?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto );?> <span class="small">zł</span>
|
||||
<?= \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? if ( $this -> product -> weight > 0 && $this -> product -> product_unit_id ):?>
|
||||
<? if ( $this -> product['weight'] > 0 && $this -> product['product_unit_id'] ):?>
|
||||
<div class="price_weight">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto / $this -> product -> weight );?> <span class="small">zł</span> / <?= $dictionariesRepository -> getUnitNameById( (int)$this -> product -> product_unit_id, $this -> lang_id );?>
|
||||
<?= \Shared\Helpers\Helpers::shortPrice( $this -> product['price_brutto'] / $this -> product['weight'] );?> <span class="small">zł</span> / <?= $dictionariesRepository -> getUnitNameById( (int)$this -> product['product_unit_id'], $this -> lang_id );?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<form class="product-options" id="product-<?= $this -> product['id'];?>">
|
||||
<input type="hidden" name="product-id" value="<?= $this -> product -> id;?>">
|
||||
<input type="hidden" name="product-id" value="<?= $this -> product['id'];?>">
|
||||
<? if ( \Shared\Helpers\Helpers::is_array_fix( $attributes ) ):?>
|
||||
<div id="attributes">
|
||||
<div class="title">Opcje produktu</div>
|
||||
@@ -114,8 +114,8 @@
|
||||
<script class="footer" type="text/javascript">
|
||||
$(function ()
|
||||
{
|
||||
$('#product-<?= $this -> product -> id;?> .add-to-basket .quantity-container, #product-<?= $this -> product -> id;?> .add-to-basket #add-to-basket').addClass('hidden');
|
||||
$('#product-<?= $this -> product -> id;?> .add-to-basket .alert').removeClass('hidden');
|
||||
$('#product-<?= $this -> product['id'];?> .add-to-basket .quantity-container, #product-<?= $this -> product['id'];?> .add-to-basket #add-to-basket').addClass('hidden');
|
||||
$('#product-<?= $this -> product['id'];?> .add-to-basket .alert').removeClass('hidden');
|
||||
});
|
||||
</script>
|
||||
<? endif;?>
|
||||
@@ -132,7 +132,7 @@
|
||||
]);?>
|
||||
|
||||
<div class="short-description">
|
||||
<?= $this -> product -> language['short_description'];?>
|
||||
<?= $this -> product['language']['short_description'];?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,20 +142,20 @@
|
||||
<div class="col-12 col-lg-8">
|
||||
<ul class="tabs" id="tabs-menu">
|
||||
<li class="tab-link current" id="tab-link-0" tab="0"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'opis' ) );?></li>
|
||||
<? if ( $this -> product -> language['tab_name_1'] ):?>
|
||||
<li class="tab-link" id="tab-link-1" tab="1"><?= $this -> product -> language['tab_name_1'];?></li>
|
||||
<? if ( $this -> product['language']['tab_name_1'] ):?>
|
||||
<li class="tab-link" id="tab-link-1" tab="1"><?= $this -> product['language']['tab_name_1'];?></li>
|
||||
<? endif;?>
|
||||
<li class="tab-link" id="tab-link-2" tab="2"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'opinie' ) );?></li>
|
||||
<li class="tab-link" id="tab-link-3" tab="3">Bezpieczeństwo</li>
|
||||
</ul>
|
||||
<div id="tab-0" class="tab-content">
|
||||
<div class="tab-title"><?= \Shared\Helpers\Helpers::lang( 'opis-produktu' );?></div>
|
||||
<?= $this -> product -> language['description'];?>
|
||||
<?= $this -> product['language']['description'];?>
|
||||
</div>
|
||||
<? if ( $this -> product -> language['tab_description_1'] ):?>
|
||||
<? if ( $this -> product['language']['tab_description_1'] ):?>
|
||||
<div id="tab-1" class="tab-content">
|
||||
<div class="tab-title"><?= $this -> product -> language['tab_name_1'];?></div>
|
||||
<?= $this -> product -> language['tab_description_1'];?>
|
||||
<div class="tab-title"><?= $this -> product['language']['tab_name_1'];?></div>
|
||||
<?= $this -> product['language']['tab_description_1'];?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div id="tab-2" class="tab-content reviews">
|
||||
@@ -202,11 +202,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4">
|
||||
<? if ( $this -> product -> language['tab_name_2'] ):?>
|
||||
<? if ( $this -> product['language']['tab_name_2'] ):?>
|
||||
<div class="description-right">
|
||||
<div class="title"><?= $this -> product -> language['tab_name_2'];?></div>
|
||||
<div class="title"><?= $this -> product['language']['tab_name_2'];?></div>
|
||||
<div class="content">
|
||||
<?= $this -> product -> language['tab_description_2'];?>
|
||||
<?= $this -> product['language']['tab_description_2'];?>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
@@ -221,8 +221,8 @@
|
||||
<div class="owl-carousel owl-theme">
|
||||
<?
|
||||
foreach ( $this -> product['products_sets'] as $product_sets_id ):
|
||||
$product = \shop\Product::getFromCache( $product_sets_id, $lang_id );
|
||||
if ( $product and $product -> status ):
|
||||
$product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product_sets_id, $lang_id );
|
||||
if ( $product and $product['status'] ):
|
||||
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
|
||||
'product' => $product,
|
||||
'class' => 'item'
|
||||
@@ -243,8 +243,8 @@
|
||||
<div class="owl-carousel owl-theme">
|
||||
<?
|
||||
foreach ( $this -> product['products_related'] as $product_related_id ):
|
||||
$product = \shop\Product::getFromCache( $product_related_id, $lang_id );
|
||||
if ( $product and $product -> status ):
|
||||
$product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product_related_id, $lang_id );
|
||||
if ( $product and $product['status'] ):
|
||||
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
|
||||
'product' => $product,
|
||||
'class' => 'item'
|
||||
@@ -275,9 +275,9 @@
|
||||
ecommerce: {
|
||||
items: [
|
||||
{
|
||||
item_id: "<?= $this -> product -> id;?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product -> language['name'] );?>",
|
||||
price: '<? if ( $this -> product -> price_brutto_promo ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto ); endif;?>',
|
||||
item_id: "<?= $this -> product['id'];?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product['language']['name'] );?>",
|
||||
price: '<? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>',
|
||||
quantity: 1
|
||||
}
|
||||
]
|
||||
@@ -556,8 +556,8 @@
|
||||
if (!check)
|
||||
return false;
|
||||
|
||||
var values = $( '#product-<?= $this -> product -> id;?>' ).serializeArray();
|
||||
var quantity = $('#product-<?= $this -> product -> id;?> #quantity').val();
|
||||
var values = $( '#product-<?= $this -> product['id'];?>' ).serializeArray();
|
||||
var quantity = $('#product-<?= $this -> product['id'];?> #quantity').val();
|
||||
|
||||
jQuery.ajax(
|
||||
{
|
||||
@@ -586,15 +586,15 @@
|
||||
for (var i = 1; i <= quantity; i++)
|
||||
{
|
||||
fbq('track', 'AddToCart', {
|
||||
content_name: '<?= str_replace( '"', '', $this -> product -> language['name'] );?>',
|
||||
content_name: '<?= str_replace( '"', '', $this -> product['language']['name'] );?>',
|
||||
content_category: 'produkt',
|
||||
content_ids: ['<?= $this -> product -> id;?>'],
|
||||
content_ids: ['<?= $this -> product['id'];?>'],
|
||||
content_type: 'product',
|
||||
value: '<?
|
||||
if ( $this -> product -> price_brutto_promo ):
|
||||
echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto_promo );
|
||||
if ( $this -> product['price_brutto_promo'] ):
|
||||
echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] );
|
||||
else:
|
||||
echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto );
|
||||
echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] );
|
||||
endif;
|
||||
?>',
|
||||
currency: 'PLN'
|
||||
@@ -603,7 +603,7 @@
|
||||
<? endif;?>
|
||||
|
||||
<? if ( $this -> settings['google_tag_manager_id'] ):?>
|
||||
var add_to_cart_value = <? if ( $this -> product -> price_brutto_promo ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto ); endif;?> * quantity;
|
||||
var add_to_cart_value = <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?> * quantity;
|
||||
dataLayer.push({ ecommerce: null });
|
||||
dataLayer.push({
|
||||
event: "add_to_cart",
|
||||
@@ -612,9 +612,9 @@
|
||||
value: add_to_cart_value,
|
||||
items: [
|
||||
{
|
||||
item_id: "<?= $this -> product -> id;?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product -> language['name'] );?>",
|
||||
price: <? if ( $this -> product -> price_brutto_promo ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto_promo ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product -> price_brutto ); endif;?>,
|
||||
item_id: "<?= $this -> product['id'];?>",
|
||||
item_name: "<?= str_replace( '"', '', $this -> product['language']['name'] );?>",
|
||||
price: <? if ( $this -> product['price_brutto_promo'] ): echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto_promo'] ); else: echo \Shared\Helpers\Helpers::normalize_decimal( $this -> product['price_brutto'] ); endif;?>,
|
||||
quantity: quantity
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user