Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Virtuemart : how to detect...
Virtuemart : how to detect manufacturer_id?
Virtuemart : how to detect manufacturer_id?
Hello,
First of all, congratulations for this excellent module that helped me in many of my projects.
I wish to detect the manufacturer_id on Virtuemart product pages (shop.product_details) and to display all modules related to this manufacturer.
Might there be a (simple) recipe for this?
Thanks
Steven
02-Aug-10 15:59:12
Re: Virtuemart : how to detect manufacturer_id?
Hi Steve,
I just realised that even my new JomGenius code for working with VM doesn't give you that info, so I'm going to have to add it soon.
Meanwhile you should be able to do this:
$vm = JomGenius("virtuemart");
if ($vm && $vm->check("pagetype = shop.product_details") ) {
$query = "select manufacturer_id from #__vm_product_mf_xref where product_id = " . JRequest::getInt("product_id");
$db->setQuery( $query );
$m_id = $db->loadResult();
if ($m_id == 1) return XXX; // replace XXX with list of modules for manufacturer 1, e.g. return "101,102,103"
}
Hope that helps,
Stephen
Re: Virtuemart : how to detect manufacturer_id?
Hi Stephen
Firstly, congratulations on a really, really, powerful module. Such a great piece of work.
I have a similar issue to above, but I want to display modules only on particular Virtumart manufacturer browse pages - URLs like: index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=3
I've tried modifying your code above but I'm obviously doing something wrong somewhere! Can you help?
Thanks
Eric
Re: Virtuemart : how to detect manufacturer_id?
Try this:
$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.browse") and JRequest::getInt("manufacturer_id",0) == 3 ) return XXX;
// replace XXX with the module id to use for manufacturer id 3
Re: Virtuemart : how to detect manufacturer_id?
By the way, the new version of MetaMod released today (v2.5) does this even better:
$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.browse") and $vm->check("manufacturer_id = 3" ) ) return XXX;
// replace XXX with the module id to use for manufacturer id 3
The "manufacturer_id" support is now built-in to JomGenius. In fact you can now query by the manufacturer name ("manufacturer_name contains ACME" for example), or manufacturer category. There's more info about all the options you've got for targetting VirtueMart pages with JomGenius, here: http://www.metamodpro.com/jomgenius/par … andcheckvm
- Index
- » MetaMod
- » MetaMod General Support
- » Virtuemart : how to detect...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8027
- Newest User:
- henley7346
- Members Online:
- 1
- Guests Online:
- 198
- Online:
- henley7346
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked