Jump to content

Cart block not updating productline when ajax is on


Recommended Posts

I have a fresh installation of Prestashop 1.5.4.1 with default theme.

 

I have added the cart_block to my display right column,

 

My problem is following:

If my cart is empty, and add a product to it, the ammount and shipping is being updated, but the productline stays on "no products". If I go to another page, the product line is being updated.

 

If I have products in the cart, there seems to be no problems.

 

If I delete my products from the cart, the line of "no products" doesn't come back.

 

Any Idears ?

 

url to my testsite is www.gnubbi.dk/shop

Edited by thenox (see edit history)
Link to comment
Share on other sites

I can confirm I'm seeing the same problem. The basket in the header updates but the block in the right column does not.

 

If you remove the cartblock hook from displayTop, then the cart block in the right column will correctly update BUT hovering over the cart in the header will no longer work.

 

It would seem you can not have both working at the same time. I would guess the ajax is getting conflicted on which id to update.

 

It would be very useful to have both working.

Link to comment
Share on other sites

Hello all,

 

I've been searching for a solution for this exact same problem... But it only happens with the ajax_add_to_cart_button. The input in the product page doesn't create the same issue.

 

Everything works fine with the top cart module, adding, deleting, hovering, all. Every action on the cart products happens instantly without any problem. But with the right module, if it's empty, the values update but the "No Product" line remains. And if I delete all the products, this line won't come back in... Only if the cart already has at least one product and I add another one, it updates. But it won't update back to the "No Products" if I delete all of them.

 

It's just a question of updating the product lines in the right cart module, because in the values lines and in the top module, all the information is there and accurate.

 

Here's the link if you want to check it out: http://174.132.166.124/~virtuall/loja/br/ (it's in portuguese and it's still in development). The ajax_add_to_cart_button shows up when you hover the images in the homefeatured module. It's the green square on the right.

 

I've been playing a bit around the homefeatured.tpl and the ajax_cart.js but couldn't solve it. Really need a hand here.

 

Ah! Here's the code in the homefeatured.tpl:

 

<div class="img_align_center">

{if (($product.id_product_attribute == 0) || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && ($product.minimal_quantity == 1) && ($product.customizable != 2) && !$PS_CATALOG_MODE}

<div class="hover_over" style="position:relative;">

<a class="product-cart" href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}"></a>

{if ($product.quantity > 0 OR $product.allow_oosp)}

<a class="product-testar ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')}?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart'}"></a>

{else}

<span class="exclusive">{l s='Add to cart' mod='homefeatured'}</span>

{/if}

{/if}

</div>

<a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image">

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />

</a>

</div>

 

Thanks!

  • Like 1
Link to comment
Share on other sites

without modification of the ajaxcart js file it isn't possible. moreover, it will be problematic while, for example, you will remove the products etc.

 

Having had a play about with the javascript today, I'd agree. I've ditched the header hook and what happens is the cart block in the header will update the number of items just fine but hovering stops working. You can still click on it to go to the cart page. The cartblock in the right column also works great too. On the site I'm working on, since it's a grocery store, it's more important that the shopper sees a list of items, like a till receipt, than hover working on the header.

Link to comment
Share on other sites

Hi!

 

vekia, nevermind... I noticed now that I'm experienced the same as aegisdesign... I remove the hook from displaytop, that's why the right module started working ok. However, just as him, the hovering function on the top module stopped working. :(

 

Fortunately for me, my client wants a fully functional right cart module and on the top having the product quantity shown is enough.

 

However, having all of them working fine would be the perfect scenario. Still no solution right?

Link to comment
Share on other sites

  • 1 month later...

Hi!

 

vekia, nevermind... I noticed now that I'm experienced the same as aegisdesign... I remove the hook from displaytop, that's why the right module started working ok. However, just as him, the hovering function on the top module stopped working. :(

 

Fortunately for me, my client wants a fully functional right cart module and on the top having the product quantity shown is enough.

 

However, having all of them working fine would be the perfect scenario. Still no solution right?

Having the same issue :( any update with the bug?

Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

It's not a bug really. It's just not designed to work that way. The code only lets you have the cart in one location, not two.

 

hi i have the same problem.. after update to newer version of ps i'm now using1.5.6.2  it worked with 1.5.0  so the in "one location" comment ..is not correct.. 

 

anyway.. icannot get it resolved.. if i add a product to the cart.. the cart does not update correctly in the right column (it states no products)

if u update the page.. then its in the cart on the right site.. and every product u add from then.. will appear coorectly in both carts

 

But still cannot find a solution

 

grtz

http://www.deonderdelenshop.be

Link to comment
Share on other sites

  • 3 months later...
  • 7 months later...
×
×
  • Create New...