Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » virtumart product module
virtumart product module
virtumart product module
Hi i have see some php for metamod to change category filter in product module with the category id you are view. In my case i want to put in category filter id from an child category becose in parent categories have no product to show. It is this posible.
Thank you
Re: virtumart product module
$vm = JomGenius("virtuemart");
$cat = $vm->info("category_id");
if ($cat and $vm->check("pagetype startswith productdetails") ) {
$changes->mod(109)->setParam("virtuemart_category_id",$cat);
return 109;
}
This is the code i have see in that post http://www.metamodpro.com/forums/topic?id=1274#p5804
Thank you
Re: virtumart product module
Ok, thanks for the code. Now let's narrow down exactly what you want to do.
So, is the user viewing a category or a product at this point?
- if they are viewing a product, then we can assume that there is a product in that category, and the code above will work fine (inserts the current category into the filter module).
- if they are viewing a category, then they may be viewing an empty one, in which case you want the filter to show a child category, which I assume will contain some products, right?
If you don't have too many categories, it might work best to do this the brute-force way: simply have a series of tests to see if the current category is "X" (one of the empty upper-level categories) and if detected, then set the category to "Y" which is one of its children that you know to have products.
e.g. let's say category 5 has no direct products, but it has a subcategory 23 which does.
Same for category 7, has subcat 27 with some products.
$vm = JomGenius("virtuemart");
$cat = $vm->info("category_id");
$changeto = null;
if ($cat == 5 ) $changeto = 23;
if ($cat == 7 ) $changeto = 27;
// ... add more as required...
// if it wasn't on one of the empty ones, set it to the current category
if ($changeto == null) $changeto = $cat;
// then insert it into the module
$changes->mod(109)->setParam("virtuemart_category_id",$changeto);
// and display the module.
return 109;
Re: virtumart product module
Ok, so tell me, how might you be able to distinguish when you are on an empty category? And how far down the category tree are you going to need to go in order to find the category that you want to display?
e.g. are all 1st-level and 2nd-level categories empty, and 3rd-level categories have products in them? Or is it different in every case? Somehow you're/we're going to need to code this, and any patterns in the data like this will help.
Thanks,
Stephen
Re: virtumart product module
That makes sense, thanks.
Next questions (sorry so many questions):
If your "top" level has 3 categories (cat 1, 2, 3)
... and each of those has 3 categories (1a, 1b, 1c, 2a, 2b, 2c, 3a, 3b, 3c)
... and each of those 9 categories has some products in it,
then if a user is viewing the very top level, or category 1, 2 or 3, then which category's products should the module show?
e.g. if the user is viewing category 1, should the module show products from 1a, 1b or 1c?
And can the module that you are talking about display products from more than 1 category? What's the name of the module, so I can check it out?
Re: virtumart product module
I haven't find a module that can display products from multiple categories all modules i have try they work like the virtuemart default module.The only solution is to display some products from a random subcategory and not from all subcategoris, i think.
Thank you
- Index
- » MetaMod
- » MetaMod General Support
- » virtumart product module
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7627
- Newest User:
- rudys68879
- Members Online:
- 0
- Guests Online:
- 186
- 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