Assistance on a little HACK

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #103775

As I found some limits in the filter philosophy I managed to build a little hack to create a "Clear all filter settings at once" button so for my 5 filter setup I don'thave to "kill" five times to go back to a global product list.

However something strange is happening and probably you can illuminate me:


I have a 5 filtter module, 4 are lists, 1 is text box.

If i create code to kill the four list filters at once it works no matter only one list filter was active.

If I create a button that kills 4 list filters plus text box it only works when the text box has something inside, lets say when the filter can be killed.

This is the simple code I created for 4 list filter reseting button (and works always)

<tr><td>
<span class="hikashop_filter_button_outside" style="float:right">
<a class="hikashop_cart_button_cancel" id="hikashop_filter_button_module_111"  onclick="document.getElementById('filter_Mastil_module_111').value=''; document.getElementById('filter_Marca_module_111').value=''; document.getElementById('filter_Tipo_module_111').value=''; document.getElementById('filter_Carga_module_111').value=''; document.forms['hikashop_filter_form_module_111'].submit(); return false;" href="../../catalogo-de-carretillas" >Anular búsqueda</a></span>
</td></tr>

And then if add this piece for 4 lists + text box reseting at once (it will only work when text box is not empty)
document.getElementById('filter_Buscar_por_texto_module_111').value='';

I think maybe a text box should be killed in a different way, this is the one I observed in the HTML code anyhow...

I can confirm the code has been working for weeks perfectly when I only had to kill the list filters and the limitation only started when I had to add the text box to the Reset button

UPDATE:

This problem is only happening in the main category which is displayed through a Menu. When entering subcategories the reseting works fine without the need to fill the text box.

Last edit: 11 years 6 months ago by Jerome. Reason: cleaning message code

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #103870

Hi,

Your javascript code looks good. Because I don't have same modules/filters I can't reproduce it in my local website.
Do you have a link to your store ? So we will be able to see it directly.

Thanks,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #103893

Sent to you through the contact form.

thank you!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #103964

Hi,

I test your website and I don't know exactly why but, in the first link you gave, the link is not working properly.
The "onclick" is not called by the "href" yes.
Regarding the browser history, there is no "post" send to the website but a page is "get".
So no information is sent to the website in order to remove the filters.

Because there is no "post", it means that the form is not submitted.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #103967

Thanks for your interest in analyzing the problem. To be honest I don't understand much of your statements as I'm not really a PHP coder so my comprehension is very limited. I will try to figure out how "to change something" and maybe come back to you.

Anyhow, wouldn't be easy to integrate this kind of button that resets all filters at once as a function in the component?

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

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #103994

Hi Jerome,

I'm going to open a new simplified open post for this topic with the hope some community member can bring some idea.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 6 months ago #104027

Adding a "clear all" button on the filters is something high on our todo list. We'll try to add it to the next version.

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

Time to create page: 0.062 seconds
Powered by Kunena Forum