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, my codes dont work properly

Help, my codes dont work properly

Hi, great module, just a little bit difficult to start up with:)

My problem is that i want a category menu module to appear next to an article AND in the vm categories - the browse page and the flypage.

However, I do not want it to appear on the front page, nor in the shopping cart.

Afer reading up and down here on the forum and in the recipes, i have ended up with the following code:

$vm = JomGenius("virtuemart");
if ($vm->check( "pagetype not = frontpage, shop.cart" ) ) return 164;

$vm = JomGenius("virtuemart");
if ($content_genius->check("article_id = 76") ) return 164;

$vm = JomGenius("virtuemart");
if ( $vm->check("pagetype = shop.browse, shop.product_details") ) {
  $category_id = $vm->info( "category_id" );

if ($category_id == "16") return 164;

if ($category_id == "1") return 164;

if ($category_id == "2") return 164;

if ($category_id == "3") return 164;

if ($category_id == "4") return 164;

if ($category_id == "5") return 164;

if ($category_id == "6") return 164;

if ($category_id == "25") return 164;

if ($category_id == "26") return 164;

if ($category_id == "28") return 164;

if ($category_id == "29") return 164;
}

So this is 3 "different" commands in one window.

Other settings in the module is

Position: left_top

Assigned menu: all

Right now, my menu is showing everywhere, but this is due to the assigned menu settings is set to all. Is this right?

Tormodnor
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Help, my codes dont work properly

Hi Tormodnor,

It looks like you're only wanting to display 1 particular module here. Will there be others for different categories?

In any case I think you can simplify this like this:

// you only need this line once, at start of rule:
$vm = JomGenius("virtuemart");

// quick check for that article, first:
if ($content_genius->check("article_id = 76") ) return 164;

// get rid of all pages that are not a product (flypage) or browse page,
// by returning nothing.
if ($vm->check( "pagetype not = shop.product_details, shop.browse" ) ) return;

// now we know we're on a product_details or browse page. Check for
// the category number.
if ($vm->check( "category_id = 1,2,3,4,5,6,16,25,26,28,29" ) ) return 164;
// that's all, folks


The target module (164) should have the following settings:
- position: anything you like. It's not going to matter.
- published: yes
- menu items: none  [important!]

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

Re: Help, my codes dont work properly

Hi, thanks for swift reply!

I tried the codes, wrote them exactly like this in the module window:

$vm = JomGenius("virtuemart");

if ($content_genius->check("article_id = 76") ) return 164;

if ($vm->check( "pagetype not = shop.product_details, shop.browse" ) ) return;

if ($vm->check( "category_id = 1,2,3,4,5,6,16,25,26,28,29" ) ) return 164;


but it did not work.

First, im a bit unsure of the menu items settings in METAMODULE..
Should it be "all"? Or "none"?

Anyhow, i tried both these settings but i still cant get it to work.

And yes, this is my first category menu module im creating, there are several more to come when i get the hang of this. The most important thing for me is to be able to choose which "category menu" that will show up in the vm pages (browse and flypage", and prevent them from showing up in the cart and frontpage.

Tormodnor
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Help, my codes dont work properly

Ooops, I made a simple error in there.

Instead of this line:

if ($vm->check( "pagetype not = shop.product_details, shop.browse" ) ) return;

use this:

if ($vm->check( "pagetype = none of shop.product_details, shop.browse" ) ) return;


Also, the MetaMod should be set to ALL pages.

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

Re: Help, my codes dont work properly

Hi again,
Ok, so i did what you said, and the module appeared In the browse and flypage section, and disappeard from the front page and cart. So that one step in the right direction:)

But, even though the module itself disappeard, the "space" for the module is still there, pushing the site content to the right.. Please go to www.dropz.no to see ..


Also, if i want to put two or three category modules below eachother, what should the codes look like? I tried with this, without any success on the article page..

$vm = JomGenius("virtuemart");

if ($content_genius->check("article_id = 76") ) return 164;

if ($content_genius->check("article_id = 76") ) return 167;

if ($vm->check( "pagetype = none of shop.product_details, shop.browse" ) ) return;

if ($vm->check( "category_id = 1,2,3,4,5,6,16,25,26,28,29" ) ) return 164;


if ($vm->check( "category_id = 17,18,19,27" ) ) return 167;



Really appriciate the help on this:)

Tormodnor
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Help, my codes dont work properly

Hi,

(1) see FAQ: http://www.metamodpro.com/metamod/faq/2 … etamod-was

(2) to return more than one module, put a list of module ids in quotes. e.g.:

if ($content_genius->check("article_id = 76") ) return "164, 167";

For the last 2 lines of your code, you may want to keep these as they are because each rule is checking for a different set of category ids. Of course, add more if you like.

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

Re: Help, my codes dont work properly

Just purchased the pro version, and now it works fine:) Again,thanks for a great extention.

I still have one issues though..

Can i add my modules to component pages as well? I have a component on my front page which shows the newst products i have added. When you click on the products from here, you go to the url

/component/virtuemart/

and then the rest of the VM categories URL.

Even though this page look exactly like the flypage, it doesnt seem like metamod is reacting to it.

Have a look here:

http://www.dropz.no/component/virtuemar … psy-bangle



Edit
----------------------

Actually, the category module is not showing up at any of the flypages..

The codes are now like this

$vm = JomGenius("virtuemart");


if ($content_genius->check("article_id = 76") ) return "164, 167, 166, 169";

if ($vm->check( "pagetype = none of shop.product_details, shop.browse" ) ) return;

if ($vm->check( "category_id = 1,2,3,4,5,6,16,17,18,19,20,27,25,26,28,29,30" ) ) return "164, 167, 166, 169";

Tormodnor
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Help, my codes dont work properly

Figured it out..

For u people who are wondering about the same, use this code for flypage:

if ( $vm->check("pagetype = shop.product_details") ) {
  return "xxx";
}

Tormodnor
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Help, my codes dont work properly

Hi Tormodnor,

yes, that's it. Sorry I didn't get back to you earlier - it was a long holiday weekend here in New Zealand.

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: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1675
Total Polls:
6
Total Posts:
5917
Posts this week:
6
User Info:
 
Total Users:
11577
Newest User:
owens65784
Members Online:
0
Guests Online:
167

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