News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Controlling modules on VM pages

Started by EvanGR, July 29, 2019, 10:41:02 AM

Previous topic - Next topic

EvanGR

I need some direction on how to control joomla module visibility on VM pages (e.g. product, category etc..) programmatically. In other words, with template code only, no 3rd party extensions.

Thanks

StefanSTS

#1
You could place something like this in your product or category layouts.

EDIT: this was used in older Joomla versions, it still works.

$doc = JFactory::getDocument();
$renderer = $doc->loadRenderer('modules');
$position = 'vm-product-bottom';
$options  = array('style' => 'raw');
echo $renderer->render($position, $options, null);


The newer J3 uses:

$modules  = JModuleHelper::getModules("vm-product-bottom");
$doc = JFactory::getDocument();     
$attribs  = array();
$attribs['style'] = 'raw';

foreach ($modules as $mod) {
    echo JModuleHelper::renderModule($mod, $attribs);
}


Add the echo in the place you want the module to appear.

Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

PRO