Skip to content

Commit

Permalink
[*] MO : blockcart - simpler selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Grégoire Bélorgey committed May 28, 2013
1 parent 3c129a0 commit 1652f35
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions modules/blockcart/ajax-cart.js
Expand Up @@ -313,7 +313,7 @@ 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);

This comment has been minimized.

Copy link
@gRoussac

gRoussac Oct 10, 2013

Contributor

Hi,

header selector was totaly required here and below ! This created a regression from commit of http://forge.prestashop.com/browse/PSCFV-7495 reported again here http://forge.prestashop.com/browse/PSCFV-10497

Best regards

This comment has been minimized.

Copy link
@gbelorgey

gbelorgey Oct 10, 2013

This seems surprising, and would imply that #cart_block is not unique, which should not happen. I'll have a look as soon as I get the chance.

This comment has been minimized.

Copy link
@gRoussac

gRoussac Oct 10, 2013

Contributor

Hi,

It can be hooked in the right column and a mouseover will withdraw it, removing product will sliding it up.

In the colmun, we do not want this module to slide up or down.

Please see forge tracks about it.

Best regards

This comment has been minimized.

Copy link
@gbelorgey

gbelorgey Oct 11, 2013

Ok, got it, thanks !

$("#cart_block").stop(true, true).slideUp(200);
$('#cart_block_no_products:hidden').slideDown(450);
$('#cart_block dl.products').remove();
}
Expand Down Expand Up @@ -377,7 +377,7 @@ var ajaxCart = {
else
{
$('#vouchers tbody').html('');

for (i=0;i<jsonData.discounts.length;i++)
{
if (parseFloat(jsonData.discounts[i].price_float) > 0)
Expand Down Expand Up @@ -428,7 +428,7 @@ 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 ($('#cart_block dl.products').length == 0)
{
$('#cart_block_no_products').before('<dl class="products"></dl>');
Expand All @@ -445,7 +445,7 @@ var ajaxCart = {
content += '<span class="quantity-formated"><span class="quantity">' + this.quantity + '</span>x</span>';
var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name);
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';

if (parseFloat(this.price_float) > 0)
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
else
Expand Down Expand Up @@ -595,7 +595,7 @@ var ajaxCart = {
//update general cart informations everywhere in the page
updateCartEverywhere : function(jsonData) {
$('.ajax_cart_total').text($.trim(jsonData.productTotal));

if (parseFloat(jsonData.shippingCostFloat) > 0 || jsonData.nbTotalProducts < 1)
$('.ajax_cart_shipping_cost').text(jsonData.shippingCost);
else if (typeof(freeShippingTranslation) != 'undefined')
Expand All @@ -605,7 +605,7 @@ var ajaxCart = {
$('.ajax_block_cart_total').text(jsonData.total);

this.nb_total_products = jsonData.nbTotalProducts;

if (parseInt(jsonData.nbTotalProducts) > 0)
{
$('.ajax_cart_no_product').hide();
Expand Down Expand Up @@ -689,10 +689,10 @@ $(document).ready(function(){
$("#cart_block").stop(true, true).slideDown(450);
},
function() {
$('#header #shopping_cart a').css('border-radius', '3px');
$('#shopping_cart a').css('border-radius', '3px');
setTimeout(function() {
if (!shopping_cart.isHoveringOver() && !cart_block.isHoveringOver())
$("#header #cart_block").stop(true, true).slideUp(450);
$("#cart_block").stop(true, true).slideUp(450);
}, 200);
}
);
Expand All @@ -705,17 +705,17 @@ $(document).ready(function(){
$('#shopping_cart a').css('border-radius', '3px');
setTimeout(function() {
if (!shopping_cart.isHoveringOver())
$("#header #cart_block").stop(true, true).slideUp(450);
$("#cart_block").stop(true, true).slideUp(450);
}, 200);
}
);

$('.delete_voucher').live('click', function() {
$.ajax({
type: 'POST',
type: 'POST',
headers: { "cache-control": "no-cache" },
async: true,
cache: false,
cache: false,
url:$(this).attr('href') + '?rand=' + new Date().getTime()
});
$(this).parent().parent().remove();
Expand Down

0 comments on commit 1652f35

Please sign in to comment.