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.

 

Help! Virtuemart cart and checkout pages

Help! Virtuemart cart and checkout pages

I'm brand new to metamod pro.  I have a module published to the right module position to show on all Virtuemart pages, but I would like to have it show on everything but the cart and checkout pages.  I have the module active in the right module position and I have created a metamodule with the following code:

Code:

$vm = JomGenius("virtuemart"); // need this at the start of every rule

if ( $vm->check( "pagetype != shop.cart" ) ) return 139;
if ( $vm->check( "pagetype != shop.savedcart" ) ) return 139;
if ( $vm->check( "pagetype != checkout.index#1" ) ) return 139;
if ( $vm->check( "pagetype != checkout.index#2" ) ) return 139;
if ( $vm->check( "pagetype != checkout.index#3" ) ) return 139;
if ( $vm->check( "pagetype != checkout.index#4" ) ) return 139;
/* replace XXX with the module id or  position you want
* to display <em>except</em> on the front page of VirtueMart
*/

It doesn't seem to be working and would appreciate any help.  I have Joomla SEF enabled if that makes a difference.

This is a test site at:
http://www.harvestmooned.com/production

dirtybird3g
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Help! Virtuemart cart and checkout pages

Ok, what's happening is a logic thing. PHP checks down the list, performing 1 check at a time. Let's say the page type was "frontpage".

So it checks the first thing. Frontpage is not equal to shop.cart, so it returns module 139 and does not check any further.

Basically, anything other than shop.cart will be caught by the first rule, then shop.cart will get caught by the second rule (cos it's not shop.savedcart). That's why it's not working.

The good news is that there's a very easy way to express what you are looking for.

$vm = JomGenius("virtuemart");
if ( $vm->check( "pagetype startswith none of shop.cart, shop.savedcart, checkout" ) ) return 139;

I use "startswith" instead of "=" so that it catches all of the "checkout..." pages, including "checkout.thankyou".

"none of" means that the pagetype is not allowed to "startswith" any of the items in the list following it.

You can add as many of the page types as you like to the list. If you want to change to exact matches, then just change "startswith" to "=", and make sure all the page types are spelled exactly as in the documentation.

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

Re: Help! Virtuemart cart and checkout pages

It seems to work sometimes, and sometimes not.  I'm wondering if it has to do with the way the add to cart buttons are functioning.  If I click on my cart link it seems to work, but when I click add to cart it takes me to the cart and the mod still shows.  When clicking add to cart it seems to take me to /index.php instead of the cart, but it shows the cart.  Any idea?

dirtybird3g
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Help! Virtuemart cart and checkout pages

Hi dirtybird3g,

When you say "sometimes / sometimes not", do you mean that for exactly the same action it sometimes works and sometimes doesn't? Or that there are some similar actions that you think should have the same result, but they don't?

If you're performing the same action and sometimes it works and sometimes it doesn't, I think it's likely to be a caching issue. If you are using the Joomla System Cache plugin, try disabling that and seeing if that makes any difference. Also check the cache that's controlled inside the "global parameters" admin page - turn it off and see if that makes any difference. If it does, there are finer controls that you can try.

If the randomness is more about clicking in different places causes different results, then I suspect that the problem is due to where the MetaMod module is assigned. Did you perhaps assign it to something other than "all pages"? If you have assigned it to particular pages, I guess including at least one "Virtuemart" menu item, then there might be funny things going on with Itemids (this is common in VM). You could try assigning the module to ALL pages, and changing the rule to this:

if ( $option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ( $vm->check( "pagetype startswith none of shop.cart, shop.savedcart, checkout" ) ) return 139;
}

That will only display on VM pages, and then only if the page is not shop.cart, shop.savedcart and all the checkout steps.

Lastly, you need to ensure that the target module is set to unpublished, OR is set to a module position that does not exist (e.g. type in the module position "right-metamod" on the selection dropdown, as you can type directly into that). If you don't do that then the module will show up no matter what you do with MetaMod.


I hope something in there helps... please write back if you need more help, with as many details as possible.

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
4
User Info:
 
Total Users:
4384
Newest User:
rash39381
Members Online:
0
Guests Online:
212

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