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.

 

Display Module according to different VMF component filter results

Display Module according to different VMF component filter results

Hi, I am using Metamod 2.4c Pro, Joomla 1.5.17 Stable and VMF Filtering Component.

I so far have this recipe:

if (
$option == 'com_vmfiltering'
and $view == 'Vmf'
and JRequest::getVar('task') == 'search'
and JRequest::getVar('vm_cat') == array ( 0 => '1', )
or JRequest::getVar('vm_cat') == array ( 0 => '1', 1 => '11', )
) return 59;


Basically, I need to have the module show on vm-categories 1, 10, 66, 67, 68, 69, 70, 71, 73, 75, 76, 11, 77, 78, 79, 80, 81, 82, 83, 84, 86, 12, 87, 88, 89, 13, whether it is just one of these or all of these categories in the array, and also if one or more manufacturers are selected

and JRequest::getVar('vm_mnuf') == array ( 0 => '2', )

to return 59;


I just dont know how to have multiple values, without writing the recipe out to consider all possible combinations.

Please help.

Edited By: jenlu
15-Sep-10 13:00:09

jenlu
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Display Module according to different VMF component filter results

I am wondering if I have not explained this very well...

When using the VMF filtering, there are a multitude of combinations in the final url. The user is able to select multiple virtuemart categories..

I need the module to appear on the specific virtuemart categories shown in my first post, whether only 1 of them is selected or multiples..

To help explain I have temporarily made the site live and at the following address you can see the metamod with the VMF filter & the debug in the left module position.


http://www.beautylogix.com/index.php?op … p;Itemid=2

jenlu
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Display Module according to different VMF component filter results

Hi Jenlu,

try this:

if (
  $option == 'com_vmfiltering'
  and $view == 'Vmf'
  and JRequest::getVar('task') == 'search' ) {

    $allcats = array( 1, 10, 66, 67, 68, 69, 70, 71, 73, 75, 76, 11, 77, 78, 79, 80, 81, 82, 83, 84, 86, 12, 87, 88, 89, 13);
    $allmans = array( 2, 3, 4 ); // <-- customise!!!

    $vm_cat = JRequest::getVar('vm_cat');
    $vm_man = JRequest::getVar('vm_mnuf');
    if ( in_array( $vm_cat, $allcats ) and in_array( $vm_man, $allmans ) )  return 59;
}

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

Re: Display Module according to different VMF component filter results

Hi Stephen,

Thank you for your reply, I have used the recipe as you have laid out above but the module does not show on the results pages.

Whilst playing with this I came up with this recipe:

if ( $option == 'com_vmfiltering' and $view == 'Vmf' ) {
$category_id = JRequest::getVar('vm_cat');
if ( $category_id == array ( 0 => '1', )|array ( 0 => '10', )) return 59;

}


Which does show the module on the results, but it shows it for ALL the vm categories - obviously I don't know what I am doing, just trying to get it to work.
to access the site please use:

http://www.beautylogix.com/

username: access
password: please

jenlu
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Display Module according to different VMF component filter results

Ok, that makes more sense now that I can see the module in action. Thanks for sending the login.

Try this:

if (
  $option == 'com_vmfiltering'
  and $view == 'Vmf'
  and JRequest::getVar('task') == 'search' ) {

    $allcats = array( 1, 10, 66, 67, 68, 69, 70, 71, 73, 75, 76, 11, 77, 78, 79, 80, 81, 82, 83, 84, 86, 12, 87, 88, 89, 13);

    $vm_cat = JRequest::getVar('vm_cat');
    $vm_man = JRequest::getVar('vm_mnuf');
    if ( is_array( $vm_cat ) ) {
      foreach ($vm_cat as $cat ) {
        if ( in_array( $cat, $allcats ) )  return 59;
      }
    }
    // check for manufacturers
    if ( is_array($vm_man) and count($vm_man) > 0 ) return 59;
}

I *think* that has a better chance of working this time...

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

Re: Display Module according to different VMF component filter results

Thank you very much for this, I have now put your above recipe in and also the below for the next filter module..

Only trouble now is that both show up on the results page, any ideas?

if (
  $option == 'com_vmfiltering'
  and $view == 'Vmf'
  and JRequest::getVar('task') == 'search' ) {

    $allcats = array( 2, 14, 90, 91, 92, 93, 94, 15, 95, 96, 97, 16, 98, 99, 100, 17, 101, 102, 103, 18);

    $vm_cat = JRequest::getVar('vm_cat');
    $vm_man = JRequest::getVar('vm_mnuf');
    if ( is_array( $vm_cat ) ) {
      foreach ($vm_cat as $cat ) {
        if ( in_array( $cat, $allcats ) )  return 75;
      }
    }
    // check for manufacturers
    if ( is_array($vm_man) and count($vm_man) > 0 ) return 75;
}


thank you kindly!

jenlu
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Display Module according to different VMF component filter results

I'm not sure what you mean by "both show up on the results page". Do you mean both 59 and 75? Or are you getting a double copy of one of those modules?

If you're getting a double copy of one of the modules, then you probably forgot to "disable" it so that it doesn't show up "by itself" unless MetaMod includes it.

If you're getting both 59 and 75 then that's because the rule checks to see if there are any manufacturers mentioned in the URL... and if so, it's returning the first module (59). Then the same happens again with 75.

So I guess I got the logic wrong. Under what circumstances do you want the manufacturer module to appear? You originally said "if one or more manufacturers are selected", but I guess you want to check for particular manufacturers for each of the target modules. Can you give a list of manufacturer ids you want to use for 59, and a different list for 75?

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

Re: Display Module according to different VMF component filter results

Hi, It is that both 59 and 75 are showing up.

I would like the manufacturers to appear in the when the search results are for the specific category entered.

But each Manufacturer is in each category. SO is it possible to show only the one module when the other module are not shown, even though they have the same result in the URL.

For example, the metamodmodule is number 59 and is returned when categories 1, 10, 66, 67, 68, 69, 70, 71, 73, 75, 76, 11, 77, 78, 79, 80, 81, 82, 83, 84, 86, 12, 87, 88, 89, 13 are in the URL

but NOT shown if none of the above categories are in the url? even if the Manufacturers are?

Manufacturer IDs are 1,2,3,4,5,6

Many thanks, Tess.

jenlu
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: Display Module according to different VMF component filter results

Tess,
I'm afraid I just can't understand what you're trying to say! Can you please try to explain again, maybe giving an example of what should happen for a particular URL, and why?

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10789
Newest User:
parus6
Members Online:
1
Guests Online:
192

Online: 
parus6

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked