Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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

Edited By: roonie
02-Aug-10 15:59:12

roonie
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Virtuemart : how to detect manufacturer_id?

Hello Stephen,

As I was using version 2.2, I did not know the existence of JomGenius.
I updated to latest version and your code works perfectly.

Thank you very much!

Steven

roonie
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

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

erichartley
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Virtuemart : how to detect manufacturer_id?

Excellent - works perfectly. Thanks very much for the great support!

erichartley
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1691
Total Polls:
6
Total Posts:
5912
Total Posts Today:
6
User Info:
 
Total Users:
11527
Newest User:
david9684
Members Online:
0
Guests Online:
202

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked