Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Show Module on Categories and on Each...
Show Module on Categories and on Each Product of those Categories
Show Module on Categories and on Each Product of those Categories
My goal is to show the same module for several categories and each product of those categories. Here's my code which only works for the categories and not when the products are being viewed.
$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check("pagetype = category") ) {
$category_id = $vm->info( "category_id" );
/* when browsing a specific category on browse page (e.g. category 2) */
if ($category_id == "14") return 138;
if ($category_id == "15") return 138;
if ($category_id == "16") return 138;
if ($category_id == "53") return 138;
if ($category_id == "54") return 138;
if ($category_id == "55") return 138;
if ($category_id == "56") return 138;
if ($category_id == "57") return 138;
if ($category_id == "58") return 138;
if ($category_id == "59") return 138;
/* when browsing any other category page */
return ZZZ;
}
Your help is greatly appreciated.
Re: Show Module on Categories and on Each Product of those Categories
Hi Touchdowntech,
The crucial element here is the second line, which tests for category pages, and only proceeds if a category page is found. All you need to do is remove that test (and the closing parentheses), then it will apply to ANY page type that can detect a category id.
So try this:
$vm = JomGenius("virtuemart"); // need this at the start of every rule
$category_id = $vm->info( "category_id" );
if ($category_id = 0) return; // short-circuit if we're not on a page that produces a category id.
/* when browsing a specific category on browse page (e.g. category 2) */
if ($category_id == "14") return 138;
if ($category_id == "15") return 138;
if ($category_id == "16") return 138;
if ($category_id == "53") return 138;
if ($category_id == "54") return 138;
if ($category_id == "55") return 138;
if ($category_id == "56") return 138;
if ($category_id == "57") return 138;
if ($category_id == "58") return 138;
if ($category_id == "59") return 138;
/* when browsing any other category page */
return ZZZ; // replace ZZZ with a module id, or delete the line.
Best regards,
Stephen
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Show Module on Categories and on Each...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 2
- User Info:
- Total Users:
- 7655
- Newest User:
- martha48
- Members Online:
- 0
- Guests Online:
- 152
- 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