Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Virtumart and content articles
Virtumart and content articles
Virtumart and content articles
joomla 1.5.11, metamod 2.2
hi, i am struggling a bit with the php logic. i can make things happen based on the recipes but i can't work out how to achieve my goals.
i have a module in metamod [31]. i want to show this on certain article pages [article&id=4]. i also only want to show it on all vm pages except the default vm page and the shop.browse.
[actually this is not strictly true but i'm not sure if this is possible or not. i have main vm categories and child categories. i do not want the module on these, but i would like it on the shop.browse page showing the products in the child category. but both categories and the listed products within a category are shop.browse pages.]
Can you help?
Thanks.
Re: Virtumart and content articles
Ok, can I check exactly what you want to achieve?
- show the module on article #4 (and possibly others, specified by id)
- don't show it on VM "category" list pages (shop.browse), unless it's a child category.
I don't understand what you mean by this: "but both categories and the listed products within a category are shop.browse pages". Can you give some URLs showing the difference? (especially with SEF URLs turned off).
I'm sure that with some clarification we should be able to get exactly what you want here. The more specific you can be the better. Thanks!
Cheers,
Stephen
Re: Virtumart and content articles
thanks for getting back Stephen.
yes - i want to show module on article 4 [and possibly others]
VM:
NO module on this page
http://prague.directrouter.com/~ilovewo … p;Itemid=3
NO module on this page
http://prague.directrouter.com/~ilovewo … p;Itemid=1
YES module on this page
http://prague.directrouter.com/~ilovewo … p;Itemid=1
So i require the module on all VM pages except the main categories.
I hope this makes more sense!
Thanks.
Re: Virtumart and content articles
Ok, that's a lot clearer thanks. So, can you explain *how* the last 2 pages are set up? Is it that the World Drinks page is a category page with no products under it, only subcategories? If that's the case I guess we need to do a database call that checks if the current category (from the category_id variable in the URL) has any real products in it, or only subcategories.
Re: Virtumart and content articles
So could we sum this up by saying: if there are products showing on this browse page, then show the module. If there are no products, only categories or subcategories, showing on the browse page then don't show a module?
Cheers,
Stephen
Re: Virtumart and content articles
Ok, I just did some investigation of host to count the number of items on the page without having to do a full database query... luckily VM keeps these in memory so I can just count them.
So here's a mini-recipe just for counting the number of "real products" showing on a browse page, and including a module only if there are some products appearing on that page. Therefore, if it's on a page with only a list of subcategories and no actual products, MetaMod won't place a module on that page:
Code:
if ($option == "com_virtuemart" and JRequest::getVar('page') == 'shop.browse' ) {
$num_items = (int)@count(@$GLOBALS['product_info']);
if ($num_items > 0) return 101; /* replace 101 with module id to display */
}
You also wanted to be able to place the module on particular article pages. Just add the following rule directly after the previous one, in the same MetaMod:
Code:
if ($option == "com_content" and $view == "article" ) {
$id = (int)$id;
if ($id == 4) return 101; /* replace with module id to show on article id 4 */
if ($id == 5) return 102; /* replace with module id to show on article id 5 */
}
Hope this helps!
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Virtumart and content articles
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 3
- User Info:
- Total Users:
- 8012
- Newest User:
- grant1ab
- 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