Jump to content

ajax cart - not showing products


iheartwine
 Share

Recommended Posts

i wanted to use only collapsed version - just a summary that says how many products + total price are in the basket. unfortunately when i click ADD TO CART, the little cart icon flies to the module but instead of e.g.
1 product - 5$
it gives only:

product

When i reload the page, everything goes fine. What could be the reason? :(

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 6 months later...

if you still have this problem maybe I could help you.

in my case, I have this structure for my mini-cart collapsed, which I moved at the top of page:
1 PRODUCT - TOT: 10 €

in my modules/blockcart/blockart.tpl, at cart_block_summary div I have this:

<!-- block summary -->

       {if $cart_qties > 0}{$cart_qties}{/if}
       {if $cart_qties == 0}{$cart_qties}{/if}
{l s='products' mod='blockcart'}
{l s='product' mod='blockcart'}
{l s='- TOT:' mod='blockcart'} 
       {if $cart_qties > 0}{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false)}{else}{convertPrice price=$cart->getOrderTotal(true)}{/if}{/if}
       {if $cart_qties == 0}{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false)}{else}{convertPrice price=$cart->getOrderTotal(true)}{/if}{/if}
       {if $cart_qties == 0}{if $cart_qties == 0}{l s='No Products' mod='blockcart'}{/if}{/if}
       {if $cart_qties > 0}{if $cart_qties > 0}{l s='No Products' mod='blockcart'}{/if}{/if}



so I've added:

{if $cart_qties == 0}{$cart_qties}{/if}


{l s='- TOT:' mod='blockcart'} 


{if $cart_qties == 0}{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false)}{else}{convertPrice price=$cart->getOrderTotal(true)}{/if}{/if}


{if $cart_qties > 0}{if $cart_qties > 0}{l s='No Products' mod='blockcart'}{/if}{/if}



(of course I have also some css defined to style #cart_block)

then you need to modify modules/blockcart/ajax-cart.js to display - TOT: (or whatever) string correctly
search for updateCartEverywhere function:

//update general cart informations everywere in the page
   updateCartEverywhere : function(jsonData) {
       $('.ajax_cart_total').text(jsonData.productTotal);
       $('.ajax_cart_shipping_cost').text(jsonData.shippingCost);
       $('.cart_block_wrapping_cost').text(jsonData.wrappingCost);
       $('.ajax_block_cart_total').text(jsonData.total);
       if(jsonData.nbTotalProducts > 0)
       {
           $('.ajax_cart_no_product:visible').hide();
           $('.ajax_cart_quantity').text(jsonData.nbTotalProducts);

           $('.ajax_cart_quantity:hidden').fadeIn('slow');
           $('.ajax_cart_total:hidden').fadeIn('slow');

           /*add*/ $('.ajax_cart_total_txt:hidden').fadeIn('slow');

           if(jsonData.nbTotalProducts > 1)
           {
               $('.ajax_cart_product_txt:visible').hide();
               $('.ajax_cart_product_txt_s:hidden').show();
           }
           else
           {
               $('.ajax_cart_product_txt:hidden').fadeIn('slow');
               $('.ajax_cart_product_txt_s:visible').fadeOut('slow');
           }
       }
       else
       {
               /* added , .ajax_cart_total_txt:visible in the next jquery selector, before fadeOut */
               $('.ajax_cart_quantity:visible, .ajax_cart_product_txt_s:visible, .ajax_cart_product_txt:visible, .ajax_cart_total:visible, .ajax_cart_total_txt:visible').fadeOut('slow', function(){
               $('.ajax_cart_no_product:hidden').fadeIn('slow');
           });
       }
   }



hope it helps

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More