:q
Merge branch 'master' of gitlab.antadis.fr:dev-antadis/toutpratique
This commit is contained in:
commit
83c4baae0e
@ -1 +0,0 @@
|
|||||||
Subproject commit 768f0fb4e7dc72091791d8dfadcce6ba40cf8b23
|
|
@ -128,6 +128,10 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.layer_cart_overlay, #order #layer_cart .cross, #order #layer_cart .continue', function() {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
// search tâches
|
// search tâches
|
||||||
if(typeof tags != 'undefined') {
|
if(typeof tags != 'undefined') {
|
||||||
$( "#cmsps-postsearch-tag" ).autocomplete({
|
$( "#cmsps-postsearch-tag" ).autocomplete({
|
||||||
|
@ -1,27 +1,3 @@
|
|||||||
/*
|
|
||||||
* 2007-2016 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
||||||
* that is bundled with this package in the file LICENSE.txt.
|
|
||||||
* It is also available through the world-wide-web at this URL:
|
|
||||||
* http://opensource.org/licenses/afl-3.0.php
|
|
||||||
* If you did not receive a copy of the license and are unable to
|
|
||||||
* obtain it through the world-wide-web, please send an email
|
|
||||||
* to license@prestashop.com so we can send you a copy immediately.
|
|
||||||
*
|
|
||||||
* DISCLAIMER
|
|
||||||
*
|
|
||||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
||||||
* versions in the future. If you wish to customize PrestaShop for your
|
|
||||||
* needs please refer to http://www.prestashop.com for more information.
|
|
||||||
*
|
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
|
||||||
* @copyright 2007-2016 PrestaShop SA
|
|
||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
*/
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
ajaxCart.overrideButtonsInThePage();
|
ajaxCart.overrideButtonsInThePage();
|
||||||
|
|
||||||
@ -34,10 +10,13 @@ $(document).ready(function(){
|
|||||||
ajaxCart.expand();
|
ajaxCart.expand();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var cart_qty = 0;
|
||||||
var current_timestamp = parseInt(new Date().getTime() / 1000);
|
var current_timestamp = parseInt(new Date().getTime() / 1000);
|
||||||
|
|
||||||
if (typeof $('.ajax_cart_quantity').html() == 'undefined' || (typeof generated_date != 'undefined' && generated_date != null && (parseInt(generated_date) + 30) < current_timestamp))
|
if (typeof $('.ajax_cart_quantity').html() == 'undefined' || (typeof generated_date != 'undefined' && generated_date != null && (parseInt(generated_date) + 30) < current_timestamp))
|
||||||
ajaxCart.refresh();
|
ajaxCart.refresh();
|
||||||
|
else
|
||||||
|
cart_qty = parseInt($('.ajax_cart_quantity').html());
|
||||||
|
|
||||||
/* roll over cart */
|
/* roll over cart */
|
||||||
var cart_block = new HoverWatcher('#header .cart_block');
|
var cart_block = new HoverWatcher('#header .cart_block');
|
||||||
@ -47,26 +26,9 @@ $(document).ready(function(){
|
|||||||
if ('ontouchstart' in document.documentElement)
|
if ('ontouchstart' in document.documentElement)
|
||||||
is_touch_enabled = true;
|
is_touch_enabled = true;
|
||||||
|
|
||||||
$(document).on('click', '#header .shopping_cart > a:first', function(e){
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
// Simulate hover when browser says device is touch based
|
|
||||||
if (is_touch_enabled)
|
|
||||||
{
|
|
||||||
if ($(this).next('.cart_block:visible').length && !cart_block.isHoveringOver())
|
|
||||||
$("#header .cart_block").stop(true, true).slideUp(450);
|
|
||||||
else if (ajaxCart.nb_total_products > 0 || parseInt($('.ajax_cart_quantity').html()) > 0)
|
|
||||||
$("#header .cart_block").stop(true, true).slideDown(450);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
window.location.href = $(this).attr('href');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#header .shopping_cart a:first").hover(
|
$("#header .shopping_cart a:first").hover(
|
||||||
function(){
|
function(){
|
||||||
if (ajaxCart.nb_total_products > 0 || parseInt($('.ajax_cart_quantity').html()) > 0)
|
if (ajaxCart.nb_total_products > 0 || cart_qty > 0)
|
||||||
$("#header .cart_block").stop(true, true).slideDown(450);
|
$("#header .cart_block").stop(true, true).slideDown(450);
|
||||||
},
|
},
|
||||||
function(){
|
function(){
|
||||||
@ -77,17 +39,6 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#header .cart_block").hover(
|
|
||||||
function(){
|
|
||||||
},
|
|
||||||
function(){
|
|
||||||
setTimeout(function(){
|
|
||||||
if (!shopping_cart.isHoveringOver())
|
|
||||||
$("#header .cart_block").stop(true, true).slideUp(450);
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$(document).on('click', '.delete_voucher', function(e){
|
$(document).on('click', '.delete_voucher', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -98,7 +49,6 @@ $(document).ready(function(){
|
|||||||
url:$(this).attr('href') + '?rand=' + new Date().getTime()
|
url:$(this).attr('href') + '?rand=' + new Date().getTime()
|
||||||
});
|
});
|
||||||
$(this).parent().parent().remove();
|
$(this).parent().parent().remove();
|
||||||
ajaxCart.refresh();
|
|
||||||
if ($('body').attr('id') == 'order' || $('body').attr('id') == 'order-opc')
|
if ($('body').attr('id') == 'order' || $('body').attr('id') == 'order-opc')
|
||||||
{
|
{
|
||||||
if (typeof(updateAddressSelection) != 'undefined')
|
if (typeof(updateAddressSelection) != 'undefined')
|
||||||
@ -116,7 +66,7 @@ $(document).ready(function(){
|
|||||||
$(document).on('click', '#layer_cart .cross, #layer_cart .continue, .layer_cart_overlay', function(e){
|
$(document).on('click', '#layer_cart .cross, #layer_cart .continue, .layer_cart_overlay', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('.layer_cart_overlay').hide();
|
$('.layer_cart_overlay').hide();
|
||||||
$('#layer_cart').fadeOut('fast');
|
$('#layer_cart').removeClass('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#columns #layer_cart, #columns .layer_cart_overlay').detach().prependTo('#columns');
|
$('#columns #layer_cart, #columns .layer_cart_overlay').detach().prependTo('#columns');
|
||||||
@ -127,43 +77,33 @@ var ajaxCart = {
|
|||||||
nb_total_products: 0,
|
nb_total_products: 0,
|
||||||
//override every button in the page in relation to the cart
|
//override every button in the page in relation to the cart
|
||||||
overrideButtonsInThePage : function(){
|
overrideButtonsInThePage : function(){
|
||||||
|
|
||||||
//for every 'add' buttons...
|
//for every 'add' buttons...
|
||||||
$(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function(e){
|
$(document).off('click', '.ajax_add_to_cart_button').on('click', '.ajax_add_to_cart_button', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var idProduct = parseInt($(this).data('id-product'));
|
var idProduct = parseInt($(this).attr('data-id-product'));
|
||||||
var idProductAttribute = parseInt($(this).data('id-product-attribute'));
|
|
||||||
var minimalQuantity = parseInt($(this).data('minimal_quantity'));
|
var minimalQuantity = parseInt($(this).data('minimal_quantity'));
|
||||||
if (!minimalQuantity)
|
if (!minimalQuantity)
|
||||||
minimalQuantity = 1;
|
minimalQuantity = 1;
|
||||||
if ($(this).prop('disabled') != 'disabled')
|
if ($(this).prop('disabled') != 'disabled')
|
||||||
ajaxCart.add(idProduct, idProductAttribute, false, this, minimalQuantity);
|
ajaxCart.add(idProduct, null, false, this, minimalQuantity);
|
||||||
});
|
});
|
||||||
|
|
||||||
//for product page 'add' button...
|
//for product page 'add' button...
|
||||||
if ($('.cart_block').length) {
|
$(document).on('click', '#add_to_cart button', function(e){
|
||||||
$(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e){
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
|
ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
|
||||||
console.log('test');
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if ($('.cart_block_product_accessories').length) {
|
|
||||||
$(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e){
|
|
||||||
e.preventDefault();
|
|
||||||
var idProduct = parseInt($(this).parent().data('id-product'));
|
|
||||||
ajaxCart.add(idProduct, 0, false, null, 1, null, false);
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//for 'delete' buttons in the cart block...
|
//for 'delete' buttons in the cart block...
|
||||||
$(document).off('click', '.cart_block_list .ajax_cart_block_remove_link').on('click', '.cart_block_list .ajax_cart_block_remove_link', function(e){
|
$('.cart_block_list .ajax_cart_block_remove_link').unbind('click').click(function(e){
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Customized product management
|
// Customized product management
|
||||||
var customizationId = 0;
|
var customizationId = 0;
|
||||||
var productId = 0;
|
var productId = 0;
|
||||||
var productAttributeId = 0;
|
var productAttributeId = 0;
|
||||||
var customizableProductDiv = $($(this).parent().parent()).find("div[data-id^=deleteCustomizableProduct_]");
|
var customizableProductDiv = $($(this).parent().parent());
|
||||||
var idAddressDelivery = false;
|
var idAddressDelivery = false;
|
||||||
|
|
||||||
if (customizableProductDiv && $(customizableProductDiv).length)
|
if (customizableProductDiv && $(customizableProductDiv).length)
|
||||||
@ -258,11 +198,11 @@ var ajaxCart = {
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
headers: { "cache-control": "no-cache" },
|
headers: { "cache-control": "no-cache" },
|
||||||
url: (typeof(baseUri) !== 'undefined') ? baseUri + '?rand=' + new Date().getTime() : '',
|
url: baseUri + '?rand=' + new Date().getTime(),
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: (typeof(static_token) !== 'undefined') ? 'controller=cart&ajax=true&token=' + static_token : '',
|
data: 'controller=cart&ajax=true&token=' + static_token,
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
ajaxCart.updateCart(jsonData);
|
ajaxCart.updateCart(jsonData);
|
||||||
@ -288,9 +228,51 @@ var ajaxCart = {
|
|||||||
// close fancybox
|
// close fancybox
|
||||||
updateFancyBox : function (){},
|
updateFancyBox : function (){},
|
||||||
// add a product in the cart via ajax
|
// add a product in the cart via ajax
|
||||||
add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist, fancyboxOpen){
|
addMultiple : function(idProduct, idCombination, quantity) {
|
||||||
if(typeof fancyboxOpen == "undefined") {
|
$.ajax({
|
||||||
fancyboxOpen = true;
|
type: 'POST',
|
||||||
|
headers: { "cache-control": "no-cache" },
|
||||||
|
url: baseUri + '?rand=' + new Date().getTime(),
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
dataType : "json",
|
||||||
|
data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''),
|
||||||
|
success: function(jsonData,textStatus,jqXHR) {
|
||||||
|
if (!jsonData.hasError) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||||
|
// {
|
||||||
|
// var error = "Impossible to add the product to the cart.<br/>textStatus: '" + textStatus + "'<br/>errorThrown: '" + errorThrown + "'<br/>responseText:<br/>" + XMLHttpRequest.responseText;
|
||||||
|
// if (!!$.prototype.fancybox)
|
||||||
|
// $.fancybox.open([
|
||||||
|
// {
|
||||||
|
// type: 'inline',
|
||||||
|
// autoScale: true,
|
||||||
|
// minHeight: 30,
|
||||||
|
// content: '<p class="fancybox-error">' + error + '</p>'
|
||||||
|
// }],
|
||||||
|
// {
|
||||||
|
// padding: 0
|
||||||
|
// });
|
||||||
|
// else
|
||||||
|
// alert(error);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
returnStatus : function(data) {
|
||||||
|
return data.hasError;
|
||||||
|
},
|
||||||
|
|
||||||
|
add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist, fromPack){
|
||||||
|
|
||||||
|
if(typeof(fromPack) === 'undefined')
|
||||||
|
{
|
||||||
|
fromPack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addedFromProductPage && !checkCustomizations())
|
if (addedFromProductPage && !checkCustomizations())
|
||||||
@ -302,7 +284,6 @@ var ajaxCart = {
|
|||||||
window.parent.document.location.href = data;
|
window.parent.document.location.href = data;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!$.prototype.fancybox)
|
if (!!$.prototype.fancybox)
|
||||||
$.fancybox.open([
|
$.fancybox.open([
|
||||||
{
|
{
|
||||||
@ -318,7 +299,7 @@ var ajaxCart = {
|
|||||||
alert(fieldRequired);
|
alert(fieldRequired);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
emptyCustomizations();
|
||||||
//disabled the button when adding to not double add if user double click
|
//disabled the button when adding to not double add if user double click
|
||||||
if (addedFromProductPage)
|
if (addedFromProductPage)
|
||||||
{
|
{
|
||||||
@ -339,7 +320,7 @@ var ajaxCart = {
|
|||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): '' + '&id_customization=' + ((typeof customizationId !== 'undefined') ? customizationId : 0)),
|
data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''),
|
||||||
success: function(jsonData,textStatus,jqXHR)
|
success: function(jsonData,textStatus,jqXHR)
|
||||||
{
|
{
|
||||||
// add appliance to whishlist module
|
// add appliance to whishlist module
|
||||||
@ -355,11 +336,12 @@ var ajaxCart = {
|
|||||||
|
|
||||||
if (jsonData.crossSelling)
|
if (jsonData.crossSelling)
|
||||||
$('.crossseling').html(jsonData.crossSelling);
|
$('.crossseling').html(jsonData.crossSelling);
|
||||||
|
else
|
||||||
|
$('.crossseling').html('');
|
||||||
|
|
||||||
if(fancyboxOpen) {
|
|
||||||
if (idCombination)
|
if (idCombination)
|
||||||
$(jsonData.products).each(function(){
|
$(jsonData.products).each(function(){
|
||||||
if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
|
if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination) && !fromPack)
|
||||||
if (contentOnly)
|
if (contentOnly)
|
||||||
window.parent.ajaxCart.updateLayer(this);
|
window.parent.ajaxCart.updateLayer(this);
|
||||||
else
|
else
|
||||||
@ -367,22 +349,15 @@ var ajaxCart = {
|
|||||||
});
|
});
|
||||||
else
|
else
|
||||||
$(jsonData.products).each(function(){
|
$(jsonData.products).each(function(){
|
||||||
if (this.id != undefined && this.id == parseInt(idProduct))
|
if (this.id != undefined && this.id == parseInt(idProduct) && !fromPack)
|
||||||
if (contentOnly)
|
if (contentOnly)
|
||||||
window.parent.ajaxCart.updateLayer(this);
|
window.parent.ajaxCart.updateLayer(this);
|
||||||
else
|
else
|
||||||
ajaxCart.updateLayer(this);
|
ajaxCart.updateLayer(this);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(!fancyboxOpen) {
|
|
||||||
parent.$.fancybox.close();
|
|
||||||
} else {
|
|
||||||
if (contentOnly)
|
if (contentOnly)
|
||||||
parent.$.fancybox.close();
|
parent.$.fancybox.close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (contentOnly)
|
if (contentOnly)
|
||||||
@ -395,8 +370,6 @@ var ajaxCart = {
|
|||||||
$(callerElement).removeProp('disabled');
|
$(callerElement).removeProp('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
emptyCustomizations();
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||||
{
|
{
|
||||||
@ -504,7 +477,6 @@ var ajaxCart = {
|
|||||||
// If the cart is now empty, show the 'no product in the cart' message and close detail
|
// If the cart is now empty, show the 'no product in the cart' message and close detail
|
||||||
if($('.cart_block:first dl.products dt').length == 0)
|
if($('.cart_block:first dl.products dt').length == 0)
|
||||||
{
|
{
|
||||||
$('.ajax_cart_quantity').html('0');
|
|
||||||
$("#header .cart_block").stop(true, true).slideUp(200);
|
$("#header .cart_block").stop(true, true).slideUp(200);
|
||||||
$('.cart_block_no_products:hidden').slideDown(450);
|
$('.cart_block_no_products:hidden').slideDown(450);
|
||||||
$('.cart_block dl.products').remove();
|
$('.cart_block dl.products').remove();
|
||||||
@ -629,20 +601,22 @@ var ajaxCart = {
|
|||||||
{
|
{
|
||||||
var productId = parseInt(this.id);
|
var productId = parseInt(this.id);
|
||||||
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
|
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
|
||||||
var content = '<dt class="unvisible" data-id="cart_block_product_' + domIdProduct + '">';
|
var content = '<dt class="panel-product unvisible" data-id="cart_block_product_' + domIdProduct + '">';
|
||||||
var name = $.trim($('<span />').html(this.name).text());
|
var name = $.trim($('<span />').html(this.name).text());
|
||||||
name = (name.length > 12 ? name.substring(0, 10) + '...' : name);
|
content += '<div class="row">';
|
||||||
content += '<a class="cart-images" href="' + this.link + '" title="' + name + '"><img src="' + this.image_cart + '" alt="' + this.name +'"></a>';
|
content += '<a class="panel-product-img cart-images" href="' + this.link + '" title="' + name + '"><img src="' + this.image + '" alt="' + this.name +'"></a>';
|
||||||
content += '<div class="cart-info"><div class="product-name">' + '<span class="quantity-formated"><span class="quantity">' + this.quantity + '</span> x </span><a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a></div>';
|
content += '<div class="panel-product-info cart-info">';
|
||||||
if (this.hasAttributes)
|
content += '<div class="panel-product-category">'+ this.category_name + '</div>';
|
||||||
content += '<div class="product-atributes"><a href="' + this.link + '" title="' + this.name + '">' + this.attributes + '</a></div>';
|
content += '<div class="panel-product-title product-name"><a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a></div>';
|
||||||
|
|
||||||
if (typeof(freeProductTranslation) != 'undefined')
|
if (typeof(freeProductTranslation) != 'undefined')
|
||||||
content += '<span class="price">' + (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation) + '</span></div>';
|
content += '<span class="panel-product-price price">' + (parseFloat(this.price_float) > 0 ? this.priceByLine : freeProductTranslation) + '</span></div>';
|
||||||
|
|
||||||
if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0)
|
if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0)
|
||||||
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&delete=1&id_product=' + productId + '&token=' + static_token + (this.hasAttributes ? '&ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
|
content += '<a rel="nofollow" class="icon-close ajax_cart_block_remove_link icon" href="' + baseUri + '?controller=cart&delete=1&id_product=' + productId + '&token=' + static_token + (this.hasAttributes ? '&ipa=' + parseInt(this.idCombination) : '') + '"> </a>';
|
||||||
else
|
else
|
||||||
content += '<span class="remove_link"></span>';
|
content += '<span class="remove_link"></span>';
|
||||||
|
content += '</div>';
|
||||||
content += '</dt>';
|
content += '</dt>';
|
||||||
if (this.hasAttributes)
|
if (this.hasAttributes)
|
||||||
content += '<dd data-id="cart_block_combination_of_' + domIdProduct + '" class="unvisible">';
|
content += '<dd data-id="cart_block_combination_of_' + domIdProduct + '" class="unvisible">';
|
||||||
@ -693,6 +667,7 @@ var ajaxCart = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.overrideButtonsInThePage();
|
||||||
},
|
},
|
||||||
|
|
||||||
displayNewCustomizedDatas : function(product){
|
displayNewCustomizedDatas : function(product){
|
||||||
@ -751,21 +726,59 @@ var ajaxCart = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateLayer : function(product){
|
updateLayer : function(product){
|
||||||
$('#layer_cart_product_title').text(product.name);
|
var id_product = product.id;
|
||||||
$('#layer_cart_product_attributes').text('');
|
var idCombination = product.idCombination;
|
||||||
if (product.hasAttributes && product.hasAttributes == true)
|
var quantity = 1;
|
||||||
$('#layer_cart_product_attributes').html(product.attributes);
|
if($("#quantity_wanted").val()){
|
||||||
$('#layer_cart_product_price').text(product.price);
|
quantity = $("#quantity_wanted").val();
|
||||||
$('#layer_cart_product_quantity').text(product.quantity);
|
}
|
||||||
$('.layer_cart_img').html('<img class="layer_cart_img img-responsive" src="' + product.image + '" alt="' + product.name + '" title="' + product.name + '" />');
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
headers: { "cache-control": "no-cache" },
|
||||||
|
url: baseUri + '?rand=' + new Date().getTime(),
|
||||||
|
async: true,
|
||||||
|
cache: false,
|
||||||
|
dataType : "json",
|
||||||
|
data: 'controller=product&action=getProductInfo&ajax=true&token=' + static_token + '&id_product=' + id_product + '&idCombination=' +idCombination + '&qty=' +quantity,
|
||||||
|
success : function(data) {
|
||||||
|
if(data.found)
|
||||||
|
{
|
||||||
|
if(ajaxCart.updateWithNewInfo(data))
|
||||||
|
{
|
||||||
|
|
||||||
var n = parseInt($(window).scrollTop()) + 'px';
|
$('#layer_cart').addClass('open');
|
||||||
|
$('#layer_cart .panel-overlay').addClass('open');
|
||||||
|
$('.layer_cart_overlay').fadeIn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
$('.layer_cart_overlay').css('width','100%');
|
updateInfoCart: function(quantity_add) {
|
||||||
$('.layer_cart_overlay').css('height','100%');
|
var actual = $('#header-cart .ajax_cart_quantity').html();
|
||||||
$('.layer_cart_overlay').show();
|
actual = actual.replace("(", "");
|
||||||
$('#layer_cart').css({'top': n}).fadeIn('fast');
|
actual = actual.replace(")", "");
|
||||||
crossselling_serialScroll();
|
var totalCart = parseInt(actual) + parseInt(quantity_add);
|
||||||
|
$('#header-cart .ajax_cart_quantity').html('('+totalCart+')');
|
||||||
|
},
|
||||||
|
|
||||||
|
updateWithNewInfo : function(data){
|
||||||
|
$(".layer_cart_product .product-image-container").html('<img class="img-responsive" src="'+data.product.img+'" />');
|
||||||
|
$(".layer_cart_product .product-name").html(data.product.name);
|
||||||
|
$(".layer_cart_product .product-price").html(data.product.productPrice);
|
||||||
|
$(".layer_cart_product .nb_quantity").html(data.product.quantity_in_cart);
|
||||||
|
|
||||||
|
if (data.product.specificPrice) {
|
||||||
|
$(".layer_cart_product .product-old-price .value").html(data.product.productPriceWithoutReduction);
|
||||||
|
} else {
|
||||||
|
$('.product-old-price').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
var n = parseInt($(window).scrollTop() + 20) + 'px';
|
||||||
|
$('#layer_cart').css({'top': n});
|
||||||
|
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
//genarally update the display of the cart
|
//genarally update the display of the cart
|
||||||
@ -809,22 +822,13 @@ var ajaxCart = {
|
|||||||
|
|
||||||
//update general cart informations everywhere in the page
|
//update general cart informations everywhere in the page
|
||||||
updateCartEverywhere : function(jsonData){
|
updateCartEverywhere : function(jsonData){
|
||||||
|
|
||||||
$('.ajax_cart_total').text($.trim(jsonData.productTotal));
|
$('.ajax_cart_total').text($.trim(jsonData.productTotal));
|
||||||
|
|
||||||
if (typeof hasDeliveryAddress == 'undefined')
|
|
||||||
hasDeliveryAddress = false;
|
|
||||||
|
|
||||||
if (parseFloat(jsonData.shippingCostFloat) > 0)
|
if (parseFloat(jsonData.shippingCostFloat) > 0)
|
||||||
$('.ajax_cart_shipping_cost').text(jsonData.shippingCost).parent().find('.unvisible').show();
|
$('.ajax_cart_shipping_cost').text(jsonData.shippingCost);
|
||||||
else if ((hasDeliveryAddress || typeof(orderProcess) !== 'undefined' && orderProcess == 'order-opc') && typeof(freeShippingTranslation) != 'undefined')
|
else if (typeof(freeShippingTranslation) != 'undefined')
|
||||||
$('.ajax_cart_shipping_cost').html(freeShippingTranslation);
|
$('.ajax_cart_shipping_cost').html(freeShippingTranslation);
|
||||||
else if ((typeof toBeDetermined !== 'undefined') && !hasDeliveryAddress)
|
|
||||||
$('.ajax_cart_shipping_cost').html(toBeDetermined);
|
|
||||||
|
|
||||||
if (!jsonData.shippingCostFloat && !jsonData.free_ship)
|
|
||||||
$('.ajax_cart_shipping_cost').parent().find('.unvisible').hide();
|
|
||||||
else if (hasDeliveryAddress && !jsonData.isVirtualCart)
|
|
||||||
$('.ajax_cart_shipping_cost').parent().find('.unvisible').show();
|
|
||||||
|
|
||||||
$('.ajax_cart_tax_cost').text(jsonData.taxCost);
|
$('.ajax_cart_tax_cost').text(jsonData.taxCost);
|
||||||
$('.cart_block_wrapping_cost').text(jsonData.wrappingCost);
|
$('.cart_block_wrapping_cost').text(jsonData.wrappingCost);
|
||||||
@ -842,10 +846,11 @@ var ajaxCart = {
|
|||||||
|
|
||||||
this.nb_total_products = jsonData.nbTotalProducts;
|
this.nb_total_products = jsonData.nbTotalProducts;
|
||||||
|
|
||||||
|
$('.ajax_cart_quantity').text('('+jsonData.nbTotalProducts+')');
|
||||||
|
|
||||||
if (parseInt(jsonData.nbTotalProducts) > 0)
|
if (parseInt(jsonData.nbTotalProducts) > 0)
|
||||||
{
|
{
|
||||||
$('.ajax_cart_no_product').hide();
|
$('.ajax_cart_no_product').hide();
|
||||||
$('.ajax_cart_quantity').text(jsonData.nbTotalProducts);
|
|
||||||
$('.ajax_cart_quantity').fadeIn('slow');
|
$('.ajax_cart_quantity').fadeIn('slow');
|
||||||
$('.ajax_cart_total').fadeIn('slow');
|
$('.ajax_cart_total').fadeIn('slow');
|
||||||
|
|
||||||
@ -872,7 +877,7 @@ var ajaxCart = {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('.ajax_cart_quantity, .ajax_cart_product_txt_s, .ajax_cart_product_txt, .ajax_cart_total').each(function(){
|
$('.ajax_cart_product_txt_s, .ajax_cart_product_txt, .ajax_cart_total').each(function(){
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
});
|
});
|
||||||
$('.ajax_cart_no_product').show('slow');
|
$('.ajax_cart_no_product').show('slow');
|
||||||
|
@ -104,7 +104,11 @@
|
|||||||
<div class="btnWrap col-md-7 col-sm-12">
|
<div class="btnWrap col-md-7 col-sm-12">
|
||||||
{if ($showAccessory['product']->id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $showAccessory['product']->available_for_order AND !isset($restricted_country_mode) AND $showAccessory['product']->minimal_quantity == 1 AND $showAccessory['product']->customizable != 2}
|
{if ($showAccessory['product']->id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $showAccessory['product']->available_for_order AND !isset($restricted_country_mode) AND $showAccessory['product']->minimal_quantity == 1 AND $showAccessory['product']->customizable != 2}
|
||||||
{if ($showAccessory['quantity'] > 0 OR $showAccessory['product']->allow_oosp)}
|
{if ($showAccessory['quantity'] > 0 OR $showAccessory['product']->allow_oosp)}
|
||||||
<p id="add_to_cart" class="buttons_bottom_block no-print cart_block_product_accessories" data-id-product="{$showAccessory['id_product']}">
|
<p
|
||||||
|
class="buttons_bottom_block no-print ajax_add_to_cart_button cart_block_product_accessories"
|
||||||
|
data-minimal_quantity="1"
|
||||||
|
data-id-product="{$showAccessory['id_product']}"
|
||||||
|
>
|
||||||
<button type="submit" name="Submit" class="exclusive btn btn-cart">
|
<button type="submit" name="Submit" class="exclusive btn btn-cart">
|
||||||
<span><i class="icon icon-shopping-cart"></i>{l s='Ajouter au panier' mod='productaccessories'}</span>
|
<span><i class="icon icon-shopping-cart"></i>{l s='Ajouter au panier' mod='productaccessories'}</span>
|
||||||
</button>
|
</button>
|
||||||
@ -128,3 +132,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user