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

@@ -3,29 +3,30 @@
<h2>Dobierz inne produkty do kompletu</h2>
<? endif;?>
<div class="product-sets">
<? $productRepo = new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ); ?>
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = new \shop\Product( $product_id );
$product = $productRepo->findCached( $product_id, $lang_id );
$product -> language['seo_link'] ? $url = '/' . $product -> language['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product -> language['name'] );
$product['language']['seo_link'] ? $url = '/' . $product['language']['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product['language']['name'] );
if ( \Shared\Helpers\Helpers::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() and $url != '#' )
$url = '/' . \Shared\Helpers\Helpers::get_session( 'current-lang' ) . $url;
?>
<div class="product">
<? if ( $product -> new_to_date and $product -> new_to_date >= date( 'Y-m-d' ) ):?>
<? if ( $product['new_to_date'] and $product['new_to_date'] >= date( 'Y-m-d' ) ):?>
<div class="new"><?= \Shared\Helpers\Helpers::lang( 'nowosc' );?></div>
<? endif;?>
<a href="<?= $url;?>" class="a-img">
<div class="img">
<? if ( file_exists( substr( $product -> images[0]['src'], 1 ) ) ):?>
<? if ( file_exists( substr( $product['images'][0]['src'], 1 ) ) ):?>
<? if ( $this -> class == 'item' ):?>
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? else:?>
<img class="lozad first" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<? if ( file_exists( substr( $product -> images[1]['src'], 1 ) ) ):?>
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product -> images[1]['src'], 1, strlen( $product -> images[1]['src'] ) );?>" alt="<?= $product -> images[1]['alt'];?>">
<img class="lozad first" data-src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? if ( file_exists( substr( $product['images'][1]['src'], 1 ) ) ):?>
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product['images'][1]['src'], 1, strlen( $product['images'][1]['src'] ) );?>" alt="<?= $product['images'][1]['alt'];?>">
<? else:?>
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<img class="lozad second" data-src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? endif;?>
<? endif;?>
<? else:?>
@@ -36,20 +37,20 @@
<div class="product-details">
<h2 class="name">
<a href="<?= $url;?>" class="a-name">
<?= $product -> language['name'];?>
<?= $product['language']['name'];?>
</a>
</h2>
<div class="prices">
<? if ( $product -> price_brutto_promo ):?>
<? if ( $product['price_brutto_promo'] ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto'] );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto_promo );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto_promo'] );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto'] );?> <span class="small">zł</span>
</div>
<? endif;?>
</div>

View File

@@ -1,6 +1,6 @@
<? if ( $this -> custom_fields ) : ?>
<? foreach ( $this -> custom_fields as $key => $val ) : ?>
<? $custom_field = \shop\ProductCustomField::getFromCache( $key ); ?>
<? $custom_field = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->findCustomFieldCached( $key ); ?>
<? if ( $custom_field['type'] == 'text' ) : ?>
<div class="custom-field">

View File

@@ -3,29 +3,30 @@
<h2>Dobierz inne produkty do kompletu</h2>
<? endif;?>
<div class="product-sets">
<? $productRepo = new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ); ?>
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = \shop\Product::getFromCache( $product_id, $lang_id );
$product = $productRepo->findCached( $product_id, $lang_id );
$product -> language['seo_link'] ? $url = '/' . $product -> language['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product -> language['name'] );
$product['language']['seo_link'] ? $url = '/' . $product['language']['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product['language']['name'] );
if ( \Shared\Helpers\Helpers::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() and $url != '#' )
$url = '/' . \Shared\Helpers\Helpers::get_session( 'current-lang' ) . $url;
?>
<div class="product">
<? if ( $product -> new_to_date and $product -> new_to_date >= date( 'Y-m-d' ) ):?>
<? if ( $product['new_to_date'] and $product['new_to_date'] >= date( 'Y-m-d' ) ):?>
<div class="new"><?= \Shared\Helpers\Helpers::lang( 'nowosc' );?></div>
<? endif;?>
<a href="<?= $url;?>" class="a-img">
<div class="img">
<? if ( file_exists( substr( $product -> images[0]['src'], 1 ) ) ):?>
<? if ( file_exists( substr( $product['images'][0]['src'], 1 ) ) ):?>
<? if ( $this -> class == 'item' ):?>
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? else:?>
<img class="first" src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<? if ( file_exists( substr( $product -> images[1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/490/0/<?= substr( $product -> images[1]['src'], 1, strlen( $product -> images[1]['src'] ) );?>" alt="<?= $product -> images[1]['alt'];?>">
<img class="first" src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? if ( file_exists( substr( $product['images'][1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/490/0/<?= substr( $product['images'][1]['src'], 1, strlen( $product['images'][1]['src'] ) );?>" alt="<?= $product['images'][1]['alt'];?>">
<? else:?>
<img class="second" src="/thumb/490/0/<?= substr( $product -> images[0]['src'], 1, strlen( $product -> images[0]['src'] ) );?>" alt="<?= $product -> images[0]['alt'];?>">
<img class="second" src="/thumb/490/0/<?= substr( $product['images'][0]['src'], 1, strlen( $product['images'][0]['src'] ) );?>" alt="<?= $product['images'][0]['alt'];?>">
<? endif;?>
<? endif;?>
<? else:?>
@@ -36,39 +37,39 @@
<div class="product-details">
<h2 class="name">
<a href="<?= $url;?>" class="a-name">
<?= $product -> language['name'];?>
<?= $product['language']['name'];?>
</a>
</h2>
<div class="prices">
<?
$prices = $product -> getDefaultCombinationPrices();
$prices = $productRepo->getDefaultCombinationPrices( $product );
if ( $prices )
{
if ( $prices['price_brutto_promo'] ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<? endif;
}
else
{
if ( $product -> price_brutto_promo ):?>
if ( $product['price_brutto_promo'] ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto'] );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto_promo );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto_promo'] );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $product['price_brutto'] );?> <span class="small">zł</span>
</div>
<? endif;
};?>

View File

@@ -6,16 +6,16 @@
<?
unset( $price );
unset( $price_new );
$product = \shop\Product::getFromCache( (int)$position['product-id'], $this -> lang_id );
$product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( (int)$position['product-id'], $this -> lang_id );
$permutation = null;
if ( isset( $position['parent_id'] ) and (int)$position['parent_id'] and isset( $position['product-id'] ) )
$permutation = \shop\Product::get_product_permutation_hash( (int)$position['product-id'] );
$permutation = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->getProductPermutationHash( (int)$position['product-id'] );
if ( !$permutation and isset( $position['attributes'] ) and is_array( $position['attributes'] ) and count( $position['attributes'] ) )
$permutation = implode( '|', $position['attributes'] );
$quantity_options = \shop\Product::get_product_permutation_quantity_options(
$quantity_options = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->getProductPermutationQuantityOptions(
(int)( $position['parent_id'] ? $position['parent_id'] : $position['product-id'] ),
$permutation
);
@@ -63,7 +63,7 @@
<?= \Shared\Tpl\Tpl::view( 'shop-basket/_partials/product-custom-fields', [
'custom_fields' => $position['custom_fields']
] ); ?>
<? if ( $product -> additional_message ):?>
<? if ( $product['additional_message'] ):?>
<div class="basket-product-message">
<textarea name="product-message" class="form-control" position="<?= $position_hash;?>" placeholder="Miejsce na dodatkową wiadomość"><?= htmlspecialchars( $position['message'] );?></textarea>
</div>
@@ -72,7 +72,7 @@
<div class="prices">
<div class="price">
<?
$price_product = \shop\Product::calculate_basket_product_price( (float)$product['price_brutto_promo'], (float)$product['price_brutto'], $this -> coupon, $position );
$price_product = \Domain\Basket\BasketCalculator::calculateBasketProductPrice( (float)$product['price_brutto_promo'], (float)$product['price_brutto'], $this -> coupon, $position );
if ( $price_product['price_new'] )
echo \Shared\Helpers\Helpers::decimal( $price_product['price_new'] ) . ' zł';

View File

@@ -4,7 +4,7 @@
<div id="basket-summary" class="content">
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
<? foreach ( $this -> basket as $position_hash => $position ):?>
<? $product = \shop\Product::getFromCache( $position[ 'product-id' ], $this -> lang_id );?>
<? $product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $position[ 'product-id' ], $this -> lang_id );?>
<div class="basket-product">
<div class="image">
<? if ( file_exists( substr( $product[ 'images' ][ 0 ][ 'src' ], 1 ) ) ):?>
@@ -51,7 +51,7 @@
<div class="prices">
<div class="price">
<?
$price_product = \shop\Product::calculate_basket_product_price((float)$product['price_brutto_promo'], (float)$product['price_brutto'], $this -> coupon, $position);
$price_product = \Domain\Basket\BasketCalculator::calculateBasketProductPrice((float)$product['price_brutto_promo'], (float)$product['price_brutto'], $this -> coupon, $position);
if ($price_product['price_new'])
echo \Shared\Helpers\Helpers::decimal($price_product['price_new']) . ' zł';

View File

@@ -2,7 +2,7 @@
<div class="row">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):?>
<?= \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 ),
'class' => 'col-12 col-sm-6 col-lg-3'
] );?>
<? endforeach; endif;?>

View File

@@ -14,7 +14,7 @@ endif;
<div class="category-content">
<? 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; ?>

View File

@@ -16,7 +16,7 @@ endif;
if ( $this -> category['view_subcategories'] ):
echo \Shared\Tpl\Tpl::view( 'shop-category/_partials/category-subcategory-tiles', [
'categories' => \shop\Category::get_subcategory_by_category( $this -> category['id'] ),
'categories' => ( new \Domain\Category\CategoryRepository( $GLOBALS['mdb'] ) )->subcategoriesLangCached( (int)$this -> category['id'] ),
] );
endif;
@@ -25,7 +25,7 @@ endif;
<div class="category-content" t='2'>
<? 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;?>
</div>

View File

@@ -5,10 +5,10 @@
</div>
<? endif;?>
<div class="category-content">
<? $productRepo = new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ); ?>
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = new \shop\Product( $product_id );
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
'product' => new \shop\Product( $product_id, $lang_id )
'product' => $productRepo->findCached( $product_id, $lang_id )
] );
endforeach; endif;?>
</div>

View File

@@ -9,7 +9,7 @@
<? if ( is_array( $this -> orders ) ): foreach ( $this -> orders as $order ):?>
<?= \Shared\Tpl\Tpl::view( 'shop-order/order-simple', [
'order' => $order,
'statuses' => \shop\Order::order_statuses()
'statuses' => ( new \Domain\Order\OrderRepository( $GLOBALS['mdb'] ) )->orderStatuses()
] );?>
<? endforeach; endif;?>
</div>

View File

@@ -64,7 +64,7 @@ echo $this -> settings['newsletter_header'];
</thead>
<tbody>
<? if ( is_array( $this -> order['products'] ) ): foreach ( $this -> order['products'] as $position ):?>
<? $product = \shop\Product::getFromCache( $position['product_id'], $lang_id );?>
<? $product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $position['product_id'], $lang_id );?>
<tr style="border-bottom: 1px solid #eee;">
<td style="padding: 10px 10px 10px 0;" colspan="4">
<?

View File

@@ -6,7 +6,7 @@
<?= \Shared\Tpl\Tpl::view( 'shop-order/order-simple', [
'order' => $this -> order,
'coupon' => $this -> coupon,
'statuses' => \shop\Order::order_statuses()
'statuses' => ( new \Domain\Order\OrderRepository( $GLOBALS['mdb'] ) )->orderStatuses()
] );?>
<? if ( $this -> order['status'] == 0 or $this -> order['status'] == 2 ):?>
<div class="order-bottom">

View File

@@ -39,7 +39,7 @@
<div class="products">
<? if ( is_array( $this -> order['products'] ) and count( $this -> order['products'] ) ):?>
<? foreach ( $this -> order['products'] as $product ):?>
<? $product_tmp = \shop\Product::getFromCache( $product['product_id'], $lang['id'] );?>
<? $product_tmp = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product['product_id'], $lang['id'] );?>
<div class="basket-product">
<div class="image">
<? if ( file_exists( substr( $product_tmp['images'][0]['src'], 1 ) ) ):?>
@@ -90,7 +90,7 @@
<? endif;?>
<? if ( $this -> coupon ):?>
<div class="basket-summary">
Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon -> name;?> - <?= $this -> coupon -> amount;?> <?= $this -> coupon -> type == 1 ? '%' : 'zł';?></span>
Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon['name'];?> - <?= $this -> coupon['amount'];?> <?= $this -> coupon['type'] == 1 ? '%' : 'zł';?></span>
</div>
<? endif;?>
<div class="basket-summary">

View File

@@ -2,7 +2,7 @@
<div class="category-content">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
'product' => $product = \shop\Product::getFromCache( $product_id, $lang_id )
'product' => $product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product_id, $lang_id )
] );
endforeach; endif;?>
</div>

View File

@@ -10,7 +10,7 @@ if ( $attribute_details['type'] == 0 )
<? foreach ( $this -> attribute['values'] as $value ):?>
<div class="fradio">
<input type="radio" id="<?= $this -> attribute['id'];?>-<?= $value['id'];?>" <? if ( $value['is_default'] ):?>checked="checked"<? endif;?> require="true" value="<?= $this -> attribute['id'];?>-<?= $value['id'];?>" name="<?= \Shared\Helpers\Helpers::seo( $attribute_details['language']['name'] );?>">
<label for="<?= $this -> attribute['id'];?>-<?= $value['id'];?>" order="<?= $this -> order;?>"><?= \shop\ProductAttribute::get_value_name( $value['id'], $lang_id );?></label>
<label for="<?= $this -> attribute['id'];?>-<?= $value['id'];?>" order="<?= $this -> order;?>"><?= ( new \Domain\Attribute\AttributeRepository( $GLOBALS['mdb'] ) )->getAttributeValueById( $value['id'], $lang_id );?></label>
</div>
<? if ( $value['is_default'] ):?>
<script class="footer" type="text/javascript">

View File

@@ -1,6 +1,5 @@
<?php
use shop\Product;
$product_meta = Product::product_meta($this->product_id);
$product_meta = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->productMeta( $this->product_id );
?>
<?php if (is_array($product_meta) && count($product_meta)): ?>

View File

@@ -5,15 +5,15 @@
{
if ( $this -> product['quantity'] > 0 or $this -> product['quantity'] == 0 and $this -> product['stock_0_buy'] )
{
if ( $this -> product -> language['warehouse_message_nonzero'] )
echo $this -> product -> language['warehouse_message_nonzero'];
if ( $this -> product['language']['warehouse_message_nonzero'] )
echo $this -> product['language']['warehouse_message_nonzero'];
else if ( $this -> settings['warehouse_message_nonzero_' . $this -> lang_id] )
echo $this -> settings['warehouse_message_nonzero_' . $this -> lang_id];
}
else
{
if ( $this -> product -> language['warehouse_message_zero'] )
echo $this -> product -> language['warehouse_message_zero'];
if ( $this -> product['language']['warehouse_message_zero'] )
echo $this -> product['language']['warehouse_message_zero'];
else if ( $this -> settings['warehouse_message_zero_' . $this -> lang_id] )
echo $this -> settings['warehouse_message_zero_' . $this -> lang_id];
}

View File

@@ -1,25 +1,25 @@
<? global $lang_id;?>
<?
$this -> product -> language['seo_link'] ? $url = '/' . $this -> product -> language['seo_link'] : $url = '/p-' . $this -> product['id'] . '-' . \Shared\Helpers\Helpers::seo( $this -> product -> language['name'] );
$this -> product['language']['seo_link'] ? $url = '/' . $this -> product['language']['seo_link'] : $url = '/p-' . $this -> product['id'] . '-' . \Shared\Helpers\Helpers::seo( $this -> product['language']['name'] );
if ( \Shared\Helpers\Helpers::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() and $url != '#' )
$url = '/' . \Shared\Helpers\Helpers::get_session( 'current-lang' ) . $url;
?>
<div class="product-mini <?= $this -> product_mini_class;?>">
<? 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;?>
<a href="<?= $url;?>">
<div class="img">
<? if ( file_exists( substr( $this -> product -> images[0]['src'], 1 ) ) ):?>
<? if ( file_exists( substr( $this -> product['images'][0]['src'], 1 ) ) ):?>
<? if ( $this -> class == 'item' ):?>
<img class="<?= $this -> product_mini_class == 'swiper-slide' ? '' : 'owl-lazy';?>" src="/thumb/500/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<img class="<?= $this -> product_mini_class == 'swiper-slide' ? '' : 'owl-lazy';?>" src="/thumb/500/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? else:?>
<img class="first" src="/thumb/500/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<? if ( file_exists( substr( $this -> product -> images[1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/1000/0/<?= substr( $this -> product -> images[1]['src'], 1, strlen( $this -> product -> images[1]['src'] ) );?>" alt="<?= $this -> product -> images[1]['alt'];?>">
<img class="first" src="/thumb/500/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? if ( file_exists( substr( $this -> product['images'][1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/1000/0/<?= substr( $this -> product['images'][1]['src'], 1, strlen( $this -> product['images'][1]['src'] ) );?>" alt="<?= $this -> product['images'][1]['alt'];?>">
<? else:?>
<img class="second" src="/thumb/1000/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<img class="second" src="/thumb/1000/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? endif;?>
<? endif;?>
<? else:?>
@@ -28,38 +28,38 @@
</div>
<div class="product-details">
<h2 class="name">
<?= $this -> product -> language['name'];?>
<?= $this -> product['language']['name'];?>
</h2>
<div class="prices">
<?
$prices = $this -> product -> getDefaultCombinationPrices();
$prices = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getDefaultCombinationPrices( $this -> product );
if ( $prices )
{
if ( $prices['price_brutto_promo'] ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<? endif;
}
else
{
if ( $this -> product -> price_brutto_promo ):?>
if ( $this -> product['price_brutto_promo'] ):?>
<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">
<?= \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>
<? 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>
<? endif;
};?>

View File

@@ -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
}
]

View File

@@ -4,7 +4,7 @@
<div class="swiper-wrapper">
<?
foreach ( $this -> products as $product ):
if ( $product -> status ):
if ( $product['status'] ):
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
'product' => $product,
'class' => 'item',

View File

@@ -6,7 +6,7 @@
<div class="swiper-wrapper">
<?
foreach ( $this -> products as $product ):
if ( $product -> status ):
if ( $product['status'] ):
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
'product' => $product,
'class' => 'item',

View File

@@ -6,7 +6,7 @@
<div class="swiper-wrapper">
<?
foreach ( $this -> products as $product ):
if ( $product -> status ):
if ( $product['status'] ):
echo \Shared\Tpl\Tpl::view( 'shop-product/product-mini', [
'product' => $product,
'class' => 'item',

View File

@@ -3,9 +3,9 @@
<div class="content">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):?>
<?
$product = \shop\Product::getFromCache( $product_id, $lang_id );
$product = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->findCached( $product_id, $lang_id );
$product -> languages[$lang_id]['seo_link'] ? $url = '/' . $product -> languages[$lang_id]['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product -> languages[$lang_id]['name'] );
$product['languages'][$lang_id]['seo_link'] ? $url = '/' . $product['languages'][$lang_id]['seo_link'] : $url = '/p-' . $product['id'] . '-' . \Shared\Helpers\Helpers::seo( $product['languages'][$lang_id]['name'] );
if ( \Shared\Helpers\Helpers::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() and $url != '#' )
$url = '/' . \Shared\Helpers\Helpers::get_session( 'current-lang' ) . $url;

View File

@@ -1,25 +1,25 @@
<? global $lang_id;?>
<?
$this -> product -> language['seo_link'] ? $url = '/' . $this -> product -> language['seo_link'] : $url = '/p-' . $this -> product['id'] . '-' . \Shared\Helpers\Helpers::seo( $this -> product -> language['name'] );
$this -> product['language']['seo_link'] ? $url = '/' . $this -> product['language']['seo_link'] : $url = '/p-' . $this -> product['id'] . '-' . \Shared\Helpers\Helpers::seo( $this -> product['language']['name'] );
if ( \Shared\Helpers\Helpers::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() and $url != '#' )
$url = '/' . \Shared\Helpers\Helpers::get_session( 'current-lang' ) . $url;
?>
<div class="product-search">
<? 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;?>
<a href="<?= $url;?>" class="a-img">
<div class="img">
<? if ( file_exists( substr( $this -> product -> images[0]['src'], 1 ) ) ):?>
<? if ( file_exists( substr( $this -> product['images'][0]['src'], 1 ) ) ):?>
<? if ( $this -> class == 'item' ):?>
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? else:?>
<img class="first" src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<? if ( file_exists( substr( $this -> product -> images[1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/490/0/<?= substr( $this -> product -> images[1]['src'], 1, strlen( $this -> product -> images[1]['src'] ) );?>" alt="<?= $this -> product -> images[1]['alt'];?>">
<img class="first" src="/thumb/490/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? if ( file_exists( substr( $this -> product['images'][1]['src'], 1 ) ) ):?>
<img class="second" src="/thumb/490/0/<?= substr( $this -> product['images'][1]['src'], 1, strlen( $this -> product['images'][1]['src'] ) );?>" alt="<?= $this -> product['images'][1]['alt'];?>">
<? else:?>
<img class="second" src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
<img class="second" src="/thumb/490/0/<?= substr( $this -> product['images'][0]['src'], 1, strlen( $this -> product['images'][0]['src'] ) );?>" alt="<?= $this -> product['images'][0]['alt'];?>">
<? endif;?>
<? endif;?>
<? else:?>
@@ -30,39 +30,39 @@
<div class="product-details">
<h2 class="name">
<a href="<?= $url;?>" class="a-name">
<?= $this -> product -> language['name'];?>
<?= $this -> product['language']['name'];?>
</a>
</h2>
<div class="prices">
<?
$prices = $this -> product -> getDefaultCombinationPrices();
$prices = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->getDefaultCombinationPrices( $this -> product );
if ( $prices )
{
if ( $prices['price_brutto_promo'] ):?>
<div class="price-old">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
</div>
<? else:?>
<div class="price">
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
<?= \Shared\Helpers\Helpers::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
</div>
<? endif;
}
else
{
if ( $this -> product -> price_brutto_promo ):?>
if ( $this -> product['price_brutto_promo'] ):?>
<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">
<?= \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>
<? 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>
<? endif;
};?>

View File

@@ -7,7 +7,7 @@
<div class="search-content">
<? 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;?>
</div>