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.

 

Module issues with Virtuemart

Module issues with Virtuemart

I'm having trouble getting my modules to display on specific pages of my site.

First issue:
The site's frontpage is also the Virtuemart frontpage ("home" menu link is set to menu link type virtuemart). On this frontpage I want to display 4 modules, and these are also to appear on all other NON-virtuemart pages.

I've tried various pieces of code from the recipes section but I just can't get it to work :-(

Second Issue
I also want each browse & product details page to have a different module depending on the category. So same mod for browse and prod details page per category. I've managed to achieve this partway, namely for the browsepage, using one of the recipes here:

if ($option == "com_virtuemart") {
$category_id = JRequest::getVar("category_id");
$category = JRequest::getVar("category", null);
$page = JRequest::getVar("page");
if ($page == "shop.browse") {

  if ($category_id == "6") return 49;
if ($category_id == "12") return 53;
if ($category_id == "18") return 54;
if ($category_id == "24") return 55;
if ($category_id == "30") return 56;

}
}
But am stuck on how to achieve the same result on the product details pages.

I'd be really grateful for any help.

Many thanks in advance.

qme1ster
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Module issues with Virtuemart

Hi qme1ster, sorry it's taken a few days to respond.

You'll be pleased to know that there's a really easy way to achieve this in MetaMod. It's so new that the documentation isn't all complete yet (or at least, I haven't updated the old recipes). It's using the new feature called "JomGenius", which makes it a lot easier to target different VM pages.


First issue:

To shown things on the VM frontpage, and all non-VM pages, but no other VM pages, you can do the following:

$vm = JomGenius("virtuemart");
if ($vm and ($option != "com_virtuemart" or $vm->check("pagetype = frontpage") or $vm->page == "shop.index" ) ) return XXX;

Second issue:

$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.product_details, shop.browse") ) {
  $cat = $vm->info("categoryid");
  if ($cat == AAA) return XXX;
  if ($cat == BBB) return YYY;
  if ($cat == CCC) return ZZZ;
  // replace AAA-CCC with the category ids you are checking for
  // replace XXX-ZZZ with the module ids to return for these.
  //... etc etc. Add more rules as appropriate
}

Hope this helps (and works! but it should)
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: Module issues with Virtuemart

Hi Stephen,

Thanks so much for your help. The new recipe for the frontpage (VM/Joomla) worked a treat. However I'm still not getting the correct result with the second issue. Again the mods only appear on the browse page and not on the product details page. I'm not sure what might be causing this problem. It seems to me that the code you supplied should definitely work.

Is there something else I can check or try ?

Thanks again.

qme1ster
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Module issues with Virtuemart

Hi qme1ster,

Perhaps can you use this rule, temporarily? This should put the category id number into the module whenever you're on the product details page or browse page. If you're on a product details page and the category id is not showing up, or the entire "We are on category..." message doesn't show up, then that would help to diagnose what's going on.


$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.product_details, shop.browse") ) {
  $cat = $vm->info("categoryid");
  echo "We are on category: $cat ";
}

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: Module issues with Virtuemart

Thanks Stephen - I've used the code supplied and can confirm that I'm getting the message as described for both the browse and product details pages.

qme1ster
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Module issues with Virtuemart

Hi qme1ster,

ok, if you're getting the correct category ids showing up on both the product details and browse pages, then the original rule I suggested should work properly, as it's based on the same information.

$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.product_details, shop.browse") ) {
  $cat = $vm->info("categoryid");
  if ($cat == AAA) return XXX;
  if ($cat == BBB) return YYY;
  if ($cat == CCC) return ZZZ;
  // replace AAA-CCC with the category ids you are checking for
  // replace XXX-ZZZ with the module ids to return for these.
  //... etc etc. Add more rules as appropriate
}

So if this *isn't* working, then can you describe exactly what's happening? Is one (or more) of those modules not showing up when they should? Double check to see that you have the module id numbers correct, and check the rest of your setup too.

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: Module issues with Virtuemart

Hi Stephen,

Thanks for getting back to me so promptly.

I am perplexed. As you say, and I agree, the code should work. However I'm not getting the correct results.

I have 5 modules, one for each product category and one metaMod containing the following:-

$vm = JomGenius("virtuemart");
if ($vm and $vm->check("pagetype = shop.product_details, shop.browse") ) {
  $cat = $vm->info("categoryid");
  if ($cat == 6) return 49;
  if ($cat == 12) return 53;
  if ($cat == 18) return 54;
  if ($cat == 24) return 55;
  if ($cat == 30) return 56;

}

The correct mod is appearing for each of the category browse pages, so can't be any issue with Cat ID's or mod ID's etc.

Furthermore no issue with URL's. Sample URL for product details page as follows:

mydomain.com/index.php?page=shop.product_details&flypage=flypage-ask.tpl&product_id=18&category_id=7&option=com_virtuemart&Itemid=1

I'm not sure what else I can check with the setup.

qme1ster
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Module issues with Virtuemart

This is strange. You're saying that you can't get the modules to appear on the product details page, but when you use the version with the "echo" in it, then you *do* get output when you're on the product details page???

Can you turn on Debug mode in MetaMod and see if it reports that it's returning a module id at all when it's on a product details page?

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: Module issues with Virtuemart

Hi Stephen,

You're saying that you can't get the modules to appear on the product details page, but when you use the version with the "echo" in it, then you *do* get output when you're on the product details page???

Yes exactly ! Makes no sense !

I've turned debug mode on but no module ID's are being output:

MetaMod debug info:
$option: com_virtuemart
$view:
$id:
$Itemid: 1
$timezone: default
$language: en-us
$language_code: en
$language_region: us
Including modules:

qme1ster
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Module issues with Virtuemart

Very strange. What happens when you put the "echo" line from the test script, into the main recipe you're using? Put it just before the "if ($cat == 6)" line, and keep debug mode on. Does it print the message "We are on category: 6" when you're on the product details page, even though it's not including any module?

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:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10778
Newest User:
negina4qx
Members Online:
0
Guests Online:
201

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