Add view classes for articles, banners, languages, menu, newsletter, containers, shop categories, clients, payment methods, products, and search

- Created `Articles` class for rendering article views including full articles, miniature lists, and news sections.
- Added `Banners` class for handling banner displays.
- Introduced `Languages` class for rendering language options.
- Implemented `Menu` class for rendering page and menu structures.
- Developed `Newsletter` class for newsletter rendering.
- Created `Scontainers` class for rendering specific containers.
- Added `ShopCategory` class for managing shop category views and pagination.
- Implemented `ShopClient` class for client-related views including address management and login forms.
- Created `ShopPaymentMethod` class for displaying payment methods in the basket.
- Added `ShopProduct` class for generating product URLs.
- Introduced `ShopSearch` class for rendering a simple search form.
- Added `.htaccess` file in the plugins directory to enhance security by restricting access to sensitive files and directories.
This commit is contained in:
2026-02-21 23:00:54 +01:00
parent a605e0f4ad
commit fc45bbf20e
322 changed files with 35722 additions and 21849 deletions

View File

@@ -1,13 +1,20 @@
<? if ( $this -> custom_fields ): foreach ( $this -> custom_fields as $key => $val ):?>
<div class="custom-field">
<div class="_name">
<?
$custom_field = \shop\ProductCustomField::getFromCache( $key );
echo $custom_field['name'] . ':';
?>
</div>
<div class="_text">
<?= $val;?>
</div>
</div>
<? endforeach; endif;?>
<? if ( $this -> custom_fields ) : ?>
<? foreach ( $this -> custom_fields as $key => $val ) : ?>
<? $custom_field = ( new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ) )->findCustomFieldCached( $key ); ?>
<? if ( $custom_field['type'] == 'text' ) : ?>
<div class="custom-field">
<div class="_name">
<?
echo $custom_field['name'] . ':';
?>
</div>
<div class="_text">
<?= $val;?>
</div>
</div>
<? elseif ( $custom_field['type'] == 'image' ) : ?>
<? endif; ?>
<? endforeach; ?>
<? endif;?>

View File

@@ -1,6 +1,6 @@
<div class="basket-address-form">
<? if ( !$this -> client ):?>
<div class="box-title"><?= \S::lang( 'zloz-zamowienie-bez-rejestraji' );?></div>
<div class="box-title"><?= \Shared\Helpers\Helpers::lang( 'zloz-zamowienie-bez-rejestraji' );?></div>
<? else:?>
<?
if ( is_array( $this -> addresses ) ) for ( $i = 0; $i < count( $this -> addresses ); $i++ )
@@ -24,7 +24,7 @@
<br/><span field="postal_code"><?= $address['postal_code'] . '</span> <span field="city">' . $address['city'] . '</span>';?>
<br/><span field="phone"><?= $address['phone'];?></span>
<div class="buttons">
<a href="#" class="btn-select" address="<?= $address['id'];?>"><?= \S::lang( 'wybierz' );?></a>
<a href="#" class="btn-select" address="<?= $address['id'];?>"><?= \Shared\Helpers\Helpers::lang( 'wybierz' );?></a>
</div>
</div>
<? endforeach;?>
@@ -37,30 +37,30 @@
<? if ( !$this -> client ):?>
<div class="form-group row">
<div class="col-12">
<input type="email" name="email" class="form-control" required placeholder="<?= ucfirst( \S::lang( 'email' ) );?>">
<input type="email" name="email" class="form-control" required placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'email' ) );?>">
</div>
</div>
<? endif;?>
<div class="form-group row">
<div class="col-12">
<input type="text" id="name" name="name" class="form-control" required placeholder="<?= ucfirst( \S::lang( 'imie' ) );?>" value="<?= htmlspecialchars( $address_current['name'] );?>">
<input type="text" id="name" name="name" class="form-control" required placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'imie' ) );?>" value="<?= htmlspecialchars( $address_current['name'] );?>">
</div>
</div>
<div class="form-group row">
<div class="col-12">
<input type="text" id="surname" name="surname" class="form-control" required placeholder="<?= ucfirst( \S::lang( 'nazwisko' ) );?>" value="<?= htmlspecialchars( $address_current['surname'] );?>">
<input type="text" id="surname" name="surname" class="form-control" required placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'nazwisko' ) );?>" value="<?= htmlspecialchars( $address_current['surname'] );?>">
</div>
</div>
<div class="form-group">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
<input type="text" id="street" name="street" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \Shared\Helpers\Helpers::lang( 'opcjonalnie' );?>)<? endif;?>" value="<?= htmlspecialchars( $address_current['street'] );?>">
</div>
<div class="form-group">
<div class="row">
<div class="col-12 col-md-6">
<input type="text" id="postal_code" name="postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['postal_code'] );?>">
<input type="text" id="postal_code" name="postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'kod-pocztowy' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \Shared\Helpers\Helpers::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['postal_code'] );?>">
</div>
<div class="col-12 col-md-6">
<input type="text" id="city" name="city" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['city'] );?>">
<input type="text" id="city" name="city" class="form-control" <? if ( !in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'miasto' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3, 9] ) ):?> (<?= \Shared\Helpers\Helpers::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['city'] );?>">
</div>
</div>
</div>
@@ -70,14 +70,14 @@
<img src="/images/system/lang_pl.png" alt="">
<span>+48</span>
</div>
<input type="tel" id="phone" name="phone" class="form-control form-control-input" required placeholder="<?= ucfirst(\S::lang('telefon')); ?>" value="<?= htmlspecialchars($address_current['phone']); ?>" pattern="[0-9]{9}">
<input type="tel" id="phone" name="phone" class="form-control form-control-input" required placeholder="<?= ucfirst(\Shared\Helpers\Helpers::lang('telefon')); ?>" value="<?= htmlspecialchars($address_current['phone']); ?>" pattern="[0-9]{9}">
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12" id="fvat">
<input type="checkbox" name="fvat">
<?= \S::lang( 'faktura-vat' );?>
<?= \Shared\Helpers\Helpers::lang( 'faktura-vat' );?>
</div>
</div>
</div>
@@ -85,31 +85,31 @@
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_name" name="firm_name" class="form-control" placeholder="<?= ucfirst( \S::lang( 'nazwa-firmy' ) );?>" value="">
<input type="text" id="firm_name" name="firm_name" class="form-control" placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'nazwa-firmy' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_street" name="firm_street" class="form-control" placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?>" value="">
<input type="text" id="firm_street" name="firm_street" class="form-control" placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'ulica-i-nr-domu' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12 col-md-6">
<input type="text" id="firm_postal_code" name="firm_postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?>" value="">
<input type="text" id="firm_postal_code" name="firm_postal_code" pattern="[0-9]{2}-[0-9]{3}" title="Format xx-xxx" class="form-control" placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'kod-pocztowy' ) );?>" value="">
</div>
<div class="col-12 col-md-6">
<input type="text" id="firm_city" name="firm_city" class="form-control" placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?>" value="">
<input type="text" id="firm_city" name="firm_city" class="form-control" placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'miasto' ) );?>" value="">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12">
<input type="text" id="firm_nip" name="firm_nip" class="form-control" placeholder="<?= ucfirst( \S::lang( 'nip' ) );?>" value="">
<input type="text" id="firm_nip" name="firm_nip" class="form-control" placeholder="<?= ucfirst( \Shared\Helpers\Helpers::lang( 'nip' ) );?>" value="">
</div>
</div>
</div>
@@ -119,14 +119,14 @@
<div class="row">
<div class="col-12" id="agreement">
<input type="checkbox" name="agreement" required="">
<?= \S::lang( 'przeczytalem-i-akceptuje-polityke-prywatnosci-i-regulamin' );?>
<?= \Shared\Helpers\Helpers::lang( 'przeczytalem-i-akceptuje-polityke-prywatnosci-i-regulamin' );?>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-12">
<button type="submit" class="btn btn-success" id="order-send"><span class="text"><?= ucfirst( \S::lang( 'zamawiam-z-obowiazkiem-zaplaty' ) );?></span></button>
<button type="submit" class="btn btn-success" id="order-send"><span class="text"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'zamawiam-z-obowiazkiem-zaplaty' ) );?></span></button>
</div>
</div>
</div>

View File

@@ -1,31 +1,32 @@
<? global $lang_id;?>
<? if ( \S::is_array_fix( $this -> products ) ):?>
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> products ) ):?>
<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'] . '-' . \S::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 ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
$url = '/' . \S::get_session( 'current-lang' ) . $url;
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' ) ):?>
<div class="new"><?= \S::lang( 'nowosc' );?></div>
<? 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

@@ -1,12 +1,28 @@
<div class="mini-box">
<h1 class="box-title"><?= ucfirst( \S::lang( 'zawartosc-koszyka' ) ); ?>:</h1>
<h1 class="box-title"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'zawartosc-koszyka' ) ); ?>:</h1>
<div id="basket" class="content">
<? if ( is_array( $this -> basket ) and count($this->basket)) : ?>
<? foreach ($this->basket as $position_hash => $position) : ?>
<?
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 = (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 = (new \Domain\Product\ProductRepository($GLOBALS['mdb']))->getProductPermutationQuantityOptions(
(int)( $position['parent_id'] ? $position['parent_id'] : $position['product-id'] ),
$permutation
);
$max_quantity = (int)$quantity_options['quantity'];
if ( !$max_quantity and (int)$quantity_options['stock_0_buy'] )
$max_quantity = 999;
?>
<div class="basket-product">
<div class="image">
@@ -18,10 +34,10 @@
</div>
<div class="details">
<?php
$url = \front\factory\ShopProduct::product_url( $product );
$url = \front\Views\ShopProduct::productUrl( $product );
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#')
$url = '/' . \S::get_session('current-lang') . $url;
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="name">
<a href="<?= $url; ?>"><?= $product['language']['name']; ?></a>
@@ -33,9 +49,10 @@
if ($row)
{
$row = explode('-', $row);
$attribute = \front\factory\ShopAttribute::attribute_details($row[0], $this->lang_id);
$attributeRepo = new \Domain\Attribute\AttributeRepository($GLOBALS['mdb']);
$attribute = $attributeRepo->frontAttributeDetails((int)$row[0], $this->lang_id);
echo '<div>' . $attribute['language']['name'] . ':</div>';
$value = \front\factory\ShopAttribute::value_details($row[1], $this->lang_id);
$value = $attributeRepo->frontValueDetails((int)$row[1], $this->lang_id);
echo '<div>' . $value['language']['name'] . '</div>';
}
?>
@@ -43,10 +60,10 @@
<? endforeach; ?>
<hr>
<? endif; ?>
<?= \Tpl::view( 'shop-basket/_partials/product-custom-fields', [
<?= \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>
@@ -55,16 +72,16 @@
<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 \S::decimal( $price_product['price_new'] ) . ' zł';
echo \Shared\Helpers\Helpers::decimal( $price_product['price_new'] ) . ' zł';
if ($price_product['price_new'] and $price_product['price_new'] < $price_product['price'])
echo '<u>' . \S::decimal( $price_product['price'] ) . ' zł</u>';
echo '<u>' . \Shared\Helpers\Helpers::decimal( $price_product['price'] ) . ' zł</u>';
if ($price_product['price_new'] and $price_product['price_new'] < $price_product['price'])
$discount += \S::normalize_decimal(($price_product['price'] - $price_product['price_new']) * $position['quantity']);
$discount += \Shared\Helpers\Helpers::normalize_decimal(($price_product['price'] - $price_product['price_new']) * $position['quantity']);
?>
</div>
</div>
@@ -72,7 +89,7 @@
<a href="#" class="btn btn-default btn-minus" product-hash="<?= $position_hash; ?>">
<i class="fa fa-minus"></i>
</a>
<input type="text" name="quantity" id="quantity" class="int-format form-control" min="1" max="<?= \shop\Product::get_product_quantity( (int)$position['product-id'] ); ?>" value="<?= $position['quantity']; ?>" product-hash="<?= $position_hash; ?>">
<input type="text" name="quantity" id="quantity" class="int-format form-control" min="1" max="<?= $max_quantity; ?>" value="<?= $position['quantity']; ?>" product-hash="<?= $position_hash; ?>">
<a href="#" class="btn btn-default btn-plus" product-hash="<?= $position_hash; ?>">
<i class="fa fa-plus"></i>
</a>
@@ -84,16 +101,16 @@
<? $summary += $price_product['price'] * $position['quantity'];?>
<? endforeach; ?>
<div class="basket-summary">
Wartość koszyka: <span class="price"><?= \S::decimal($summary); ?> zł</span>
Wartość koszyka: <span class="price"><?= \Shared\Helpers\Helpers::decimal($summary); ?> zł</span>
</div>
<? if ($discount) : ?>
<div class="basket-summary">
Rabat:
<span class="text-danger">-<?= \S::decimal($discount); ?> zł</span>
<span class="text-danger">-<?= \Shared\Helpers\Helpers::decimal($discount); ?> zł</span>
</div>
<div class="basket-summary">
Wartość koszyka po rabacie:
<span class="text-danger"><?= \S::decimal($summary - $discount); ?> zł</span>
<span class="text-danger"><?= \Shared\Helpers\Helpers::decimal($summary - $discount); ?> zł</span>
</div>
<? endif; ?>
<div class="basket-bottom">
@@ -101,8 +118,8 @@
<textarea name="basket-message" class="form-control" id="basket-message" placeholder="Dodatkowe informacje..."><?= htmlspecialchars($this->basket_message); ?></textarea>
</div>
<div class="coupon">
<?= \Tpl::view( 'shop-coupon/form', [
'coupon' => \S::get_session('coupon')
<?= \Shared\Tpl\Tpl::view( 'shop-coupon/form', [
'coupon' => \Shared\Helpers\Helpers::get_session('coupon')
] );
?>
</div>
@@ -111,4 +128,4 @@
<div class="alert alert-danger">Brak produktów w koszyku</div>
<? endif; ?>
</div>
</div>
</div>

View File

@@ -7,7 +7,7 @@
<div class="basket-details">
<div class="title">Twój koszyk</div>
<div class="details">
<b><?= ucfirst( $lang['ilosc'] );?></b>: <span id="products-count"><?= $count = \front\factory\ShopBasket::count_products( $this -> basket );?>
<b><?= ucfirst( $lang['ilosc'] );?></b>: <span id="products-count"><?= $count = \Domain\Basket\BasketCalculator::countProducts( $this -> basket );?>
<?
switch ( true )
{
@@ -17,7 +17,7 @@
case ( $count >= 5 ): echo 'produktów'; break;
}
?></span><br />
<b><?= ucfirst( $lang['suma'] );?></b>: <span id="basket-value"><?= \S::decimal( \front\factory\ShopBasket::summary_price( $this -> basket, $this -> coupon ) );?></span> zł
<b><?= ucfirst( $lang['suma'] );?></b>: <span id="basket-value"><?= \Shared\Helpers\Helpers::decimal( \Domain\Basket\BasketCalculator::summaryPrice( $this -> basket, $this -> coupon ) );?></span> zł
</div>
</div>
</a>

View File

@@ -2,15 +2,15 @@
$pm_found = false;
if ( is_array( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):
if ( $payment_method['id'] == \S::get_session( 'basket-payment-method-id' ) )
if ( $payment_method['id'] == \Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' ) )
$pm_found = true;
endforeach; endif;
$basket = \S::get_session( 'basket' );
$coupon = \S::get_session( 'coupon' );
$transport_cost = \front\factory\ShopTransport::transport_cost( \S::get_session( 'basket-transport-method-id' ) );
$basket = \Shared\Helpers\Helpers::get_session( 'basket' );
$coupon = \Shared\Helpers\Helpers::get_session( 'coupon' );
$transport_cost = ( new \Domain\Transport\TransportRepository( $GLOBALS['mdb'] ) )->transportCostCached( (int)\Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' ) ) ?? 0.0;
$basket_summary = \front\factory\ShopBasket::summary_price( $basket, $coupon ) + $transport_cost;
$basket_summary = \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ) + $transport_cost;
?>
<? if ( is_array( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
<? if ( $payment_method['id'] != 6 or $payment_method['id'] == 6 and $basket_summary >= 40 and $basket_summary <= 1000 ):?>
@@ -19,16 +19,16 @@
<input type="radio" class="icheck" name="payment_method" value="<?= $payment_method['id'];?>"
<?
if (
$payment_method['id'] == \S::get_session( 'basket-payment-method-id' )
$payment_method['id'] == \Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' )
or
count( $this -> payment_methods ) === 1
or
!\S::get_session( 'basket-payment-method-id' ) and $payment_method == end( $this -> payment_methods )
!\Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' ) and $payment_method == end( $this -> payment_methods )
or
\S::get_session( 'basket-payment-method-id' ) and !$pm_found and $payment_method == end( $this -> payment_methods )
\Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' ) and !$pm_found and $payment_method == end( $this -> payment_methods )
):
\S::set_session( 'basket-payment-method-id', $payment_method['id'] );
\Shared\Helpers\Helpers::set_session( 'basket-payment-method-id', $payment_method['id'] );
echo 'checked="checked"';
endif;
@@ -41,4 +41,4 @@
</div>
</div>
<? endif;?>
<? endforeach; endif;?>
<? endforeach; endif;?>

View File

@@ -16,7 +16,7 @@ if ( is_array( $this -> transports_methods ) )
if ( !$transport_found )
{
$this -> transport_id = $default_transport_id;
\S::set_session( 'basket-transport-method-id', $default_transport_id );
\Shared\Helpers\Helpers::set_session( 'basket-transport-method-id', $default_transport_id );
}
}
?>
@@ -30,33 +30,33 @@ if ( is_array( $this -> transports_methods ) )
<div class="small"><?= $transport_method['description'];?></div>
</div>
<div class="price">
<?= \S::decimal( $transport_method['cost'], 2 );?> zł
<?= \Shared\Helpers\Helpers::decimal( $transport_method['cost'], 2 );?> zł
</div>
</div>
<? if ( $transport_method['id'] == 1 or $transport_method['id'] == 2 ):?>
<div class="inpost-info inpost-info-<?= $transport_method['id'];?>">
<? if ( $transport_method['id'] == $this -> transport_id ):?><?= \S::get_session( 'basket-inpost-info' );?>
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'wybierz' );?></a>
<? if ( $transport_method['id'] == $this -> transport_id ):?><?= \Shared\Helpers\Helpers::get_session( 'basket-inpost-info' );?>
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \Shared\Helpers\Helpers::lang( 'wybierz' );?></a>
<? endif;?>
</div>
<? endif;?>
<? if ( $transport_method['id'] == 9 ):?>
<div class="orlen-info orlen-info-<?= $transport_method['id'];?>">
<input type="hidden" name="orlen_point_id" id="orlen_point_id" value="<?= \S::get_session( 'basket_orlen_point_id' );?>">
<input type="hidden" name="orlen_point_id" id="orlen_point_id" value="<?= \Shared\Helpers\Helpers::get_session( 'basket_orlen_point_id' );?>">
<?
if ( \S::get_session( 'basket-transport-method-id' ) != 9 )
if ( \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' ) != 9 )
$class = 'hidden';
?>
<span id="orlen_point_info" class="<?= $class;?>"><?= \S::get_session( 'basket_orlen_point_info' );?></span>
<a href="#" class="orlen-widget <?= $class;?>" data-target="#orlen_point_id" data-label="#orlen_point_info" data-type="all" data-layout="tabs" onclick="return false;"><?= \S::lang( 'wybierz' );?></a>
<span id="orlen_point_info" class="<?= $class;?>"><?= \Shared\Helpers\Helpers::get_session( 'basket_orlen_point_info' );?></span>
<a href="#" class="orlen-widget <?= $class;?>" data-target="#orlen_point_id" data-label="#orlen_point_info" data-type="all" data-layout="tabs" onclick="return false;"><?= \Shared\Helpers\Helpers::lang( 'wybierz' );?></a>
</div>
<? endif;?>
<? endforeach; endif;?>
<script class="footer" type="text/javascript">
$( function() {
<? if ( \S::get_session( 'basket-transport-method-id' ) ):?>
transport_checked( <?= \S::get_session( 'basket-transport-method-id' );?>, <?= \S::get_session( 'basket-payment-method-id' ) != '' ? \S::get_session( 'basket-payment-method-id' ) : 0;?>, false );
<? if ( \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' ) ):?>
transport_checked( <?= \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' );?>, <?= \Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' ) != '' ? \Shared\Helpers\Helpers::get_session( 'basket-payment-method-id' ) : 0;?>, false );
<? endif;?>
$( '#transport-methods .icheck' ).iCheck({

View File

@@ -11,24 +11,24 @@
<div class="basket-options">
<div class="content">
<div class="left">
<div class="box-title"><?= ucfirst(\S::lang('dostawa')); ?>:</div>
<div class="box-title"><?= ucfirst(\Shared\Helpers\Helpers::lang('dostawa')); ?>:</div>
<div id="transport-methods">
<?= $this->transport_methods; ?>
</div>
<div class="inpost-map-container">
<a href="#" onclick="inpost_check(); return false;" class="inpost-hide"><?= \S::lang('zamknij'); ?></a>
<a href="#" onclick="inpost_check(); return false;" class="inpost-hide"><?= \Shared\Helpers\Helpers::lang('zamknij'); ?></a>
<div id="inpost-map"></div>
</div>
</div>
<div class="right">
<div class="box-title"><?= ucfirst(\S::lang('platnosc')); ?>:</div>
<div class="box-title"><?= ucfirst(\Shared\Helpers\Helpers::lang('platnosc')); ?>:</div>
<div id="payment-methods"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<a href="/koszyk-podsumowanie" id="btn-basket-summary" class="btn btn-success disabled float-right"><span class="text"><?= ucfirst(\S::lang('przejdz-do-podsumowania')); ?></span></a>
<a href="/koszyk-podsumowanie" id="btn-basket-summary" class="btn btn-success disabled float-right"><span class="text"><?= ucfirst(\Shared\Helpers\Helpers::lang('przejdz-do-podsumowania')); ?></span></a>
</div>
</div>
<? endif; ?>
@@ -242,7 +242,7 @@
$.alert({
title: '<?= ucfirst(\S::lang('uwaga')); ?>',
title: '<?= ucfirst(\Shared\Helpers\Helpers::lang('uwaga')); ?>',
content: 'Proszę wybrać punkt odbioru',
type: 'blue',
closeIcon: true,
@@ -254,7 +254,7 @@
autoClose: 'confirm|5000',
buttons: {
confirm: {
text: '<?= \S::lang('zamknij'); ?>',
text: '<?= \Shared\Helpers\Helpers::lang('zamknij'); ?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function() {}
@@ -403,8 +403,8 @@
var product_hash = $(this).attr('product-hash');
$.alert({
title: '<?= ucfirst(\S::lang('potwierdz')); ?>',
content: '<?= \S::lang('potwierdz-usuniecie-produktu-z-koszyka'); ?>',
title: '<?= ucfirst(\Shared\Helpers\Helpers::lang('potwierdz')); ?>',
content: '<?= \Shared\Helpers\Helpers::lang('potwierdz-usuniecie-produktu-z-koszyka'); ?>',
closeIcon: true,
closeIconClass: 'fas fa-close',
typeAnimated: true,
@@ -414,7 +414,7 @@
autoClose: 'cancel|10000',
buttons: {
confirm: {
text: '<?= \S::lang('usun'); ?>',
text: '<?= \Shared\Helpers\Helpers::lang('usun'); ?>',
btnClass: 'btn-orange',
keys: ['enter'],
action: function() {
@@ -451,7 +451,7 @@
}
},
cancel: {
text: '<?= \S::lang('zamknij'); ?>',
text: '<?= \Shared\Helpers\Helpers::lang('zamknij'); ?>',
btnClass: 'btn-blue',
action: function() {}
}

View File

@@ -1,10 +1,10 @@
<? global $client, $lang_id;?>
<div class="basket-summary-container box">
<h1 class="box-title"><?= ucfirst( \S::lang( 'podsumowanie-zamowienia' ) );?>:</h1>
<h1 class="box-title"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'podsumowanie-zamowienia' ) );?>:</h1>
<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 ) ) ):?>
@@ -15,10 +15,10 @@
</div>
<div class="details">
<?
$product[ 'language' ][ 'seo_link' ] ? $url = '/' . $product[ 'language' ][ 'seo_link' ] : $url = '/p-' . $product[ 'id' ] . '-' . \S::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 ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
$url = '/' . \S::get_session( 'current-lang' ) . $url;
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="name">
<a href="<?= $url;?>"><?= $product[ 'language' ][ 'name' ];?></a>
@@ -30,9 +30,10 @@
if ($row)
{
$row = explode('-', $row);
$attribute = \front\factory\ShopAttribute::attribute_details($row[0], $this->lang_id);
$attributeRepo = new \Domain\Attribute\AttributeRepository($GLOBALS['mdb']);
$attribute = $attributeRepo->frontAttributeDetails((int)$row[0], $this->lang_id);
echo '<div>' . $attribute['language']['name'] . ':</div>';
$value = \front\factory\ShopAttribute::value_details($row[1], $this->lang_id);
$value = $attributeRepo->frontValueDetails((int)$row[1], $this->lang_id);
echo '<div>' . $value['language']['name'] . '</div>';
}
?>
@@ -40,7 +41,7 @@
<? endforeach; ?>
<hr>
<? endif;?>
<?= \Tpl::view( 'shop-basket/_partials/product-custom-fields', [
<?= \Shared\Tpl\Tpl::view( 'shop-basket/_partials/product-custom-fields', [
'custom_fields' => $position['custom_fields']
] ); ?>
<div class="product-message">
@@ -50,23 +51,23 @@
<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 \S::decimal($price_product['price_new']) . ' zł';
echo \Shared\Helpers\Helpers::decimal($price_product['price_new']) . ' zł';
if ($price_product['price_new'] and $price_product['price_new'] < $price_product['price'])
echo '<u>' . \S::decimal($price_product['price']) . ' zł</u>';
echo '<u>' . \Shared\Helpers\Helpers::decimal($price_product['price']) . ' zł</u>';
if ($price_product['price_new'] and $price_product['price_new'] < $price_product['price'])
$discount += \S::normalize_decimal(($price_product['price'] - $price_product['price_new']) * $position['quantity']);
$discount += \Shared\Helpers\Helpers::normalize_decimal(($price_product['price'] - $price_product['price_new']) * $position['quantity']);
?>
<span>x <?= $position[ 'quantity' ];?> <?= \S::lang( 'szt' );?>.</span>
<?= \S::decimal( \S::normalize_decimal( $price_product['price_new'] * $position[ 'quantity' ] ) );?> zł
<span>x <?= $position[ 'quantity' ];?> <?= \Shared\Helpers\Helpers::lang( 'szt' );?>.</span>
<?= \Shared\Helpers\Helpers::decimal( \Shared\Helpers\Helpers::normalize_decimal( $price_product['price_new'] * $position[ 'quantity' ] ) );?> zł
</div>
</div>
</div>
<? $summary += \S::normalize_decimal( $price_product['price'] * $position[ 'quantity' ] );?>
<? $summary += \Shared\Helpers\Helpers::normalize_decimal( $price_product['price'] * $position[ 'quantity' ] );?>
<?
if ( $begin_checkout_items )
$begin_checkout_items .= ',';
@@ -74,7 +75,7 @@
$begin_checkout_items .= '{';
$begin_checkout_items .= '"id": "' . $product['id'] . '",';
$begin_checkout_items .= '"name": "' . $product['language']['name'] . '",';
$begin_checkout_items .= '"price": ' . \S::normalize_decimal( $price_product['price_new'] ) . ',';
$begin_checkout_items .= '"price": ' . \Shared\Helpers\Helpers::normalize_decimal( $price_product['price_new'] ) . ',';
$begin_checkout_items .= '"quantity": ' . $position['quantity'];
$begin_checkout_items .= '}';
?>
@@ -83,13 +84,13 @@
<div class="basket-summary">
Wartość koszyka: 1
<span>
<?= \S::decimal( $summary );?> zł
<?= \Shared\Helpers\Helpers::decimal( $summary );?> zł
</span>
</div>
<? if ( $discount ):?>
<div class="basket-summary">
Rabat:
<span class="text-danger">-<?= \S::decimal( $discount ); ?> zł</span>
<span class="text-danger">-<?= \Shared\Helpers\Helpers::decimal( $discount ); ?> zł</span>
</div>
<? endif;?>
<div class="basket-summary">
@@ -99,7 +100,7 @@
<span>0,00 zł</span>
<? else:?>
<span>
<?= \S::decimal( $this -> transport[ 'cost' ] );?> zł
<?= \Shared\Helpers\Helpers::decimal( $this -> transport[ 'cost' ] );?> zł
</span>
<? endif;?>
</div>
@@ -109,7 +110,7 @@
$summary -= $discount;
?>
<span id="order-summary">
<?= $this -> transport[ 'delivery_free' ] == 1 ? \S::decimal( $summary ) : \S::decimal( $summary + $this -> transport[ 'cost' ] );?> zł
<?= $this -> transport[ 'delivery_free' ] == 1 ? \Shared\Helpers\Helpers::decimal( $summary ) : \Shared\Helpers\Helpers::decimal( $summary + $this -> transport[ 'cost' ] );?> zł
</span>
</div>
<div class="basket-summary">
@@ -132,25 +133,25 @@
<? if ( !$this -> client ):?>
<div class="left">
<?=
\front\view\ShopClient::login_form( [
\front\Views\ShopClient::loginForm( [
'long' => true
] );
?>
</div>
<div class="right">
<?= \Tpl::view( 'shop-basket/address-form', [
<?= \Shared\Tpl\Tpl::view( 'shop-basket/address-form', [
'transport_method' => $this -> transport
] );?>
</div>
<? else:?>
<?= \Tpl::view( 'shop-basket/address-form', [
<?= \Shared\Tpl\Tpl::view( 'shop-basket/address-form', [
'client' => $this -> client,
'addresses' => $this -> addresses,
'transport_method' => $this -> transport
] );?>
<? endif;?>
</div>
<a href="/koszyk" class="btn btn-dark"><?= \S::lang( 'wroc-do-koszyka' );?></span></a>
<a href="/koszyk" class="btn btn-dark"><?= \Shared\Helpers\Helpers::lang( 'wroc-do-koszyka' );?></span></a>
</div>
<? endif;?>
</div>
@@ -172,7 +173,7 @@
event: "begin_checkout",
ecommerce: {
currency: "PLN",
value: <?= \S::normalize_decimal( \front\factory\ShopBasket::summary_price( $this -> basket, $this -> coupon ) );?>,
value: <?= \Shared\Helpers\Helpers::normalize_decimal( \Domain\Basket\BasketCalculator::summaryPrice( $this -> basket, $this -> coupon ) );?>,
items: [
<?= $begin_checkout_items;?>
]