Updating styles
This commit is contained in:
@@ -163,16 +163,29 @@ var ajaxCart = {
|
||||
},
|
||||
|
||||
// Update the cart information
|
||||
updateCartInformation : function (jsonData, addedFromProductPage)
|
||||
updateCartInformation : function (jsonData, addedFromProductPage, contentOnly)
|
||||
{
|
||||
ajaxCart.updateCart(jsonData);
|
||||
|
||||
// if added from Quick View
|
||||
var contentOnly = contentOnly;
|
||||
if (addedFromProductPage && typeof(contentOnly) != 'undefined' && (!jsonData.hasError || jsonData.hasError==false))
|
||||
$.fancybox.close(),
|
||||
ajaxCart.updateCart(jsonData),
|
||||
$('.crossseling').html(jsonData.crossSelling);
|
||||
|
||||
ajaxCart.updateCart(jsonData);
|
||||
|
||||
//reactive the button when adding has finished
|
||||
if (addedFromProductPage)
|
||||
$('#add_to_cart button').removeAttr('disabled').removeClass('disabled');
|
||||
else
|
||||
$('.ajax_add_to_cart_button').removeAttr('disabled');
|
||||
},
|
||||
// close fancybox
|
||||
updateFancyBox : function ()
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
// add a product in the cart via ajax
|
||||
add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist){
|
||||
@@ -207,69 +220,34 @@ var ajaxCart = {
|
||||
// add appliance to whishlist module
|
||||
if (whishlist && !jsonData.errors)
|
||||
WishlistAddProductCart(whishlist[0], idProduct, idCombination, whishlist[1]);
|
||||
|
||||
// add the picture to the cart
|
||||
var $element = $(callerElement).parents('.ajax_block_product').find('a.product_image img,a.product_img_link img');
|
||||
if (!$element.length)
|
||||
$element = $('#bigpic');
|
||||
var $picture = $element.clone();
|
||||
var pictureOffsetOriginal = $element.offset();
|
||||
pictureOffsetOriginal.right = $(window).innerWidth() - pictureOffsetOriginal.left - $element.width();
|
||||
|
||||
if ($picture.length)
|
||||
{
|
||||
$picture.css({
|
||||
position: 'absolute',
|
||||
top: pictureOffsetOriginal.top,
|
||||
right: pictureOffsetOriginal.right
|
||||
});
|
||||
}
|
||||
if (typeof(contentOnly) != 'undefined') {
|
||||
var $contentOnly = contentOnly;
|
||||
}
|
||||
var pictureOffset = $picture.offset();
|
||||
if (($contentOnly && $contentOnly !=true) || !$contentOnly) {
|
||||
var cartBlock = $('#cart_block');
|
||||
if (!$('#cart_block')[0] || !$('#cart_block').offset().top || !$('#cart_block').offset().left)
|
||||
cartBlock = $('#shopping_cart');
|
||||
var cartBlockOffset = cartBlock.offset();
|
||||
cartBlockOffset.right = $(window).innerWidth() - cartBlockOffset.left - cartBlock.width();
|
||||
}
|
||||
|
||||
// Check if the block cart is activated for the animation
|
||||
if (cartBlockOffset != undefined && $picture.length && (($contentOnly && $contentOnly !=true) || !$contentOnly))
|
||||
{
|
||||
$picture.appendTo('body');
|
||||
$picture
|
||||
.css({
|
||||
position: 'absolute',
|
||||
top: pictureOffsetOriginal.top,
|
||||
right: pictureOffsetOriginal.right,
|
||||
zIndex: 4242
|
||||
})
|
||||
.animate({
|
||||
width: $element.attr('width')*0.66,
|
||||
height: $element.attr('height')*0.66,
|
||||
opacity: 0.2,
|
||||
top: cartBlockOffset.top + 30,
|
||||
right: cartBlockOffset.right + 15
|
||||
}, 1000)
|
||||
.fadeOut(100, function() {
|
||||
ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
|
||||
$(this).remove();
|
||||
if (!jsonData.hasError)
|
||||
{
|
||||
$('.crossseling').html(jsonData.crossSelling)
|
||||
$(jsonData.products).each(function(){
|
||||
if (this.id != undefined && this.id == parseInt(idProduct))
|
||||
ajaxCart.updateLayer(this);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (typeof(contentOnly) != 'undefined') {
|
||||
var $contentOnly = contentOnly;
|
||||
}
|
||||
else if ($contentOnly && $contentOnly !=false) {
|
||||
window.parent.ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
|
||||
|
||||
//adding product to cart and update Layer Cart
|
||||
if (($contentOnly && $contentOnly !=true) || !$contentOnly)
|
||||
{
|
||||
ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
|
||||
if (!jsonData.hasError)
|
||||
{
|
||||
$('.crossseling').html(jsonData.crossSelling)
|
||||
$(jsonData.products).each(function(){
|
||||
if (this.id != undefined && this.id == parseInt(idProduct))
|
||||
ajaxCart.updateLayer(this);
|
||||
});
|
||||
}
|
||||
}
|
||||
//adding product to cart and update Layer Cart (Quick View)
|
||||
else if ($contentOnly && $contentOnly !=false) {
|
||||
contentOnly = true;
|
||||
window.parent.ajaxCart.updateCartInformation(jsonData, addedFromProductPage, contentOnly);
|
||||
if (!jsonData.hasError)
|
||||
$(jsonData.products).each(function(){
|
||||
if (this.id != undefined && this.id == parseInt(idProduct))
|
||||
window.parent.ajaxCart.updateLayer(this);
|
||||
});
|
||||
else
|
||||
$('#add_to_cart button').removeAttr('disabled').removeClass('disabled');
|
||||
}
|
||||
else {
|
||||
ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
|
||||
@@ -619,6 +597,7 @@ var ajaxCart = {
|
||||
$('.layer_cart_overlay').css('height','100%');
|
||||
$('.layer_cart_overlay').show();
|
||||
$('#layer_cart').css({'top': n}).fadeIn('fast');
|
||||
$.scrollTo('#layer_cart', 400);
|
||||
crossselling_serialScroll();
|
||||
},
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ $(document).ready(function()
|
||||
// Click on color
|
||||
$('#layered_form input[type=button], #layered_form label.layered_color').live('click', function()
|
||||
{
|
||||
if (!$('input[name='+$(this).prop('name')+'][type=hidden]').length)
|
||||
$('<input />').prop('type', 'hidden').prop('name', $(this).prop('name')).val($(this).prop('rel')).appendTo('#layered_form');
|
||||
if (!$('input[name='+$(this).attr('name')+'][type=hidden]').length)
|
||||
$('<input />').attr('type', 'hidden').attr('name', $(this).attr('name')).val($(this).attr('rel')).appendTo('#layered_form');
|
||||
else
|
||||
$('input[name='+$(this).prop('name')+'][type=hidden]').remove();
|
||||
$('input[name='+$(this).attr('name')+'][type=hidden]').remove();
|
||||
reloadContent();
|
||||
});
|
||||
|
||||
@@ -52,17 +52,17 @@ $(document).ready(function()
|
||||
// Changing content of an input text
|
||||
$('#layered_form input.layered_input_range').live('keyup', function()
|
||||
{
|
||||
if ($(this).prop('timeout_id'))
|
||||
window.clearTimeout($(this).prop('timeout_id'));
|
||||
if ($(this).attr('timeout_id'))
|
||||
window.clearTimeout($(this).attr('timeout_id'));
|
||||
|
||||
// IE Hack, setTimeout do not acept the third parameter
|
||||
var reference = this;
|
||||
|
||||
$(this).prop('timeout_id', window.setTimeout(function(it) {
|
||||
if (!$(it).prop('id'))
|
||||
$(this).attr('timeout_id', window.setTimeout(function(it) {
|
||||
if (!$(it).attr('id'))
|
||||
it = reference;
|
||||
|
||||
var filter = $(it).prop('id').replace(/^layered_(.+)_range_.*$/, '$1');
|
||||
var filter = $(it).attr('id').replace(/^layered_(.+)_range_.*$/, '$1');
|
||||
|
||||
var value_min = parseInt($('#layered_'+filter+'_range_min').val());
|
||||
if (isNaN(value_min))
|
||||
@@ -83,9 +83,9 @@ $(document).ready(function()
|
||||
});
|
||||
|
||||
$('#layered_block_left .radio').live('click', function() {
|
||||
var name = $(this).prop('name');
|
||||
var name = $(this).attr('name');
|
||||
$.each($(this).parent().parent().find('input[type=button]'), function (it, item) {
|
||||
if ($(item).hasClass('on') && $(item).prop('name') != name) {
|
||||
if ($(item).hasClass('on') && $(item).attr('name') != name) {
|
||||
$(item).click();
|
||||
}
|
||||
});
|
||||
@@ -95,7 +95,7 @@ $(document).ready(function()
|
||||
// Click on label
|
||||
$('#layered_block_left label a').live({
|
||||
click: function() {
|
||||
var disable = $(this).parent().parent().find('input').prop('disabled');
|
||||
var disable = $(this).parent().parent().find('input').attr('disabled');
|
||||
if (disable == ''
|
||||
|| typeof(disable) == 'undefined'
|
||||
|| disable == false)
|
||||
@@ -109,13 +109,13 @@ $(document).ready(function()
|
||||
|
||||
layered_hidden_list = {};
|
||||
$('.hide-action').live('click', function() {
|
||||
if (typeof(layered_hidden_list[$(this).parent().find('ul').prop('id')]) == 'undefined' || layered_hidden_list[$(this).parent().find('ul').prop('id')] == false)
|
||||
if (typeof(layered_hidden_list[$(this).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(this).parent().find('ul').attr('id')] == false)
|
||||
{
|
||||
layered_hidden_list[$(this).parent().find('ul').prop('id')] = true;
|
||||
layered_hidden_list[$(this).parent().find('ul').attr('id')] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
layered_hidden_list[$(this).parent().find('ul').prop('id')] = false;
|
||||
layered_hidden_list[$(this).parent().find('ul').attr('id')] = false;
|
||||
}
|
||||
hideFilterValueAction(this);
|
||||
});
|
||||
@@ -128,10 +128,10 @@ $(document).ready(function()
|
||||
while ($('#selectPrductSort').length) { // Because ids are duplicated
|
||||
// Unbind event change on #selectPrductSort
|
||||
$('#selectPrductSort').unbind('change');
|
||||
$('#selectPrductSort').prop('onchange', '');
|
||||
$('#selectPrductSort').attr('onchange', '');
|
||||
$('#selectPrductSort').addClass('selectProductSort');
|
||||
$('#selectPrductSort').prop('id', 'selectPrductSort'+id);
|
||||
$('label[for=selectPrductSort]').prop('for', 'selectPrductSort'+id);
|
||||
$('#selectPrductSort').attr('id', 'selectPrductSort'+id);
|
||||
$('label[for=selectPrductSort]').attr('for', 'selectPrductSort'+id);
|
||||
id++;
|
||||
}
|
||||
|
||||
@@ -145,20 +145,20 @@ $(document).ready(function()
|
||||
reloadContent();
|
||||
});
|
||||
|
||||
$('.js-nb_item').unbind('change').prop('onchange', '');
|
||||
$('.js-nb_item').unbind('change').attr('onchange', '');
|
||||
|
||||
$('.js-nb_item').live('change', function(event) {
|
||||
$('.js-nb_item').val($(this).val());
|
||||
reloadContent();
|
||||
});
|
||||
|
||||
paginationButton();
|
||||
paginationButton(false);
|
||||
initLayered();
|
||||
});
|
||||
|
||||
function hideFilterValueAction(it)
|
||||
{
|
||||
if (typeof(layered_hidden_list[$(it).parent().find('ul').prop('id')]) == 'undefined' || layered_hidden_list[$(it).parent().find('ul').prop('id')] == false)
|
||||
if (typeof(layered_hidden_list[$(it).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(it).parent().find('ul').attr('id')] == false)
|
||||
{
|
||||
$(it).parent().find('.hiddable').hide();
|
||||
$(it).parent().find('.hide-action.less').hide();
|
||||
@@ -221,14 +221,14 @@ function initLayered()
|
||||
|
||||
function paginationButton(nbProductsIn) {
|
||||
$('div.pagination a').not(':hidden').each(function () {
|
||||
if ($(this).prop('href').search('&p=') == -1) {
|
||||
if ($(this).attr('href').search('&p=') == -1) {
|
||||
var page = 1;
|
||||
}
|
||||
else {
|
||||
var page = $(this).prop('href').replace(/^.*&p=(\d+).*$/, '$1');
|
||||
var page = $(this).attr('href').replace(/^.*&p=(\d+).*$/, '$1');
|
||||
}
|
||||
var location = window.location.href.replace(/#.*$/, '');
|
||||
$(this).prop('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
|
||||
$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
|
||||
});
|
||||
$('div.pagination li').not('.current, .disabled').each(function () {
|
||||
var nbPage = 0;
|
||||
@@ -251,7 +251,8 @@ function paginationButton(nbProductsIn) {
|
||||
|
||||
|
||||
//product count refresh
|
||||
|
||||
if(nbProductsIn!=false){
|
||||
if(isNaN(nbProductsIn) == 0) {
|
||||
// add variables
|
||||
var productCountRow = $('.product-count').html();
|
||||
var nbPage = parseInt($('div.pagination li.current').children().children().html());
|
||||
@@ -271,37 +272,43 @@ function paginationButton(nbProductsIn) {
|
||||
productCountRow[5] = nb_products;
|
||||
productCountRow = productCountRow.join(' ');
|
||||
$('.product-count').html(productCountRow);
|
||||
$('.product-count').show();
|
||||
}
|
||||
else {
|
||||
$('.product-count').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelFilter()
|
||||
{
|
||||
$('#enabled_filters a').live('click', function(e)
|
||||
{
|
||||
if ($(this).prop('rel').search(/_slider$/) > 0)
|
||||
if ($(this).attr('rel').search(/_slider$/) > 0)
|
||||
{
|
||||
if ($('#'+$(this).prop('rel')).length)
|
||||
if ($('#'+$(this).attr('rel')).length)
|
||||
{
|
||||
$('#'+$(this).prop('rel')).slider('values' , 0, $('#'+$(this).prop('rel')).slider('option' , 'min' ));
|
||||
$('#'+$(this).prop('rel')).slider('values' , 1, $('#'+$(this).prop('rel')).slider('option' , 'max' ));
|
||||
$('#'+$(this).prop('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).prop('rel')).slider( 'option' , 'min' ), $('#'+$(this).prop('rel')).slider( 'option' , 'max' )]});
|
||||
$('#'+$(this).attr('rel')).slider('values' , 0, $('#'+$(this).attr('rel')).slider('option' , 'min' ));
|
||||
$('#'+$(this).attr('rel')).slider('values' , 1, $('#'+$(this).attr('rel')).slider('option' , 'max' ));
|
||||
$('#'+$(this).attr('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).attr('rel')).slider( 'option' , 'min' ), $('#'+$(this).attr('rel')).slider( 'option' , 'max' )]});
|
||||
}
|
||||
else if($('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).length)
|
||||
else if($('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).length)
|
||||
{
|
||||
$('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).prop('rel').replace(/_slider$/, '_range_min')).prop('limitValue'));
|
||||
$('#'+$(this).prop('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).prop('rel').replace(/_slider$/, '_range_max')).prop('limitValue'));
|
||||
$('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).attr('rel').replace(/_slider$/, '_range_min')).attr('limitValue'));
|
||||
$('#'+$(this).attr('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).attr('rel').replace(/_slider$/, '_range_max')).attr('limitValue'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($('option#'+$(this).prop('rel')).length)
|
||||
if ($('option#'+$(this).attr('rel')).length)
|
||||
{
|
||||
$('#'+$(this).prop('rel')).parent().val('');
|
||||
$('#'+$(this).attr('rel')).parent().val('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#'+$(this).prop('rel')).prop('checked', false);
|
||||
$('.'+$(this).prop('rel')).prop('checked', false);
|
||||
$('#layered_form input[type=hidden][name='+$(this).prop('rel')+']').remove();
|
||||
$('#'+$(this).attr('rel')).attr('checked', false);
|
||||
$('.'+$(this).attr('rel')).attr('checked', false);
|
||||
$('#layered_form input[type=hidden][name='+$(this).attr('rel')+']').remove();
|
||||
}
|
||||
}
|
||||
reloadContent();
|
||||
@@ -315,13 +322,13 @@ function openCloseFilter()
|
||||
{
|
||||
if ($(this).html() == '<')
|
||||
{
|
||||
$('#'+$(this).prop('rel')).show();
|
||||
$('#'+$(this).attr('rel')).show();
|
||||
$(this).html('v');
|
||||
$(this).parent().removeClass('closed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#'+$(this).prop('rel')).hide();
|
||||
$('#'+$(this).attr('rel')).hide();
|
||||
$(this).html('<');
|
||||
$(this).parent().addClass('closed');
|
||||
}
|
||||
@@ -354,7 +361,7 @@ function reloadContent(params_plus)
|
||||
var sliderStart = $(this).slider('values', 0);
|
||||
var sliderStop = $(this).slider('values', 1);
|
||||
if (typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
|
||||
data += '&'+$(this).prop('id')+'='+sliderStart+'_'+sliderStop;
|
||||
data += '&'+$(this).attr('id')+'='+sliderStart+'_'+sliderStop;
|
||||
});
|
||||
|
||||
$(['price', 'weight']).each(function(it, sliderType)
|
||||
@@ -366,9 +373,9 @@ function reloadContent(params_plus)
|
||||
});
|
||||
|
||||
$('#layered_form .select option').each( function () {
|
||||
if($(this).prop('id') && $(this).parent().val() == $(this).val())
|
||||
if($(this).attr('id') && $(this).parent().val() == $(this).val())
|
||||
{
|
||||
data += '&'+$(this).prop('id') + '=' + $(this).val();
|
||||
data += '&'+$(this).attr('id') + '=' + $(this).val();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -465,7 +472,7 @@ function reloadContent(params_plus)
|
||||
val = $('div.pagination .js-nb_item').val();
|
||||
$('div.pagination .js-nb_item').children().each(function(it, option) {
|
||||
if (option.value == val)
|
||||
$(option).prop('selected', true);
|
||||
$(option).attr('selected', true);
|
||||
else
|
||||
$(option).removeAttr('selected');
|
||||
});
|
||||
@@ -557,7 +564,7 @@ function updateProductUrl()
|
||||
'ul.product_list li.ajax_block_product h5 a,'+
|
||||
'ul.product_list li.ajax_block_product .product_desc a,'+
|
||||
'ul.product_list li.ajax_block_product .lnk_view'), function() {
|
||||
$(this).prop('href', $(this).prop('href') + param_product_url);
|
||||
$(this).attr('href', $(this).attr('href') + param_product_url);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user