Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod Feature Requests
- » [solved] Product type/parameter value
[solved] Product type/parameter value
[solved] Product type/parameter value
Hello
I have been using Metamod and Chameleon for 5 years and I am happy with it. I have roughly 20000 bookss in structure 3Product types/12parameter names/300+ parameter values and using product type id for switching templates. Now I want to write a new script with parameter value or parameter name but I did not find anything in forum.
Is it possible to use parameter_values for switching modules ( in my case for exmple country name or book author ) ? Do I need to import those variable from virtuemart ?
Plese help
Daniel
Re: [solved] Product type/parameter value
Hi Daniel,
could you describe for me what kind of parameters these are? Some sort of custom parameters in VM? And what version of Joomla and VM?
Thanks,
Stephen
Re: [solved] Product type/parameter value
Hi,
it took me a while to get these versions of Joomla and VM installed for testing, but I got there :-)
I then had to look in the database table "jos_vm_product_type_parameter" to see what ID number the parameter is stored as. e.g.
product_type_id: 4
parameter_name: size
So in my test case, the id number is 4. Now I have to use this to construct another table name, "jos_vm_product_type_4" using the id number 4 at the end.
Now that I have this table name I can query this table to see what the parameter value is for a particular product. To get the product ID number I can use JomGenius, when I am on a VM product page.
e.g.
$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.product_details")) {
$prod_id = $vm->info("product_id");
$query = "select size ".
"from jos_vm_product_type_4 where product_id = " . (int)$prod_id;
$sql->setQuery($query);
$result = $sql->loadResult();
if ($result == "large") return XXX:
if ($result == "medium") return YYY:
if ($result == "small") return YYY:
// replace XXX, YYY, ZZZ with the module ids of the modules to use
// for the relevant sizes.
}
Now I can see from your original forum post that your situation is more complex, with more parameters etc. Can you give a few real examples of these values and I should be able to suggest modifications to my code above that are more suited to your situation.
Best regards,
Stephen
Re: [solved] Product type/parameter value
Hi
I am sorry for late response but I just came from holiday.
Basically I know how to do it using following script.
$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ($option == "com_virtuemart") {
$country = JRequest::getVar("krajina");
$page = JRequest::getVar("page");
if ($page == "shop.browse") {
if ($country == "Andorra") return "AAA";
if ($country == "Angola") return "BBB";
if ($country == "Egypt") return "CCC";
/* when browsing any other country on browse page */
return "DDD";
}
}
I understood that parametervalue in my case "krajina" is managed by product filter. module. I just use getVar("krajina") when customer select country from product filter.
Finally I prepare various modules for every country.
Anyway thank you for your help
Daniel
- Index
- » MetaMod
- » MetaMod Feature Requests
- » [solved] Product type/parameter value
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7638
- Newest User:
- moner86658
- Members Online:
- 0
- Guests Online:
- 116
- 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