Files
wyczarujprezent.pl/modules/pdfreedeliveryleftamountpro/views/js/scripts.js
2024-10-28 22:14:22 +01:00

53 lines
1.8 KiB
JavaScript

/**
* 2012-2017 Patryk Marek PrestaDev.pl
*
* Patryk Marek PrestaDev.pl - PD Free delivery left amount Pro for PS 1.5.x && 1.6.x © All rights reserved.
*
* DISCLAIMER
*
* Do not edit, modify or copy this file.
* If you wish to customize it, contact us at info@prestadev.pl.
*
* @author Patryk Marek PrestaDev.pl <info@prestadev.pl>
* @copyright 2012-2017 Patryk Marek - PrestaDev.pl
* @license License is for use in domain / or one multistore enviroment (do not modify or reuse this code or part of it)
* @link http://prestadev.pl
* @package PD Free delivery left amount for Pro PS 1.5.x && 1.6.x
* @version 1.1.1
* @date 18-12-2014
*/
$(document).ready(function(){
$('#header .ajax_block_cart_total').first().on('DOMSubtreeModified propertychange', function() {
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseDir + 'modules/pdfreedeliveryleftamountpro/ajax.php' + '?ajax=1&rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'action=calculateFreeDeliveryLeftAmount',
success: function(jsonData)
{
data = JSON.parse(jsonData);
if (data.free_ship_from == 0) {
$('.pdfla-cart').each(function(index, value) {
$(this).addClass('hidden');
});
} else {
$('.pdfla-cart').each(function(index, value) {
$(this).removeClass('hidden');
});
$('.pdfla-delta-price').each(function(index, value) {
$(this).text(data.delta_display);
});
$('.pdfla-start-from-price').each(function(index, value) {
$(this).text(data.free_ship_from_display);
});
}
}
});
});
});