Jump to content

Make ajax_cart_quantity to display 0 when empty


Recommended Posts

Hi, prestashoppers :). I'm trying to make my blockcart to display the number 0 when there's no product on the shopping cart.

 

I got it partially by modifying the blockcart.tpl file and force the display of ajax_cart_quantity when the quantity is equal to 0. The problem is that, when I add a product (1 product in the cart) and then delete it, it still displays the number 1 instead of returning back to 0.

 

I think this has to do with the blockcart.js ajax call, but I'm totally lost on it :/.

 

Any ideas?

 

Thanks in advance :D.

Link to comment
Share on other sites

Hi,

 

if you have changed just the content of the span, not the name of the ID, then it should work, no matter what changes you've done inside span in product.tpl file. Talking from experience, with both PS 1.5. and 1.6.

Could you maybe restore the old blockcart.tpl & change just the content of the span?

Link to comment
Share on other sites

Currently, my code looks like this:

 

<div class="shopping_cart">
     <a href="{$link->getPageLink($order_process, true)|escape:'html':'UTF-8'}" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow">{l s='Carrito de compras:'}</a>
            {if $cart_qties < 10}
            <span class="ajax_cart_quantity" style="position:fixed;margin:-44px 0 0 7px;color:#e80909;font-size:14px;font-weight:bold;font-family:Oswald;">{$cart_qties}</span>
            {else}
            <span class="ajax_cart_quantity" style="position:fixed;margin:-44px 0 0 5px;color:#e80909;font-size:14px;font-weight:bold;font-family:Oswald;">{$cart_qties}</span>
            {/if}
<span class="ajax_cart_total">
{if $cart_qties > 0}
{if $priceDisplay == 1}
{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
{convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)}
{else}
{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
{convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)}
{/if}
{/if}
</span>
 
I'm struggling to make it work with the blockcart.js code >.<.
Link to comment
Share on other sites

As I said before, try restoring the old blockcart.tpl, this one seems to me a bit messed up (for example you have an if statement which gives you the same result, no matter what..

Try replacing it, see if it works then, if so, then the problem is in your current blockcart.tpl file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...