Hide Filter module from individual product pages

  • Posts: 12
  • Thank you received: 0
12 years 4 months ago #57597

Hi,
I need to hide my filter module appearing on individual product pages (please see the attached). Can you please advise how to.
Many thanks...

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 4 months ago #57656

Hi chama,

To do this, you can edit the file:
YourSite\modules\mod_hikashop_filter\mod_hikashop_filter.php

And add replace:

$js ='';
hikashop_initModule();
foreach(get_object_vars($module) as $k => $v){
	if(!is_object($v)){
		$params->set($k,$v);
	}
}
$html = trim(hikashop_getLayout('product','filter',$params,$js));
if(!empty($html)){
?>
<div class="hikashop_filter_module">
<?php echo $html;?>
</div>
<?php } ?>
By:
if(JRequest::getString('task','')== 'show'){
$js ='';
hikashop_initModule();
foreach(get_object_vars($module) as $k => $v){
	if(!is_object($v)){
		$params->set($k,$v);
	}
}
$html = trim(hikashop_getLayout('product','filter',$params,$js));
if(!empty($html)){
?>
<div class="hikashop_filter_module">
<?php echo $html;?>
</div>
<?php } } ?>

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
12 years 4 months ago #57731

Hi Xavier,
Thanks for the response. However, now with the modified script, the filter is hidden on the product list, but appear on the individual product page. I need the reverse of this. See attached screenshots for results after this modification.



Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 4 months ago #57754

Sorry little mistake, replace:

if(JRequest::getString('task','')== 'show'){
By:
if(JRequest::getString('task','')!= 'show'){

The following user(s) said Thank You: chama

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
12 years 4 months ago #57882

Thanks Xavier,
It's working now.

Please Log in or Create an account to join the conversation.

  • Posts: 82
  • Thank you received: 8
  • Hikashop Business
9 years 5 months ago #205158

Thanks for this solution
1. Can this be placed in a template override? I tried mytemplate/html/mod_hikashop_filter - didnt work!
2. How do i hide the filter from showing in Cart / checkout pages too? I require that the filter only shows on the product pages.
Thanks

SOLVED - :)
Make a new menu hidden item called "Checkout" then in config>checkout force menu item =checkout
Use the menu assignments on the filter mod to not display in that menu item.

Last edit: 9 years 5 months ago by huwhuw.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 1
9 years 5 days ago #221475

I altered the code fit to Hikashop 2.6.0:

if(JRequest::getString('task','')!= 'show'){
$js ='';
hikashop_initModule();

foreach(get_object_vars($module) as $k => $v){
	if(!is_object($v) && $params->get($k,null)==null){
		$params->set($k,$v);
	}
   }
}
$html = trim(hikashop_getLayout('product','filter',$params,$js));
require(JModuleHelper::getLayoutPath('mod_hikashop_filter'));

Seems to be working... feel free to correct me if anyone sees something amiss or to improve ;)
By the number of questions about this maybe it's a good idea to build in the option as standard?

Last edit: 9 years 5 days ago by Twototango. Reason: typo's
The following user(s) said Thank You: Holmes-Pierce

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
9 years 4 days ago #221482

Hi,

That's a good idea yes.

Please Log in or Create an account to join the conversation.

  • Posts: 265
  • Thank you received: 1
8 years 8 months ago #232479

Hello,

Could you please share the solution for this with the new /mod_hikashop_filter.php?

Many thanks,
Hal

Please Log in or Create an account to join the conversation.

  • Posts: 265
  • Thank you received: 1
8 years 8 months ago #232480

Sorry, I was in the wrong file :D

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 8 months ago #233684

Hi,
The solution from Twototango is not working for products with variants.
Can someone provide a fix or another preferred method to solve the products with variants issue.
Thanks in advance.


P.S. I've checked the "Advanced module manager" but as far as I saw only the paid version can do the trick which is 25 EUR. Although Advanced module manager has 100% rating If I only need the plugin for this job the price is enormous compared to Hikashop. I had already bought Skyline accordion :huh:

Last edit: 8 years 8 months ago by ydingilski.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 8 months ago #233698

Hi,

I don't see why the solution would have to be different for products with variants.
It should work regardless of that.

And no, you can do that with the free version of Advanced Modules Manager too. It's just slightly more complex because instead of just checking off the product pages checkbox, you have to use the URL filter of AMM with a regex based on how the URLs look different on the product pages.

Please Log in or Create an account to join the conversation.

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 8 months ago #233746

Hi nicolas,
Thank you for the clarification of AMM, I'll check it out.
About the products with variants I made a mistake, apparently the first few products led me into deception. There is a problem in our e-shop because for some of the products the Twototango's solution is not working. After checking more products I'm sure it's not about products with variants. Maybe it's not random but have no idea what is the pattern. I'm not digging into it, because I prefer to spend more time on Advanced Module Manager.

Please Log in or Create an account to join the conversation.

Time to create page: 0.140 seconds
Powered by Kunena Forum