Hey,
is it possible to hide the cart module when there is no product in and show it as soon as the customer adds something to the cart?
I tried the Advanced Module Manager with a php session query but that doesn't work at all because i don't know the right variable.
Thanks for your help!
Same question...
There are a few ways to tackle this, depending if you want to hide the module content or hide the whole module position and collapse it.
To hide the 'no products' message, open mod_virtuemart_cart.php around line 40 you will see else
else $data->totalProductTxt = JText::_('COM_VIRTUEMART_EMPTY_CART');
that displays the empty cart message, get rid of it or replace it as you see fit.
To collapse the whole module position, make a position only for the cart in your template, something like
<jdoc:include type="modules" name="vm_cart" />
(note, you will have to add this to your templates XML too
then load the VM functions, get the cart, prep the data and test the same way as in the module.
<?php
if (!class_exists( 'VmConfig' )) require(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'.DS.'helpers'.DS.'config.php');
if(!class_exists('VirtueMartCart')) require(JPATH_VM_SITE.DS.'helpers'.DS.'cart.php');
$cart = VirtueMartCart::getCart(false);
$data = $cart->prepareAjaxData();
if ($data->totalProduct>1) echo "There is more than one, display the jdoc module include code here";
else if ($data->totalProduct == 1) echo "There is only one, display the jdoc module include code for single here";
else echo "No products, don't display the include code";
?>
its a little hacky but works OK. Copy/paste it into the top of your template and check it out.