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.

 

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.

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

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

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

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.

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

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.

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

Re: Virtumart and content articles

Products are still being added, so eventually there will be a parent category, a sub category and then the products within the sub category eg. 1. World Drinks [category], 2. Fruit & Juice Drinks [sub category], 3. products.

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Re: Virtumart and content articles

Actually - there will not always be a sub category. so these are the scenarios:

1. category [no module] - sub category [no module] - products [module]

OR

2. category [no module] - products [module]

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

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

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

Re: Virtumart and content articles

Exactly Stephen - and of course the ability to add the module[s] to non VM pages [content articles].

Thanks.

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

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

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

Re: Virtumart and content articles

Stephen - many many thanks. I will try these out and let you know how I get on. Thanks again,

Dave.

davemars
Beginner Modder
ranks
useravatar
Offline
6 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5174
Newest User:
frashaomran
Members Online:
0
Guests Online:
168

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