Posted by: metamodguy on Sep 06, 2010
Four updates in one day!
- MetaMod v2.5
- MetaMod Pro v2.5
- MetaTemplate v1.6
- MetaTemplate Pro v1.6
MetaMod Pro and MetaTemplate Pro customers: download your FREE upgrade! Go to your My Account page, view your order, and download the new version.
Apart from a few bug fixes (e.g. MetaMod Pro fixes compatibility with Advanced Module Manager), most of the excitement in these releases is down to one thing: VirtueMart.
I’ve been working hard on improving VirtueMart support in all these products. There are so many different scenarios in VirtueMart where people want to be able to switch templates, or target particular modules.
If you’re already familiar with JomGenius, you can get all the techy info on the JomGenius parameters page.
MetaTemplate Pro adds a useful selection of these to the GUI controls, but the full power comes if you’re willing to write a little PHP...
At the start of any rule you always need to create the $vm object:
$vm = JomGenius("virtuemart");
vm front page
Detect the VM "front page" (as opposed to the Joomla frontpage view):
if ($vm->check("pagetype = frontpage") ) return XXX;
Now, some people were asking to be able to place modules, or switch templates, depending on the manufacturer of the product being viewed, or on manufacturer “browse” pages. This is now built-in. You can query my manufacturer id or name, or even the manufacturer category id or name.
if ($vm->check("manufacturer_name contains ACME") ) return XXX;
If you’re using that in MetaMod, then replace XXX with the module id you want to display. In MetaTemplate / MetaTemplate Pro, replace XXX with true to make the rule succeed.
Is product in stock?
You may want to place a certain module on the page if a product is out of stock. You may even want to use a completely different Joomla template...
if ($vm->check("pagetype = shop.product_details") and $vm->check("product_in_stock = 0") ) return XXX;
Perhaps you want to put a "low stock" warning in a module on the page:
if ($vm->check("pagetype = shop.product_details")
and $vm->check("product_in_stock > 0")
and $vm->check("product_in_stock < 10" ) ) return XXX;
There are now over 50 different parameters you can query on the $vm object, so however you use VirtueMart there’s bound to be a way to target modules and/or templates onto your pages. If you’re stuck, head over to the forum, see if anyone else has tried it, and ask about what you’re trying to achieve.