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.

 

Problems with modules and categories in VM

Problems with modules and categories in VM

Hello:

I'm using MetaMod to post modules to specific VM Categories using the following code:

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

  /* when browsing a specific category on browse page (e.g. category 2) */

  if ($category_id == "111") return 198;
  if ($category_id == "112") return 198;
  if ($category_id == "113") return 198;
  if ($category_id == "114") return 198;
  if ($category_id == "115") return 198;
  if ($category_id == "116") return 198;
  if ($category_id == "117") return 198;
  if ($category_id == "118") return 198;
  if ($category_id == "119") return 198;
  if ($category_id == "120") return 198;
  if ($category_id == "121") return 198;
  if ($category_id == "122") return 198;
  if ($category_id == "123") return 198;
  if ($category_id == "124") return 198;
  if ($category_id == "125") return 198;
  if ($category_id == "126") return 198;
  if ($category_id == "127") return 198;
  if ($category_id == "128") return 198;
  if ($category_id == "129") return 198;
  if ($category_id == "130") return 198;
}
}

I've used it in other place of the site and it works fine, but in this case it's only posting the module to the 1st "if ($category_id == "111") return 198;" and not to all the other ones.

I tried just about anything and I can't seem to get it to appear in any other category except the first one.

Please help me.
Daniel

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

Re: Problems with modules and categories in VM

Hi Daniel,

there doesn't seem to be much wrong with your PHP, though I would personally do things a little differently. I'd be using JomGenius to get hold of the category id, as it's smart enough to get category ids even when they are not present in the URL for any reasons (e.g. if just the product id is present).

So try this:

if ($option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ($vm->check("pagetype == shop.browse")) {
    if ($vm->check("category_id >= 111") and $vm->check("category_id <= 130)) {
      return 198;
    }
  }
}

Don't forget the other important bits: the target module must be disabled in some way (set to nonexistant module position, or set to "none" menu items, or unpublished), and do not put anything into the "quick module id or position include" box.

Also, don't forget to turn on debug mode in the MetaMod if you want to see a little more information about what's going on.

If the code above does not work, then please turn on advanced debug mode, and copy and paste the results from that on one of the pages it's not working on, into a forum reply. That should help to identify what's going on.

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

Board Info

Board Stats:
 
Total Topics:
1675
Total Polls:
6
Total Posts:
5917
Posts this week:
6
User Info:
 
Total Users:
11577
Newest User:
owens65784
Members Online:
0
Guests Online:
177

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