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.

 

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

patben
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: virtumart product module

Can you point me to the PHP code you were looking at? That would be a huge help.

Thanks,
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: 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

patben
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

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;

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: virtumart product module

Thank you, in my case that is not very useful because i have a lot of categories.

patben
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

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

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: virtumart product module

yes, all 1st-level and 2nd-level categories empty, and 3rd-level categories have products in them. I want in every empty category because it isn't have product to display some products from the child categories.

patben
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

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?

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: 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

patben
Beginner Modder
ranks
useravatar
Offline
12 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:
1
Guests Online:
179

Online: 
david9684

Forum Legend:

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