Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


glenn@phillipsprint.co.uk
Beginner Modder
ranks
useravatar
User Info

Display Module in VM Search

I have a module which I want to display on all VM catagories, products and search results etc.  But not on joomla articles, login, shopping cart etc.

At present the code I am using is as follows, although I have tried various combinations.

$vm = JomGenius("virtuemart");
if ( $vm->check("pagetype not starts with checkout") ) return 105;
if ( $vm->check("pagetype = shop.search") ) return 105;

In the Menu Assignment I have "On all pages expect those selected"

Any help would be most grateful.

Thank you
Glenn


Administrator has disabled public posting
metamodguy
useravatar
User Info

Re: Display Module in VM Search

Hi Glenn,

you're close smile

1 - it would be better to have the MetaMod set to display on ALL pages. The code in the MetaMod only gets run when you're on one of the pages that the MetaMod is assigned to, so it's generally better to cast the net widely and include more pages than you think you might need, unless you absolutely know which particular menu items will be involved. VirtueMart is well known for appearing on pages that you don't expect it to, or on "menuless" pages, and the only way to catch these is to assign the MetaMod to ALL pages.

2 - I'd enclose the entire rule in a check to see if you are on a VM page at all.

if ($option == "com_virtuemart") {
... code here
}

3 - the total rule would look like:

if ($option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ( $vm->check("pagetype not starts with checkout") ) return 105;
}


So what this is going to do, is ONLY when you are on a VM page, and ONLY when it's NOT a checkout page, it's going to show module 105.

Is that what you're after?

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

Administrator has disabled public posting
glenn@phillipsprint.co.uk
Beginner Modder
ranks
useravatar
User Info

Re: Display Module in VM Search

thank you for this,

I can get it to work until I add in another set of pages I do not want to display.

if ($option == "com_virtuemart") {
$vm = JomGenius("virtuemart");
if ( $vm->check("pagetype != cart") ) return 105;
if ( $vm->check("pagetype != user") ) return 105; }

If I just use only the "if ( $vm->check("pagetype != cart") ) return 105;" the module will not display in the cart.

If I just use only the "if ( $vm->check("pagetype != user") ) return 105" the module will not display in the user page.  But they will not work together.

If I use "if ( $vm->check("pagetype != array("user","cart")")) return 105;" it does not display the module anywhere.

I have also tried "if ( $vm->check("pagetype != cart, user") ) return 105;", but to no avail.

Thank you
Glenn


Administrator has disabled public posting
metamodguy
useravatar
User Info

Re: Display Module in VM Search

ok, try this:

if ($option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ( $vm->check("pagetype starts with none of cart, user") ) return 105;
}

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

Administrator has disabled public posting
glenn@phillipsprint.co.uk
Beginner Modder
ranks
useravatar
User Info

Re: Display Module in VM Search

Thanks for your help so far, I think I am nearly their.  I have gone through the site and added to the code.  But I have a problem on the following.

Code so far.
if ($option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ( $vm->check("pagetype starts with none of cart, checkout, user") ) return 105;
}
if ($option == 'com_customfilters') return 105;


I want to disable the module on the orders information page but if I add 'orders' to the above it still displays the module. "pagetype starts with none of cart, checkout, orders, user" below is the advanced debug.
if ($option == 'com_virtuemart'
and $view == 'orders'
and $Itemid == '0'
and JRequest::getVar('layout') == 'details' /*!*/
and JRequest::getVar('order_number') == 'XXXXXXX' /*!*/
and JRequest::getVar('limit') == '10' /*!*/
and JRequest::getVar('limitstart') == 0 /*!*/
) return XXX; /* replace XXX with the module ID or position to display */

Ideally I would like to disable the module on the search pages, but I'm not sure how to do this. If I use the VM search plug-in it displays the module, below is the advanced debug.  But if I then use the search field which appears in the search page results it does not display module see the debug below.

Main Search advanced debug
if ($option == 'com_virtuemart'
and $view == 'category'
and $Itemid == NULL
and JRequest::getVar('virtuemart_category_id') == 0 /*!*/
and JRequest::getVar('search') == 'true' /*!*/
and JRequest::getVar('limit') == '10' /*!*/
and JRequest::getVar('limitstart') == '0'
and JRequest::getVar('keyword') == 'XXXXX'
) return XXX; /* replace XXX with the module ID or position to display */

Search advanced debug from search in the search page results.
if ($option == 'com_virtuemart'
and $view == 'category'
and $Itemid == NULL
and JRequest::getVar('search') == 'true'
and JRequest::getVar('keyword') == 'XXXX'
) return XXX; /* replace XXX with the module ID or position to display */


Thank you
Glenn


Administrator has disabled public posting
metamodguy
useravatar
User Info

Re: Display Module in VM Search

Hi Glenn,
You could exclude the orders and search page like this:

if ($option == "com_virtuemart") {
  $vm = JomGenius("virtuemart");
  if ( $vm->check("pagetype starts with none of cart, checkout, user")
    and $view != 'orders'
    and !($view == 'category' and JRequest::getVar('search') == 'true')
) return 105;
}
if ($option == 'com_customfilters') return 105;


I think that should do it, this time :-)

Best regards,
Stephen


Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory

Administrator has disabled public posting
glenn@phillipsprint.co.uk
Beginner Modder
ranks
useravatar
User Info

Re: Display Module in VM Search

Thank you

This seems to work.

Glenn


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3097  Total Topics: 1195  Total Polls: 7  Total Posts: 4451  Total Posts Today: 1
User Info:   Newest User :  cruptlojik   Members Online: 2   Guests Online: 72
Online 
Jeff78adrianboogaard
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked