diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index c37e999e1..ac7ae9856 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -42,7 +42,7 @@ var ajaxCart = { return false; }); //for product page 'add' button... - $('body#product p#add_to_cart input').unbind('click').click(function(){ + $('#add_to_cart input').unbind('click').click(function(){ ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null); return false; }); @@ -95,18 +95,18 @@ var ajaxCart = { // try to expand the cart expand : function(){ - if ($('#cart_block #cart_block_list').hasClass('collapsed')) + if ($('#cart_block_list').hasClass('collapsed')) { - $('#header #cart_block #cart_block_summary').slideUp(200, function(){ + $('#cart_block_summary').slideUp(200, function(){ $(this).addClass('collapsed').removeClass('expanded'); - $('#header #cart_block #cart_block_list').slideDown({ + $('#cart_block_list').slideDown({ duration: 450, complete: function(){$(this).addClass('expanded').removeClass('collapsed');} }); }); // toogle the button expand/collapse button - $('#cart_block h4 span#block_cart_expand').fadeOut('slow', function(){ - $('#cart_block h4 span#block_cart_collapse').fadeIn('fast'); + $('#block_cart_expand').fadeOut('slow', function(){ + $('#block_cart_collapse').fadeIn('fast'); }); // save the expand statut in the user cookie @@ -139,16 +139,16 @@ var ajaxCart = { // try to collapse the cart collapse : function(){ - if ($('#cart_block #cart_block_list').hasClass('expanded')) + if ($('#cart_block_list').hasClass('expanded')) { - $('#header #cart_block #cart_block_list').slideUp('slow', function(){ + $('#cart_block_list').slideUp('slow', function(){ $(this).addClass('collapsed').removeClass('expanded'); - $('#header #cart_block #cart_block_summary').slideDown(450, function(){ + $('#cart_block_summary').slideDown(450, function(){ $(this).addClass('expanded').removeClass('collapsed'); }); }); - $('#cart_block h4 span#block_cart_collapse').fadeOut('slow', function(){ - $('#cart_block h4 span#block_cart_expand').fadeIn('fast'); + $('#block_cart_collapse').fadeOut('slow', function(){ + $('#block_cart_expand').fadeIn('fast'); }); // save the expand statut in the user cookie @@ -168,7 +168,7 @@ var ajaxCart = { //reactive the button when adding has finished if (addedFromProductPage) - $('body#product p#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled'); + $('#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled'); else $('.ajax_add_to_cart_button').removeAttr('disabled'); }, @@ -184,13 +184,13 @@ var ajaxCart = { //disabled the button when adding to do not double add if user double click if (addedFromProductPage) { - $('body#product p#add_to_cart input').attr('disabled', true).removeClass('exclusive').addClass('exclusive_disabled'); + $('#add_to_cart input').attr('disabled', true).removeClass('exclusive').addClass('exclusive_disabled'); $('.filled').removeClass('filled'); } else $(callerElement).attr('disabled', true); - if ($('#cart_block #cart_block_list').hasClass('collapsed')) + if ($('#cart_block_list').hasClass('collapsed')) this.expand(); //send the ajax request to the server $.ajax({ @@ -240,7 +240,7 @@ var ajaxCart = { alert("Impossible to add the product to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText); //reactive the button when adding has finished if (addedFromProductPage) - $('body#product p#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled'); + $('#add_to_cart input').removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled'); else $(callerElement).removeAttr('disabled'); } @@ -269,7 +269,7 @@ var ajaxCart = { //hide the products displayed in the page but no more in the json data hideOldProducts : function(jsonData) { //delete an eventually removed product of the displayed cart (only if cart is not empty!) - if ($('#cart_block #cart_block_list dl.products').length > 0) + if ($('#cart_block_list dl.products').length > 0) { var removedProductId = null; var removedProductData = null; @@ -309,13 +309,13 @@ var ajaxCart = { // If the cart is now empty, show the 'no product in the cart' message and close detail if($('#cart_block dl.products dt').length == 0) { - $("#header #cart_block").stop(true, true).slideUp(200); - $('p#cart_block_no_products:hidden').slideDown(450); - $('div#cart_block dl.products').remove(); + $("#cart_block").stop(true, true).slideUp(200); + $('#cart_block_no_products:hidden').slideDown(450); + $('#cart_block dl.products').remove(); } }); }); - $('dd#cart_block_combination_of_' + ids[0] + (ids[1] ? '_'+ids[1] : '') + (ids[2] ? '_'+ids[2] : '')).fadeTo('fast', 0, function(){ + $('#cart_block_combination_of_' + ids[0] + (ids[1] ? '_'+ids[1] : '') + (ids[2] ? '_'+ids[2] : '')).fadeTo('fast', 0, function(){ $(this).slideUp('fast', function(){ $(this).remove(); }); @@ -328,7 +328,7 @@ var ajaxCart = { hideOldProductCustomizations : function (product, domIdProduct) { - var customizationList = $('#cart_block #cart_block_list ul#customization_' + product['id'] + '_' + product['idCombination']); + var customizationList = $('#customization_' + product['id'] + '_' + product['idCombination']); if(customizationList.length > 0) { $(customizationList).find("li").each(function(){ @@ -400,7 +400,7 @@ var ajaxCart = { // Update product quantity updateProductQuantity : function (product, quantity) { - $('dt#cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0')+ '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + ' .quantity').fadeTo('fast', 0, function() { + $('#cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0')+ '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + ' .quantity').fadeTo('fast', 0, function() { $(this).text(quantity); $(this).fadeTo('fast', 1, function(){ $(this).fadeTo('fast', 0, function(){ @@ -424,16 +424,16 @@ var ajaxCart = { if (this.id != undefined) { //create a container for listing the products and hide the 'no product in the cart' message (only if the cart was empty) - if ($('div#cart_block dl.products').length == 0) + if ($('#cart_block dl.products').length == 0) { - $('p#cart_block_no_products').before('