Filter's mechanics

  • Posts: 177
  • Thank you received: 5
10 years 9 months ago #142796

Eliot wrote: Hi Marius,

I found the source of the issue, it's because you activated the joomla's cache.
That's why the filter is working but not displaying the right informations, the page is cached.
So you ahve to disable the joomla's cache and if you really want to have a cache you must find an extension to specify the pages you want to cache (not the Hikashop ones)


I disabled Joomla cache but still see the filter selected though all products of categories are shown. Why?

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

  • Posts: 177
  • Thank you received: 5
10 years 9 months ago #142800

Xavier wrote: Hi,

You have to edit the file "administrator/components/com_hikashop/classes/filter.php" and in the function "addFilter()" replace the line:

		$infoGet = $app->getUserStateFromRequest( 'com_hikashop.'.$cid .'_filter_'.$filter->filter_namekey.$completion, 'filter_'.$filter->filter_namekey.$completion, $infoGet, 'array' );
By:
$infoGet = JRequest::getString('filter_'.$filter->filter_namekey.$completion);

The filters are not stored in cookies but in session.


If i replace
if(JRequest::getVar('filtered')==1){
with
if(JRequest::getVar('filtered')==0){
, near that lines, filter is clear when open products listing. :lol: Is it OK, if i do it?

The following user(s) said Thank You: mariussport

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

  • Posts: 2334
  • Thank you received: 403
10 years 9 months ago #143475

I think that if you do so your filters will always be clear but if it works for you that's ok!
Either way, make sure you have the last version of Hikashop ;)

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

  • Posts: 149
  • Thank you received: 0
10 years 3 months ago #166122

Hello ,

i use the latest business version of hikashop .

1. i dont what to save any selection after the user leaves the page.

topriderscycles.co.uk/index.php?option=c...oad-bikes&Itemid=850

for example if i select GIANT when i am on ROAD category and then go to MOUNTAIN BIKES page and then back to ROAD i want the filter to be clear without have any reset button .

2. when i use the filter and select to go back from the browser back button i get this error docs.google.com/a/webarts.com.cy/file/d/...2c/edit?usp=drivesdk

how can avoid that? this happens after i use the filter

please advice asap thx

Last edit: 10 years 3 months ago by webarts.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 3 months ago #166132

Hi,

1. Xavier provided the code modification at the beginning of this thread in order to achieve that, and PeterChain later provided the new code to look for for the modification:
www.hikashop.com/forum/2-general-talk-ab...?limitstart=0#108378

2. That's not an error. That's your browser telling you that the previous page needs a form resubmission. It's the way your browser want to handle the reloading of the page and we can't do anything about it. This has to be modified in the browser itself:
superuser.com/a/374246
If you press the F5 key at that point and validate the form resubmission, you'll see the page.

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

  • Posts: 149
  • Thank you received: 0
10 years 3 months ago #166238

Thank you Nicolas.

about point 2.

for example why the browser its not telling me the same on that website www.evanscycles.com/categories/bikes/road-bikes when i use the fitler and then try to go back . just let me know the different to can explain to my clients.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 3 months ago #166241

On this website, you can see that the URL changes when you use a filter. The data is not sent as a form but directly in the URL. So the browser doesn't display the message when you go back as there was no form submission.
It's actually possible to have HikaShop to do the same by changing the line:

<form action="<?php echo $url; ?>" method="post" name="<?php echo 'hikashop_filter_form_' . $this->params->get('main_div_name'); ?>" enctype="multipart/form-data">
to:
<form action="<?php echo $url; ?>" method="get" name="<?php echo 'hikashop_filter_form_' . $this->params->get('main_div_name'); ?>" enctype="multipart/form-data">
in the file "filter" of the view "product" via the menu Display>Views.

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

  • Posts: 149
  • Thank you received: 0
10 years 3 months ago #166332

Nicolas this is not working properly.

i change the code but when you use the filter it redirects to the homepage.

please try to use the filter here. use the brand field

topriderscycles.co.uk/index.php?option=c...oad-bikes&Itemid=850

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 3 months ago #166357

I checked your website.
I see that it also need to add hidden fields for the parameters which are in the URL normally, otherwise, they are ignored.
So to do that, you need to also add such code as well after the previous line of my previous message:

<?php if(!empty($this->params) && $this->params->get('module') == 'mod_hikashop_filter' && ($this->params->get('force_redirect',0) || (empty($this->currentId) && (JRequest::getVar('option','')!='com_hikashop'|| !in_array(JRequest::getVar('ctrl','product'),array('product','category')) ||JRequest::getVar('task','listing')!='listing')))){
		$menuClass = hikashop_get('class.menus');
		$menuData = $menuClass->get($this->params->get('itemid',0));
		$type = 'category';
		if(@$menuData->hikashop_params['content_type']=='product'){
			$type = 'product';
		}
?>
<input type="hidden" name="option" value="com_hikashop">
<input type="hidden" name="ctrl" value="<?php echo $type; ?>">
<input type="hidden" name="task" value="listing">
<input type="hidden" name="Itemid" value="<?php echo $this->params->get('itemid',0); ?>">
<?php }else{
 foreach($_GET as $k => $v){ ?>
 <input type="hidden" name="<?php echo $k; ?>" value="<?php echo $v; ?>">
<?php
}
}

The following user(s) said Thank You: webarts

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

  • Posts: 149
  • Thank you received: 0
10 years 3 months ago #166616

thank you Nicolas. we will lost those changes when we will wupgrade the component on the future?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 3 months ago #166629

No. The changes are stored as template overrides in your template's HTML folder. You won't loose them when you update HikaShop.

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

Time to create page: 0.099 seconds
Powered by Kunena Forum