first commit
This commit is contained in:
13
templates/shop-basket/_partials/product-custom-fields.php
Normal file
13
templates/shop-basket/_partials/product-custom-fields.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<? 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;?>
|
||||
128
templates/shop-basket/address-form.php
Normal file
128
templates/shop-basket/address-form.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<div class="basket-address-form">
|
||||
<? if ( !$this -> client ):?>
|
||||
<div class="box-title"><?= \S::lang( 'zloz-zamowienie-bez-rejestraji' );?></div>
|
||||
<? else:?>
|
||||
<?
|
||||
if ( is_array( $this -> addresses ) ) for ( $i = 0; $i < count( $this -> addresses ); $i++ )
|
||||
if ( $this -> addresses[$i]['current'] == 1 )
|
||||
$address_current = $this -> addresses[$i];
|
||||
|
||||
if ( !$address and $this -> addresses[0] )
|
||||
$address_current = $this -> addresses[0];
|
||||
?>
|
||||
<? endif;?>
|
||||
<? if ( $this -> client ):?>
|
||||
<div class="left">
|
||||
<? if ( is_array( $this -> addresses ) and count( $this -> addresses ) ):?>
|
||||
<div class="addresses">
|
||||
<? foreach ( $this -> addresses as $address ):?>
|
||||
<? if ( $address['current'] ) $address_current = $address; ?>
|
||||
<div class="address<? if ( $address['current'] ):?> active<? endif;?>" id="address-<?= $address['id'];?>">
|
||||
<span field="name"><?= $address['name'] . '</span> <span field="surname">' . $address['surname'];?></span>
|
||||
<? if ( $address['firm'] ) echo '<br/><span field="firm">' . $address['firm'] . '</span>';?>
|
||||
<br/><span field="street"><?= $address['street'];?></span>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? if ( $this -> client ):?><div class="right"><? endif;?>
|
||||
<form class="form-horizontal" action="/zloz-zamowienie" method="POST" id="form-order">
|
||||
<? 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' ) );?>">
|
||||
</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'] );?>">
|
||||
</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'] );?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-12">
|
||||
<input type="text" id="firm" name="firm" class="form-control" placeholder="<?= ucfirst( \S::lang( 'firma' ) );?> (<?= \S::lang( 'opcjonalnie' );?>)" value="<?= htmlspecialchars( $address_current['firm'] );?>">
|
||||
</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] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'ulica-i-nr-domu' ) );?> <? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::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] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'kod-pocztowy' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::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] ) ):?> required<? endif;?> placeholder="<?= ucfirst( \S::lang( 'miasto' ) );?><? if ( in_array( $this -> transport_method['id'], [ 1, 2, 3] ) ):?> (<?= \S::lang( 'opcjonalnie' );?>)<? endif;?>" " value="<?= htmlspecialchars( $address_current['city'] );?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="phone" name="phone" class="form-control" required placeholder="<?= ucfirst( \S::lang( 'telefon' ) );?>" value="<?= htmlspecialchars( $address_current['phone'] );?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-12" id="agreement">
|
||||
<input type="checkbox" name="agreement" required="">
|
||||
<?= \S::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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? if ( $this -> client ):?>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</form>
|
||||
<? if ( $this -> client ):?></div><? endif;?>
|
||||
</div>
|
||||
<script class="footer">
|
||||
$( function()
|
||||
{
|
||||
$( 'body' ).on( click_event, '.addresses .address .btn-select', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var address_id = $( this ).attr( 'address' );
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopClient/mark_address_as_current',
|
||||
data:
|
||||
{
|
||||
address_id: address_id
|
||||
}
|
||||
});
|
||||
|
||||
$( '#address-' + address_id + ' span' ).each( function()
|
||||
{
|
||||
var field = $( this ).attr( 'field' );
|
||||
var value = $( this ).html();
|
||||
|
||||
$( '.basket-address-form form #' + field ).val( value );
|
||||
});
|
||||
|
||||
$( '.addresses .address' ).removeClass( 'active' );
|
||||
$( '#address-' + address_id ).addClass( 'active' );
|
||||
});
|
||||
});
|
||||
</script>
|
||||
79
templates/shop-basket/alert-product-sets.php
Normal file
79
templates/shop-basket/alert-product-sets.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<? global $lang_id;?>
|
||||
<? if ( \S::is_array_fix( $this -> products ) ):?>
|
||||
<h2>Dobierz inne produkty do kompletu</h2>
|
||||
<? endif;?>
|
||||
<div class="product-sets">
|
||||
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
|
||||
$product = \shop\Product::getFromCache( $product_id, $lang_id );
|
||||
|
||||
$product -> language['seo_link'] ? $url = '/' . $product -> language['seo_link'] : $url = '/p-' . $product['id'] . '-' . \S::seo( $product -> language['name'] );
|
||||
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
|
||||
$url = '/' . \S::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>
|
||||
<? endif;?>
|
||||
<a href="<?= $url;?>" class="a-img">
|
||||
<div class="img">
|
||||
<? 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'];?>">
|
||||
<? 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'];?>">
|
||||
<? else:?>
|
||||
<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:?>
|
||||
|
||||
<? endif;?>
|
||||
</div>
|
||||
</a>
|
||||
<div class="product-details">
|
||||
<h2 class="name">
|
||||
<a href="<?= $url;?>" class="a-name">
|
||||
<?= $product -> language['name'];?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="prices">
|
||||
<?
|
||||
$prices = $product -> getDefaultCombinationPrices();
|
||||
if ( $prices )
|
||||
{
|
||||
if ( $prices['price_brutto_promo'] ):?>
|
||||
<div class="price-old">
|
||||
<?= \shop\Shop::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>
|
||||
</div>
|
||||
<? else:?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? endif;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $product -> price_brutto_promo ):?>
|
||||
<div class="price-old">
|
||||
<?= \shop\Shop::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>
|
||||
</div>
|
||||
<? else:?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $product -> price_brutto );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? endif;
|
||||
};?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
114
templates/shop-basket/basket-details.php
Normal file
114
templates/shop-basket/basket-details.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<div class="mini-box">
|
||||
<h1 class="box-title"><?= ucfirst( \S::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 );
|
||||
?>
|
||||
<div class="basket-product">
|
||||
<div class="image">
|
||||
<? if ( file_exists( substr( $product['images'][0]['src'], 1 ) ) ) : ?>
|
||||
<img class="main-img" src="<?= $product['images'][0]['src']; ?>" alt="">
|
||||
<? else : ?>
|
||||
|
||||
<? endif; ?>
|
||||
</div>
|
||||
<div class="details">
|
||||
<?php
|
||||
$url = \front\factory\ShopProduct::product_url( $product );
|
||||
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#')
|
||||
$url = '/' . \S::get_session('current-lang') . $url;
|
||||
?>
|
||||
<div class="name">
|
||||
<a href="<?= $url; ?>"><?= $product['language']['name']; ?></a>
|
||||
</div>
|
||||
<? if (is_array($position['attributes']) and count($position['attributes'])) : ?>
|
||||
<? foreach ($position['attributes'] as $row) : ?>
|
||||
<div class="description">
|
||||
<?
|
||||
if ($row)
|
||||
{
|
||||
$row = explode('-', $row);
|
||||
$attribute = \front\factory\ShopAttribute::attribute_details($row[0], $this->lang_id);
|
||||
echo '<div>' . $attribute['language']['name'] . ':</div>';
|
||||
$value = \front\factory\ShopAttribute::value_details($row[1], $this->lang_id);
|
||||
echo '<div>' . $value['language']['name'] . '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<? endforeach; ?>
|
||||
<hr>
|
||||
<? endif; ?>
|
||||
<?= \Tpl::view( 'shop-basket/_partials/product-custom-fields', [
|
||||
'custom_fields' => $position['custom_fields']
|
||||
] ); ?>
|
||||
<? 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>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<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 );
|
||||
|
||||
if ( $price_product['price_new'] )
|
||||
echo \S::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>';
|
||||
|
||||
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']);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<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; ?>">
|
||||
<a href="#" class="btn btn-default btn-plus" product-hash="<?= $position_hash; ?>">
|
||||
<i class="fa fa-plus"></i>
|
||||
</a>
|
||||
<a href="#" class="btn btn-danger btn-delete" product-hash="<?= $position_hash; ?>">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<? $summary += $price_product['price'] * $position['quantity'];?>
|
||||
<? endforeach; ?>
|
||||
<div class="basket-summary">
|
||||
Wartość koszyka: <span class="price"><?= \S::decimal($summary); ?> zł</span>
|
||||
</div>
|
||||
<? if ($discount) : ?>
|
||||
<div class="basket-summary">
|
||||
Rabat:
|
||||
<span class="text-danger">-<?= \S::decimal($discount); ?> zł</span>
|
||||
</div>
|
||||
<div class="basket-summary">
|
||||
Wartość koszyka po rabacie:
|
||||
<span class="text-danger"><?= \S::decimal($summary - $discount); ?> zł</span>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
<div class="basket-bottom">
|
||||
<div class="basket-message">
|
||||
<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')
|
||||
] );
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<? else : ?>
|
||||
<div class="alert alert-danger">Brak produktów w koszyku</div>
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
24
templates/shop-basket/basket-mini.php
Normal file
24
templates/shop-basket/basket-mini.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<? global $lang;?>
|
||||
<div id="basket-mini">
|
||||
<a href="/koszyk" title="Przejdź do koszyka">
|
||||
<div class="icon">
|
||||
<img src="/layout/images/shopping-cart.svg">
|
||||
</div>
|
||||
<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 );?>
|
||||
<?
|
||||
switch ( true )
|
||||
{
|
||||
case ( $count == 0 ): echo 'produktów'; break;
|
||||
case ( $count == 1 ): echo 'produkt'; break;
|
||||
case ( $count == 2 or $count == 3 or $count == 4 ): echo 'produkty'; break;
|
||||
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ł
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
44
templates/shop-basket/basket-payments-methods.php
Normal file
44
templates/shop-basket/basket-payments-methods.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?
|
||||
$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' ) )
|
||||
$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_summary = \front\factory\ShopBasket::summary_price( $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 ):?>
|
||||
<div class="options">
|
||||
<div class="check">
|
||||
<input type="radio" class="icheck" name="payment_method" value="<?= $payment_method['id'];?>"
|
||||
<?
|
||||
if (
|
||||
$payment_method['id'] == \S::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 )
|
||||
or
|
||||
\S::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'] );
|
||||
|
||||
echo 'checked="checked"';
|
||||
endif;
|
||||
?>
|
||||
>
|
||||
</div>
|
||||
<div class="description">
|
||||
<div><?= $payment_method['name'];?> <? if ( $payment_method['id'] == 6 ):?><img src="/layout/images/paypo-logo.svg"><? endif;?></div>
|
||||
<div class="small"><?= $payment_method['description'];?></div>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<? endforeach; endif;?>
|
||||
66
templates/shop-basket/basket-transport-methods.php
Normal file
66
templates/shop-basket/basket-transport-methods.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?
|
||||
if ( is_array( $this -> transports_methods ) )
|
||||
{
|
||||
$transport_found = false;
|
||||
$default_transport_id = false;
|
||||
|
||||
foreach ( $this -> transports_methods as $transport_method )
|
||||
{
|
||||
if ( $transport_method['id'] == $this -> transport_id )
|
||||
$transport_found = true;
|
||||
|
||||
if ( $transport_method['default'] )
|
||||
$default_transport_id = $transport_method['id'];
|
||||
}
|
||||
|
||||
if ( !$transport_found )
|
||||
{
|
||||
$this -> transport_id = $default_transport_id;
|
||||
\S::set_session( 'basket-transport-method-id', $default_transport_id );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<? if ( is_array( $this -> transports_methods ) ): foreach ( $this -> transports_methods as $transport_method ):?>
|
||||
<div class="options">
|
||||
<div class="check">
|
||||
<input type="radio" class="icheck" name="transport_method" value="<?= $transport_method['id'];?>" <? if ( $transport_method['id'] == $this -> transport_id ):?>checked="checked"<? endif;?>>
|
||||
</div>
|
||||
<div class="description">
|
||||
<div><?= $transport_method['name_visible'] != '' ? $transport_method['name_visible'] : $transport_method['name'];?></div>
|
||||
<div class="small"><?= $transport_method['description'];?></div>
|
||||
</div>
|
||||
<div class="price">
|
||||
<?= \S::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' );?>
|
||||
<? if ( \S::get_session( 'basket-inpost-info' ) ):?>
|
||||
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'zmien' );?></a>
|
||||
<? else:?>
|
||||
<a href="#" onclick="inpost_map( <?= $transport_method['id'];?> ); return false;"><?= \S::lang( 'wybierz' );?></a>
|
||||
<? endif;?>
|
||||
<? endif;?>
|
||||
</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 );
|
||||
<? endif;?>
|
||||
|
||||
$( '#transport-methods .icheck' ).iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue'
|
||||
});
|
||||
|
||||
$( '#transport-methods .icheck' ).on( 'ifChecked', function( event )
|
||||
{
|
||||
var transport_method_id = $( this ).val();
|
||||
transport_checked( transport_method_id, 0, true );
|
||||
});
|
||||
});
|
||||
</script>
|
||||
434
templates/shop-basket/basket.php
Normal file
434
templates/shop-basket/basket.php
Normal file
@@ -0,0 +1,434 @@
|
||||
<div id="basket-container">
|
||||
<div id="content">
|
||||
<?= $this -> basket_details;?>
|
||||
</div>
|
||||
<div id="paypo-promo">
|
||||
Chcesz skorzystać z odroczonych płatności <img src="/layout/images/paypo-logo.svg">? Wybierz jedną z form dostawy: <strong>odbiór osobisty, Paczkomaty InPost - przedpłata lub Kurier - przedpłata</strong>.<br/>
|
||||
Wartość zamówienia musi mieścić się w przedziale od 40 zł do 1000 zł.
|
||||
</div>
|
||||
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
|
||||
<div class="basket-options">
|
||||
<div class="content">
|
||||
<div class="left">
|
||||
<div class="box-title"><?= ucfirst( \S::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>
|
||||
<div id="inpost-map"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="box-title"><?= ucfirst( \S::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>
|
||||
</div>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<link class="footer" rel="stylesheet" type="text/css" href="/libraries/grid/plugins/icheck/skins/square/_all.css">
|
||||
<link class="footer" rel="stylesheet" type="text/css" href="https://geowidget.easypack24.net/css/easypack.css">
|
||||
<script class="footer" type="text/javascript" src="/libraries/grid/plugins/icheck/icheck.min.js"></script>
|
||||
<script class="footer" type="text/javascript" src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
|
||||
<script class="footer" type="text/javascript">
|
||||
var inpost_transport_method_id = '';
|
||||
|
||||
function inpost_check() {
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/inpost_check',
|
||||
beforeSend: function() {
|
||||
|
||||
},
|
||||
success: function( response ) {
|
||||
data = jQuery.parseJSON( response );
|
||||
if ( data.result == 'bad' ) {
|
||||
$( '.inpost-info-' + inpost_transport_method_id ).html( '<a href="#" onclick="inpost_map( ' + inpost_transport_method_id + ' ); return false;">wybierz</a>' );
|
||||
}
|
||||
|
||||
$( '.inpost-map-container' ).hide();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function payment_checked( payment_method_id )
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_payment_method_set',
|
||||
data:
|
||||
{
|
||||
payment_method_id: payment_method_id
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
response = jQuery.parseJSON( response );
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#btn-basket-summary' ).removeClass( 'disabled' );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function inpost_map( transport_method_id )
|
||||
{
|
||||
inpost_transport_method_id = transport_method_id;
|
||||
|
||||
window.easyPackAsyncInit = function () {
|
||||
easyPack.init({
|
||||
mapType: 'osm',
|
||||
searchType: 'osm',
|
||||
});
|
||||
|
||||
var map = easyPack.mapWidget( 'inpost-map', function(point)
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/inpost_save',
|
||||
data: {
|
||||
paczkomat: point.name + ' | ' + point.address.line1 + ', ' + point.address.line2
|
||||
},
|
||||
beforeSend: function() {},
|
||||
success: function( response ) {
|
||||
$( '.inpost-info-' + transport_method_id ).html( point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 + '<a href="#" onclick="inpost_map( ' + transport_method_id + ' ); return false;">zmień</a>' );
|
||||
$( '.inpost-map-container' ).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
$( '.inpost-map-container' ).show();
|
||||
}
|
||||
|
||||
function transport_checked( transport_method_id, payment_method_id, event_click )
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_payments_methods',
|
||||
data:
|
||||
{
|
||||
payment_method_id: payment_method_id,
|
||||
transport_method_id: transport_method_id
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#transport-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
response = jQuery.parseJSON( response );
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#transport-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#payment-methods' ).html( response.payment_methods );
|
||||
$( '#payment-methods .icheck' ).iCheck({
|
||||
checkboxClass: 'icheckbox_square-blue',
|
||||
radioClass: 'iradio_square-blue'
|
||||
});
|
||||
|
||||
if ( payment_method_id )
|
||||
$( '#btn-basket-summary' ).removeClass( 'disabled' );
|
||||
|
||||
$( '#payment-methods .icheck' ).on( 'ifChecked', function( event )
|
||||
{
|
||||
var payment_method_id = $( this ).val();
|
||||
payment_checked( payment_method_id );
|
||||
});
|
||||
|
||||
if ( event_click && ( transport_method_id == '1' || transport_method_id == '2' ) )
|
||||
inpost_map( transport_method_id )
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$( function()
|
||||
{
|
||||
$( 'body' ).on( 'change', '#basket .basket-product-message textarea', function()
|
||||
{
|
||||
var _this = $( this);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/product_message_change',
|
||||
data: {
|
||||
product_message: _this.val(),
|
||||
position_code: _this.attr( 'position' )
|
||||
},
|
||||
beforeSend: function() {},
|
||||
success: function() {}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '#btn-basket-summary', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/transport_method_inpost_check',
|
||||
data: {},
|
||||
beforeSend: function() {
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
},
|
||||
success: function( response ) {
|
||||
|
||||
data = jQuery.parseJSON( response );
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
if ( data.result === 'bad' ) {
|
||||
|
||||
$.alert({
|
||||
|
||||
title: '<?= ucfirst( \S::lang( 'uwaga' ) );?>',
|
||||
content: 'Proszę wybrać paczkomat.',
|
||||
type: 'blue',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fas fa-times',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
useBootstrap: false,
|
||||
theme: 'modern',
|
||||
autoClose: 'confirm|5000',
|
||||
icon: 'fas fa-exclamation',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '<?= \S::lang( 'zamknij' );?>',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function () {}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
document.location.href = '/koszyk-podsumowanie';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'change', '#basket-message', function()
|
||||
{
|
||||
var _this = $( this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_message_save',
|
||||
data: {
|
||||
basket_message: _this.val()
|
||||
},
|
||||
beforeSend: function() {
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
},
|
||||
success: function( response ) {
|
||||
data = jQuery.parseJSON( response );
|
||||
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'change', '.basket-product .int-format', function()
|
||||
{
|
||||
var product_hash = $( this ).attr( 'product-hash' );
|
||||
var quantity = $( this ).val();
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_change_quantity_product',
|
||||
data:
|
||||
{
|
||||
product_hash: product_hash,
|
||||
quantity: quantity
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
data = jQuery.parseJSON( response );
|
||||
|
||||
if ( data.products_count === 0 )
|
||||
{
|
||||
document.location.href = '/koszyk';
|
||||
$( '.mini-box' ).hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#basket-container #content' ).html( data.basket );
|
||||
|
||||
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
|
||||
$( '#basket-mini #basket-value').html( data.basket_mini_value );
|
||||
|
||||
$( '#basket-container #transport-methods' ).html( data.transport_methods );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '.basket-product .btn-minus', function() {
|
||||
var product_hash = $( this ).attr( 'product-hash' );
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_decrease_quantity_product',
|
||||
data: {
|
||||
product_hash: product_hash
|
||||
},
|
||||
beforeSend: function() {
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response ) {
|
||||
|
||||
data = jQuery.parseJSON( response );
|
||||
|
||||
if ( data.products_count === 0 ) {
|
||||
document.location.href = '/koszyk';
|
||||
$( '.mini-box' ).hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#basket-container #content' ).html( data.basket );
|
||||
|
||||
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
|
||||
$( '#basket-mini #basket-value').html( data.basket_mini_value );
|
||||
|
||||
$( '#basket-container #transport-methods' ).html( data.transport_methods );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '.basket-product .btn-plus', function()
|
||||
{
|
||||
var product_hash = $( this ).attr( 'product-hash' );
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_increase_quantity_product',
|
||||
data: {
|
||||
product_hash: product_hash
|
||||
},
|
||||
beforeSend: function() {
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response ) {
|
||||
data = jQuery.parseJSON( response );
|
||||
|
||||
if ( data.products_count === 0 )
|
||||
{
|
||||
document.location.href = '/koszyk';
|
||||
$( '.mini-box' ).hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#basket-container #content' ).html( data.basket );
|
||||
|
||||
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
|
||||
$( '#basket-mini #basket-value').html( data.basket_mini_value );
|
||||
|
||||
$( '#basket-container #transport-methods' ).html( data.transport_methods );
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '.basket-product .btn-delete', function()
|
||||
{
|
||||
var product_hash = $( this ).attr( 'product-hash' );
|
||||
|
||||
$.alert({
|
||||
title: '<?= ucfirst( \S::lang( 'potwierdz' ) );?>',
|
||||
content: '<?= \S::lang( 'potwierdz-usuniecie-produktu-z-koszyka' );?>',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fas fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
useBootstrap: false,
|
||||
theme: 'modern',
|
||||
autoClose: 'cancel|10000',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '<?= \S::lang( 'usun' );?>',
|
||||
btnClass: 'btn-orange',
|
||||
keys: ['enter'],
|
||||
action: function() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/shopBasket/basket_remove_product',
|
||||
data: {
|
||||
product_hash: product_hash
|
||||
},
|
||||
beforeSend: function() {
|
||||
$( '#basket-container *' ).addClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
data = jQuery.parseJSON( response );
|
||||
|
||||
if ( data.products_count === 0 )
|
||||
{
|
||||
document.location.href = '/koszyk';
|
||||
$( '.mini-box' ).hide();
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '#basket-container *' ).removeClass( 'disabled' );
|
||||
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
||||
$( '#basket-container #content' ).html( data.basket );
|
||||
|
||||
$( '#basket-mini #products-count' ).html( data.basket_mini_count );
|
||||
$( '#basket-mini #basket-value').html( data.basket_mini_value );
|
||||
|
||||
$( '#basket-container #transport-methods' ).html( data.transport_methods );
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '<?= \S::lang( 'zamknij' );?>',
|
||||
btnClass: 'btn-blue',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
182
templates/shop-basket/summary-view.php
Normal file
182
templates/shop-basket/summary-view.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<? global $client, $lang_id;?>
|
||||
<div class="basket-summary-container box">
|
||||
<h1 class="box-title"><?= ucfirst( \S::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 );?>
|
||||
<div class="basket-product">
|
||||
<div class="image">
|
||||
<? if ( file_exists( substr( $product[ 'images' ][ 0 ][ 'src' ], 1 ) ) ):?>
|
||||
<img class="main-img" src="<?= $product[ 'images' ][ 0 ][ 'src' ];?>" alt="">
|
||||
<? else:?>
|
||||
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="details">
|
||||
<?
|
||||
$product[ 'language' ][ 'seo_link' ] ? $url = '/' . $product[ 'language' ][ 'seo_link' ] : $url = '/p-' . $product[ 'id' ] . '-' . \S::seo( $product[ 'language' ][ 'name' ] );
|
||||
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
|
||||
$url = '/' . \S::get_session( 'current-lang' ) . $url;
|
||||
?>
|
||||
<div class="name">
|
||||
<a href="<?= $url;?>"><?= $product[ 'language' ][ 'name' ];?></a>
|
||||
</div>
|
||||
<? if ( is_array( $position[ 'attributes' ] ) and count( $position[ 'attributes' ] ) ):?>
|
||||
<? foreach ($position['attributes'] as $row) : ?>
|
||||
<div class="description">
|
||||
<?
|
||||
if ($row)
|
||||
{
|
||||
$row = explode('-', $row);
|
||||
$attribute = \front\factory\ShopAttribute::attribute_details($row[0], $this->lang_id);
|
||||
echo '<div>' . $attribute['language']['name'] . ':</div>';
|
||||
$value = \front\factory\ShopAttribute::value_details($row[1], $this->lang_id);
|
||||
echo '<div>' . $value['language']['name'] . '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<? endforeach; ?>
|
||||
<hr>
|
||||
<? endif;?>
|
||||
<?= \Tpl::view( 'shop-basket/_partials/product-custom-fields', [
|
||||
'custom_fields' => $position['custom_fields']
|
||||
] ); ?>
|
||||
<div class="product-message">
|
||||
<?= $position['message'] != '' ? '<strong>Wiadomość:</strong> ' . $position['message'] : '';?>
|
||||
</div>
|
||||
</div>
|
||||
<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);
|
||||
|
||||
if ($price_product['price_new'])
|
||||
echo \S::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>';
|
||||
|
||||
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']);
|
||||
?>
|
||||
<span>x <?= $position[ 'quantity' ];?> <?= \S::lang( 'szt' );?>.</span>
|
||||
<?= \S::decimal( \S::normalize_decimal( $price_product['price_new'] * $position[ 'quantity' ] ) );?> zł
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? $summary += \S::normalize_decimal( $price_product['price'] * $position[ 'quantity' ] );?>
|
||||
<?
|
||||
if ( $begin_checkout_items )
|
||||
$begin_checkout_items .= ',';
|
||||
|
||||
$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 .= '"quantity": ' . $position['quantity'];
|
||||
$begin_checkout_items .= '}';
|
||||
?>
|
||||
<? endforeach;?>
|
||||
<div class="hr"></div>
|
||||
<div class="basket-summary">
|
||||
Wartość koszyka: 1
|
||||
<span>
|
||||
<?= \S::decimal( $summary );?> zł
|
||||
</span>
|
||||
</div>
|
||||
<? if ( $discount ):?>
|
||||
<div class="basket-summary">
|
||||
Rabat:
|
||||
<span class="text-danger">-<?= \S::decimal( $discount ); ?> zł</span>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div class="basket-summary">
|
||||
<?= $this -> transport[ 'name_visible' ];?>:
|
||||
|
||||
<? if ( $this -> transport[ 'delivery_free' ] == 1 ):?>
|
||||
<span>0,00 zł</span>
|
||||
<? else:?>
|
||||
<span>
|
||||
<?= \S::decimal( $this -> transport[ 'cost' ] );?> zł
|
||||
</span>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="basket-summary big">
|
||||
<?
|
||||
if ( $discount )
|
||||
$summary -= $discount;
|
||||
?>
|
||||
<span id="order-summary">
|
||||
<?= $this -> transport[ 'delivery_free' ] == 1 ? \S::decimal( $summary ) : \S::decimal( $summary + $this -> transport[ 'cost' ] );?> zł
|
||||
</span>
|
||||
</div>
|
||||
<div class="basket-summary">
|
||||
<?= $this -> payment_method[ 'name' ];?>
|
||||
</div>
|
||||
<? if ( $this -> basket_message ):?>
|
||||
<div class="basket-summary">
|
||||
Wiadomość:
|
||||
<span><?= $this -> basket_message;?></span>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div class="hr"></div>
|
||||
<? else:?>
|
||||
<div class="alert alert-danger">Brak produktów w koszyku</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<? if ( is_array( $this -> basket ) and count( $this -> basket ) ):?>
|
||||
<div class="basket-options">
|
||||
<div class="content">
|
||||
<? if ( !$this -> client ):?>
|
||||
<div class="left">
|
||||
<?=
|
||||
\front\view\ShopClient::login_form( [
|
||||
'long' => true
|
||||
] );
|
||||
?>
|
||||
</div>
|
||||
<div class="right">
|
||||
<?= \Tpl::view( 'shop-basket/address-form', [
|
||||
'transport_method' => $this -> transport
|
||||
] );?>
|
||||
</div>
|
||||
<? else:?>
|
||||
<?= \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>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<script class="footer" type="text/javascript">
|
||||
document.getElementById('order-send').addEventListener('click', function() {
|
||||
var form = document.getElementById('form-order'); // Zastąp 'form-id' rzeczywistym ID Twojego formularza
|
||||
if (form.checkValidity()) {
|
||||
this.classList.add('loading-button');
|
||||
this.disabled = true;
|
||||
form.submit();
|
||||
} else {
|
||||
// Opcjonalnie: wywołaj funkcję reportValidity(), aby wyświetlić komunikaty o błędach formularza
|
||||
form.reportValidity();
|
||||
}
|
||||
});
|
||||
<? if ( $this -> settings['google_tag_manager_id'] ):?>
|
||||
dataLayer.push({ ecommerce: null });
|
||||
dataLayer.push({
|
||||
event: "begin_checkout",
|
||||
ecommerce: {
|
||||
currency: "PLN",
|
||||
value: <?= \S::normalize_decimal( \front\factory\ShopBasket::summary_price( $this -> basket, $this -> coupon ) );?>,
|
||||
items: [
|
||||
<?= $begin_checkout_items;?>
|
||||
]
|
||||
}
|
||||
});
|
||||
<? endif;?>
|
||||
</script>
|
||||
Reference in New Issue
Block a user