|
|
|
|
@@ -1,37 +1,47 @@
|
|
|
|
|
<div id="basket-container">
|
|
|
|
|
<div id="content">
|
|
|
|
|
<?= $this -> basket_details;?>
|
|
|
|
|
<?= $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/>
|
|
|
|
|
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 ) ):?>
|
|
|
|
|
<? 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 class="box-title"><?= ucfirst(\S::lang('dostawa')); ?>:</div>
|
|
|
|
|
<div id="transport-methods">
|
|
|
|
|
<?= $this -> 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"><?= \S::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(\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>
|
|
|
|
|
<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;?>
|
|
|
|
|
<? endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<script>
|
|
|
|
|
(function(o, r, l, e, n) {
|
|
|
|
|
o[l] = o[l] || [];
|
|
|
|
|
var f = r.getElementsByTagName('head')[0];
|
|
|
|
|
var j = r.createElement('script');
|
|
|
|
|
j.async = true;
|
|
|
|
|
j.src = e + 'widget.js?token=' + n + '&v=1.0.0&t=' + Math.floor(new Date().getTime() / 1000);
|
|
|
|
|
f.insertBefore(j, f.firstChild);
|
|
|
|
|
})(window, document, 'orlenpaczka', 'https://mapa.orlenpaczka.pl/', '0e365de8e228096aaf033ca8e43db5603132d8d5659788dbcb4bd936c852753e51b5382036641163788c1644ea631564f90a445402cd756ed40b491d');
|
|
|
|
|
</script>
|
|
|
|
|
<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>
|
|
|
|
|
@@ -48,59 +58,51 @@
|
|
|
|
|
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>' );
|
|
|
|
|
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();
|
|
|
|
|
$('.inpost-map-container').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function payment_checked( payment_method_id )
|
|
|
|
|
{
|
|
|
|
|
$.ajax(
|
|
|
|
|
{
|
|
|
|
|
function payment_checked(payment_method_id) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/basket_payment_method_set',
|
|
|
|
|
data:
|
|
|
|
|
{
|
|
|
|
|
data: {
|
|
|
|
|
payment_method_id: payment_method_id
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function()
|
|
|
|
|
{
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
|
|
|
|
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' );
|
|
|
|
|
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 )
|
|
|
|
|
{
|
|
|
|
|
function inpost_map(transport_method_id) {
|
|
|
|
|
inpost_transport_method_id = transport_method_id;
|
|
|
|
|
|
|
|
|
|
window.easyPackAsyncInit = function () {
|
|
|
|
|
window.easyPackAsyncInit = function() {
|
|
|
|
|
easyPack.init({
|
|
|
|
|
mapType: 'osm',
|
|
|
|
|
searchType: 'osm',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var map = easyPack.mapWidget( 'inpost-map', function(point)
|
|
|
|
|
{
|
|
|
|
|
$.ajax(
|
|
|
|
|
{
|
|
|
|
|
var map = easyPack.mapWidget('inpost-map', function(point) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/inpost_save',
|
|
|
|
|
@@ -108,64 +110,104 @@
|
|
|
|
|
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();
|
|
|
|
|
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();
|
|
|
|
|
$('.inpost-map-container').show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function transport_checked( transport_method_id, payment_method_id, event_click )
|
|
|
|
|
{
|
|
|
|
|
function transport_checked(transport_method_id, payment_method_id, event_click) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/basket_payments_methods',
|
|
|
|
|
data:
|
|
|
|
|
{
|
|
|
|
|
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' );
|
|
|
|
|
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({
|
|
|
|
|
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' );
|
|
|
|
|
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 );
|
|
|
|
|
$('#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' ) )
|
|
|
|
|
{
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/inpost_save',
|
|
|
|
|
data: {
|
|
|
|
|
paczkomat: null
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {},
|
|
|
|
|
success: function(response) {}
|
|
|
|
|
});
|
|
|
|
|
$( '#orlen_point_id' ).val( '' );
|
|
|
|
|
$( '#orlen_point_info' ).html( '' );
|
|
|
|
|
$( '.orlen-widget' ).hide();
|
|
|
|
|
inpost_map( transport_method_id )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( event_click && transport_method_id == '9' )
|
|
|
|
|
{
|
|
|
|
|
$( '.inpost-info' ).html( '' );
|
|
|
|
|
$( '#orlen_point_info' ).show();
|
|
|
|
|
document.querySelectorAll('.orlen-widget').forEach(function(element) {
|
|
|
|
|
element.style.display = 'inline-block'; // Ustawia widoczność elementu
|
|
|
|
|
element.click(); // Wywołuje kliknięcie na elemencie
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( event_click && transport_method_id != 1 )
|
|
|
|
|
{
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/inpost_save',
|
|
|
|
|
data: {
|
|
|
|
|
paczkomat: null
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {},
|
|
|
|
|
success: function(response) {}
|
|
|
|
|
});
|
|
|
|
|
$( '.inpost-info' ).html( '' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( event_click && transport_method_id != 9 )
|
|
|
|
|
{
|
|
|
|
|
$( '#orlen_point_id' ).val( '' );
|
|
|
|
|
$( '#orlen_point_info' ).html( '' );
|
|
|
|
|
$( '.orlen-widget' ).hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( function()
|
|
|
|
|
{
|
|
|
|
|
$( 'body' ).on( 'change', '#basket .basket-product-message textarea', function()
|
|
|
|
|
{
|
|
|
|
|
var _this = $( this);
|
|
|
|
|
$(function() {
|
|
|
|
|
$('body').on('change', '#basket .basket-product-message textarea', function() {
|
|
|
|
|
var _this = $(this);
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
@@ -173,14 +215,14 @@
|
|
|
|
|
url: '/shopBasket/product_message_change',
|
|
|
|
|
data: {
|
|
|
|
|
product_message: _this.val(),
|
|
|
|
|
position_code: _this.attr( 'position' )
|
|
|
|
|
position_code: _this.attr('position')
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {},
|
|
|
|
|
success: function() {}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$( 'body' ).on( click_event, '#btn-basket-summary', function(e) {
|
|
|
|
|
$('body').on(click_event, '#btn-basket-summary', function(e) {
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
$.ajax({
|
|
|
|
|
@@ -189,18 +231,18 @@
|
|
|
|
|
url: '/shopBasket/transport_method_inpost_check',
|
|
|
|
|
data: {},
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
},
|
|
|
|
|
success: function( response ) {
|
|
|
|
|
success: function(response) {
|
|
|
|
|
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
if ( data.result === 'bad' ) {
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
$('#basket-container *').removeClass('disabled');
|
|
|
|
|
if (data.result === 'bad') {
|
|
|
|
|
|
|
|
|
|
$.alert({
|
|
|
|
|
|
|
|
|
|
title: '<?= ucfirst( \S::lang( 'uwaga' ) );?>',
|
|
|
|
|
content: 'Proszę wybrać paczkomat.',
|
|
|
|
|
title: '<?= ucfirst(\S::lang('uwaga')); ?>',
|
|
|
|
|
content: 'Proszę wybrać punkt odbioru.',
|
|
|
|
|
type: 'blue',
|
|
|
|
|
closeIcon: true,
|
|
|
|
|
closeIconClass: 'fas fa-times',
|
|
|
|
|
@@ -209,13 +251,12 @@
|
|
|
|
|
useBootstrap: false,
|
|
|
|
|
theme: 'modern',
|
|
|
|
|
autoClose: 'confirm|5000',
|
|
|
|
|
icon: 'fas fa-exclamation',
|
|
|
|
|
buttons: {
|
|
|
|
|
confirm: {
|
|
|
|
|
text: '<?= \S::lang( 'zamknij' );?>',
|
|
|
|
|
text: '<?= \S::lang('zamknij'); ?>',
|
|
|
|
|
btnClass: 'btn-blue',
|
|
|
|
|
keys: ['enter'],
|
|
|
|
|
action: function () {}
|
|
|
|
|
action: function() {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@@ -226,9 +267,8 @@
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$( 'body' ).on( 'change', '#basket-message', function()
|
|
|
|
|
{
|
|
|
|
|
var _this = $( this);
|
|
|
|
|
$('body').on('change', '#basket-message', function() {
|
|
|
|
|
var _this = $(this);
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
@@ -237,62 +277,56 @@
|
|
|
|
|
basket_message: _this.val()
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
},
|
|
|
|
|
success: function( response ) {
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
success: function(response) {
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
$('#basket-container *').removeClass('disabled');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$( 'body' ).on( 'change', '.basket-product .int-format', function()
|
|
|
|
|
{
|
|
|
|
|
var product_hash = $( this ).attr( 'product-hash' );
|
|
|
|
|
var quantity = $( this ).val();
|
|
|
|
|
$('body').on('change', '.basket-product .int-format', function() {
|
|
|
|
|
var product_hash = $(this).attr('product-hash');
|
|
|
|
|
var quantity = $(this).val();
|
|
|
|
|
|
|
|
|
|
$.ajax(
|
|
|
|
|
{
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/basket_change_quantity_product',
|
|
|
|
|
data:
|
|
|
|
|
{
|
|
|
|
|
data: {
|
|
|
|
|
product_hash: product_hash,
|
|
|
|
|
quantity: quantity
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function()
|
|
|
|
|
{
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
|
|
|
|
|
},
|
|
|
|
|
success: function( response )
|
|
|
|
|
{
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
success: function(response) {
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
|
|
|
|
|
if ( data.products_count === 0 )
|
|
|
|
|
{
|
|
|
|
|
if (data.products_count === 0) {
|
|
|
|
|
document.location.href = '/koszyk';
|
|
|
|
|
$( '.mini-box' ).hide();
|
|
|
|
|
$('.mini-box').hide();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
|
|
|
|
$( '#basket-container #content' ).html( data.basket );
|
|
|
|
|
$('#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-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 );
|
|
|
|
|
$('#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' );
|
|
|
|
|
$('body').on(click_event, '.basket-product .btn-minus', function() {
|
|
|
|
|
var product_hash = $(this).attr('product-hash');
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
@@ -302,38 +336,36 @@
|
|
|
|
|
product_hash: product_hash
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
|
|
|
|
|
},
|
|
|
|
|
success: function( response ) {
|
|
|
|
|
success: function(response) {
|
|
|
|
|
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
|
|
|
|
|
if ( data.products_count === 0 ) {
|
|
|
|
|
if (data.products_count === 0) {
|
|
|
|
|
document.location.href = '/koszyk';
|
|
|
|
|
$( '.mini-box' ).hide();
|
|
|
|
|
$('.mini-box').hide();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
|
|
|
|
$( '#basket-container #content' ).html( data.basket );
|
|
|
|
|
$('#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-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 );
|
|
|
|
|
$('#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' );
|
|
|
|
|
$('body').on(click_event, '.basket-product .btn-plus', function() {
|
|
|
|
|
var product_hash = $(this).attr('product-hash');
|
|
|
|
|
|
|
|
|
|
$.ajax(
|
|
|
|
|
{
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
cache: false,
|
|
|
|
|
url: '/shopBasket/basket_increase_quantity_product',
|
|
|
|
|
@@ -341,39 +373,37 @@
|
|
|
|
|
product_hash: product_hash
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
|
|
|
|
|
},
|
|
|
|
|
success: function( response ) {
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
success: function(response) {
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
|
|
|
|
|
if ( data.products_count === 0 )
|
|
|
|
|
{
|
|
|
|
|
if (data.products_count === 0) {
|
|
|
|
|
document.location.href = '/koszyk';
|
|
|
|
|
$( '.mini-box' ).hide();
|
|
|
|
|
$('.mini-box').hide();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
|
|
|
|
$( '#basket-container #content' ).html( data.basket );
|
|
|
|
|
$('#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-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 );
|
|
|
|
|
$('#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' );
|
|
|
|
|
$('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' );?>',
|
|
|
|
|
title: '<?= ucfirst(\S::lang('potwierdz')); ?>',
|
|
|
|
|
content: '<?= \S::lang('potwierdz-usuniecie-produktu-z-koszyka'); ?>',
|
|
|
|
|
closeIcon: true,
|
|
|
|
|
closeIconClass: 'fas fa-close',
|
|
|
|
|
typeAnimated: true,
|
|
|
|
|
@@ -383,7 +413,7 @@
|
|
|
|
|
autoClose: 'cancel|10000',
|
|
|
|
|
buttons: {
|
|
|
|
|
confirm: {
|
|
|
|
|
text: '<?= \S::lang( 'usun' );?>',
|
|
|
|
|
text: '<?= \S::lang('usun'); ?>',
|
|
|
|
|
btnClass: 'btn-orange',
|
|
|
|
|
keys: ['enter'],
|
|
|
|
|
action: function() {
|
|
|
|
|
@@ -395,34 +425,32 @@
|
|
|
|
|
product_hash: product_hash
|
|
|
|
|
},
|
|
|
|
|
beforeSend: function() {
|
|
|
|
|
$( '#basket-container *' ).addClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'disable' );
|
|
|
|
|
$('#basket-container *').addClass('disabled');
|
|
|
|
|
$('#payment-methods .icheck, #transport-methods .icheck').iCheck('disable');
|
|
|
|
|
},
|
|
|
|
|
success: function( response )
|
|
|
|
|
{
|
|
|
|
|
data = jQuery.parseJSON( response );
|
|
|
|
|
success: function(response) {
|
|
|
|
|
data = jQuery.parseJSON(response);
|
|
|
|
|
|
|
|
|
|
if ( data.products_count === 0 )
|
|
|
|
|
{
|
|
|
|
|
if (data.products_count === 0) {
|
|
|
|
|
document.location.href = '/koszyk';
|
|
|
|
|
$( '.mini-box' ).hide();
|
|
|
|
|
$('.mini-box').hide();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$( '#basket-container *' ).removeClass( 'disabled' );
|
|
|
|
|
$( '#payment-methods .icheck, #transport-methods .icheck' ).iCheck( 'enable' );
|
|
|
|
|
$( '#basket-container #content' ).html( data.basket );
|
|
|
|
|
$('#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-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 );
|
|
|
|
|
$('#basket-container #transport-methods').html(data.transport_methods);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cancel: {
|
|
|
|
|
text: '<?= \S::lang( 'zamknij' );?>',
|
|
|
|
|
text: '<?= \S::lang('zamknij'); ?>',
|
|
|
|
|
btnClass: 'btn-blue',
|
|
|
|
|
action: function() {}
|
|
|
|
|
}
|
|
|
|
|
@@ -431,4 +459,52 @@
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// zapisywanie wybranego orlen punktu
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
// Znajdź element #orlen_point_id
|
|
|
|
|
var orlenPointElement = document.querySelector('#transport-methods #orlen_point_id');
|
|
|
|
|
|
|
|
|
|
if (orlenPointElement) {
|
|
|
|
|
// Utwórz observer, który będzie reagował na zmiany w atrybucie value
|
|
|
|
|
var observer = new MutationObserver(function(mutations) {
|
|
|
|
|
mutations.forEach(function(mutation) {
|
|
|
|
|
if (mutation.type === 'attributes' && mutation.attributeName === 'value') {
|
|
|
|
|
var orlen_point_id = orlenPointElement.value;
|
|
|
|
|
var orlen_point_name = document.querySelector('#orlen_point_info').textContent;
|
|
|
|
|
|
|
|
|
|
// Przygotuj dane jako form-urlencoded
|
|
|
|
|
var formData = new URLSearchParams();
|
|
|
|
|
formData.append('orlen_point_id', orlen_point_id);
|
|
|
|
|
formData.append('orlen_point_name', orlen_point_name);
|
|
|
|
|
|
|
|
|
|
// Wykonaj żądanie AJAX
|
|
|
|
|
fetch('/shopBasket/orlen_save', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
},
|
|
|
|
|
body: formData,
|
|
|
|
|
cache: 'no-cache'
|
|
|
|
|
})
|
|
|
|
|
.then(response => response.text())
|
|
|
|
|
.then(data => {
|
|
|
|
|
// Obsługa odpowiedzi
|
|
|
|
|
console.log('Odpowiedź serwera:', data);
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.error('Błąd podczas wykonywania żądania:', error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Konfiguracja observera do śledzenia zmian atrybutów
|
|
|
|
|
observer.observe(orlenPointElement, {
|
|
|
|
|
attributes: true
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.warn('#orlen_point_id nie został znaleziony.');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|