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.

 

Display module in a VM Category but not in it's products flypages

Display module in a VM Category but not in it's products flypages

Hello people. I can't find how to make a module appear on the categories pages (the page that lists all the products of a specific virtuemart category) but not on the flypages of this category's products.

for example I can make a module appear in the category "Cars" but then when I click on a car ex. "Mercedes" from this category and go to it's flypage (where the product details are) then the module is still there.


Thanks in advance...!

mandingueiro
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

1 - make sure you are using the most current version of MetaMod. Just install the latest one over the top of the old one to upgrade it.

2 - make sure you are following the Quick Start guide

3 - use the following recipe:

$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.browse") and $vm->check("category_id = WWW") ) return XXX;
// replace WWW with the category id of the "Cars" category
// replace XXX with the module id you want to display on browse pages only, for that category

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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

I am trying to achieve just the opposite... I want my module to appear on both the shop.browse and shop.product_details pages for a designated category.

I'm stumped.

craigascott
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hi Craig, you might want to check the Recipes page for VirtueMart:

http://www.metamodpro.com/metamod/recip … mart-pages

There are so many examples there...

In your case though it's nice and simple:

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details") and $vm->check("category_id = XXX, YYY") ) return ZZZ;

// replace XXX, YYY with the category ids you want to detect. Add more if you want to
// replace ZZZ with the module you want to return on these categories.


If you want to use different modules for different categories, then it's slightly more efficient to do it this way:

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details") ) {
  $cat = $vm->info("category_id");
  if ($cat == WWW) return XXX; // for category id WWW, use module XXX
  if ($cat == YYY) return ZZZ; // for category id YYY, use module ZZZ
  // add more as necessary
}

Cheers,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Dear Stephen,

i stumbled of your modul ´cause of a proposal by a member in the rockettheme forum. Sorry for my question but im not a programmer and i´ve trying a lot of different recipies (in you examples for VM) to get what i want, whitout any result.
i use vm in my page.
i have a module called mod_rokvirtuemart_categories. its like a menue showing the categories i have in VM. his id is 45. it is not asigned to any menue, the postion is left and it is not activated.
i like to show this module on my frontpage (Home) and of course in all categories (and all products i have, lets say always when the user is moving within the shop) i have created categories in VM (id: 6,,7 ...).
i published metamod on the left position and assigned it to the home (frontpage)
i tried what you wrote above

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details") and $vm->check("category_id = XXX, YYY") ) return ZZZ;

of course i have substituted the xxx etc..with my VM categories as you can see:

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details
") and $vm->check("category_id = 6, 7, 9, 13") ) return 45;

but i get no result for hours.
could you please (or somebody else) tell what am im doing wrong?.

im glad about every hint given to me

greetings
guido

jaleo
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hi Guido,

here's a checklist:

1 - ensure that the target module is unpublished etc. (you have done this).
2 - ensure that the MetaMod *is* published and set to some pages. In your case it should be set to display on ALL pages.
3 - to check to see if the MetaMod itself is published, turn on the DEBUG mode in MetaMod - and you should see some output from MetaMod on every page where the MetaMod is assigned.
4 - if you're using a PHP recipe, as you are, ensure you leave the "Quick Module ID include" box empty.

PHP recipes:

When you say "frontpage" do you mean the standard Joomla frontpage (com_content), or are you using the VM frontpage as the front page of your site? These are 2 different things.

To check for the standard Joomla frontpage:

if ($core_genius->check("pagetype = frontpage")) return 45;

After that you probably want to check for any shop.browse or shop.product_details that are in the categories that you want to target: (watch that you don't put any newline characters between the sets of double quotes)

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details") and $vm->check("category_id = 6, 7, 9, 13") ) return 45;

Putting it all together, you'd have this:

Code:

if ($core_genius->check("pagetype = frontpage")) return 45;

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = shop.browse, shop.product_details") and $vm->check("category_id = 6, 7, 9, 13") ) return 45;

This code obviously only displays module 45 when a product from category 6, 7, 9 or 13 is being displayed, or if a product listing from one of those categories is being displayed.

Try that...
Cheers,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hi Stephen!

oh, thanks so much for this; it works now perfect for me!!!!
sorry for my late answer have to work on other thing meanwhile..

And -you are right- im using the joomla com-content frontpage but have as well a menuelink to the standard VM with an overview of all products. can i include this as well?
on the other side i would like to ask you:
is there a way to "autoinclude" all subcategories by default to show this menue, or do i always have when i add a new subcategorie add this subcategory ID as well to the module? i hope you understand what i mean.

stephen, thanks again for you help, you saved my day :-)

greetings from spain
guido

jaleo
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hi Guido,

if you're using a standard VM menu link to a page, then JomGenius calls this the "VM frontpage":

if ($vm->check("pagetype = frontpage") ) return 45;

For the subcategories, yes you can include them too. The JomGenius "category_id" keyword only contains the category that the product is in directly, but the keyword "ancestor_category_ids" contains all the parent categories and grandparent categories etc, all the way up to the top level. So you can use that instead.

if ($vm->check("ancestor_category_ids = 6,7,9,13")) return 45;

All together we have:

Code:

if ($core_genius->check("pagetype = frontpage")) return 45;

$vm = JomGenius("virtuemart");
if ($vm->check("pagetype = frontpage") ) return 45;
if ($vm->check("pagetype = shop.browse, shop.product_details") and $vm->check("ancestor_category_ids = 6, 7, 9, 13") ) return 45;

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
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hello Stephen, nice to hear from you. Little by little im understandig the system. The directlink to my VM frontpage is working now perfectly. My proble is that i do not now Your suggest me:

"...the keyword "ancestor_category_ids" contains all the parent categories and grandparent categories etc, all the way UP to the top level..."

ok, this include the categories above (UP) my subcategories (the parents etc..) what i meant is an automatic inclusion of the "children" (DOWN).
let me explain it ;-):
if "CAT A" has a child (an exisiting one or a new one) show module. Or even more general:
if any CAT has any CHILD include "show module" on this child pages automaticly. i have has a look at the VM parameters here http://www.metamodpro.com/jomgenius/parameters#vmobject but cant see this option. i tried it inverse;
include the highest subcategorie ID to ancestor_category_ids; but this do not work. maybe im confused a little bit roll

maybe you could solve to cut my Gordian knot :-)

best regards
guido

jaleo
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Display module in a VM Category but not in it's products flypages

Hi Guido,

actually, up and down are the same thing, it just depends on your perspective wink

When you check "ancestor_category_ids = XXX", that means that JomGenius makes a list of all the ancestor categories of the current product or category being displayed. If the product is in more than 1 category, the list includes the ancestors of each of the categories that the product is in.

Then, it checks that list against the id that you provide.

So by saying "the list of ancestor categories of this product includes XXX", you are also saying "the current product is a descendent of XXX".

Make sense?

The ancestor_category_ids keyword was added in MetaMod 2.6 which was released last week, so you may need to upgrade to make use of this.

Also, if you have MetaTemplate or MetaTemplate Pro installed, then the JomGenius from these will be used instead of the MetaMod one. And.... they have not been upgraded to the new version with ancestor_category_ids yet. So if it's not working, then that may be the problem. I'll be trying to do a new release of these in the next week, and this will include the new JomGenius code.

Best regards,
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
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5910
Total Posts Today:
1
User Info:
 
Total Users:
10144
Newest User:
leonard5412396
Members Online:
2
Guests Online:
206


Forum Legend:

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