Display Modules when Products are in the Cart
Written by Thomas Kahl   
Friday, 29 July 2011 08:58

php_module_setting

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:

return $_SESSION['cart']['idx'];

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).

Trackback(0)
Comments (2)Add Comment

Write comment
smaller | bigger

security code
Write the displayed characters


busy
 

Blog Newsletter

Blog RSS-Feed Click here

Subscribe to our Blog Newsletter

Enter your email address:

Delivered by FeedBurner