Jump to content

Show blockcart if at least 1 product


Recommended Posts

Hi,

 

I've already seen my problem on different topics, but couldn't find any working solution. Is it possible to show the blockcart module only when the user adds a product in it ?

 

I've tried to modify blockcart.php by adding :

 

global $cart; if (count($cart->getProducts()) == 0) return;

 

But that didn't do the trick, the page needs to be refreshed.

 

I've also removed the "return;" in ajax-cart.js line 140, didn't work either.

 

Any ideas ?

 

Thanks,

Link to comment
Share on other sites

You can add the css propertie "display:none" to the cart module, and change it automatically with the javascript function that adds a product to the cart.By this way the cart is not showed until a product is added.

 

To show permanently the cart when loading other page you can add a conditional to the blockcart module tpl file, something like if there is no products, aply class "display:none",else a "display:block".

 

Hope it helps you.

Link to comment
Share on other sites

×
×
  • Create New...