|Display Modules when Products are in the Cart|
|Written by Thomas Kahl|
|Friday, 29 July 2011 08:58|
Sometimes you may want to show a module only when the user has products added to the cart. With the "Advanced Modulemanager" from NoNumber.nl this is very simple. Just open the module in the module manager, open the slider "Module Assignment" and scroll down to the last entry in the list. This should be "PHP". Click on the first radio-option. Now there should be a textbox where you can enter php-code. Just type this simple line:
and save the module. From now on, the module will appear only when the user has added at least one product to the cart.
[UPDATE] In Virtuemart 2.0, the cart is stored in a different way. This solution will not work in Virtuemart 2.0. You can check the file mod_virtuemart_cart.php to see how the content of the cart is checked (see $data->totalProduct).
VM-Expert.com is part of the B01 Consulting Network. Since 2003 we build shops and websites with Joomla and Virtuemart. We are specialised in developing custom Joomla and Virtuemart Extensions.