Prevent page jumping up to top when using filter

  • Posts: 52
  • Thank you received: 2
10 years 9 months ago #143745

Hi,

I need some help to stop the page from jumping to the top when someone selects their filter options and clicks on 'Filter' to submit.

I've tried to make it submit as soon as someone selects a filter option without having to click on the 'Filter' button to submit the search, but that makes it jump to the top as well.

Is there any way of making it stay a certain length down the page (e.g. by using a #top link within the php which controls where the page goes after filtering)? I've already used the #top tag to make the drop-down box stay a certain length down the page when someone clicks on it to drop down the filter box, but as mentioned, once someone then selects the filter options it jumps to the top of the page when displaying the filter results.

See problem here: s293983206.websitehome.co.uk/elevatefile...age(1)/women-s-shoes

Please help :S

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 9 months ago #143856

Hi,

You can use an anchor in the filter form.
Otherwise, because you submit a form and reload the page, you got a new page so... globally except with a anchor it is not possible.

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.
The following user(s) said Thank You: Lexnia

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

  • Posts: 52
  • Thank you received: 2
10 years 9 months ago #143930

Thanks for your response Jerome. :-)

Can I just ask one more question... sorry to be a pain. How shall I include the anchor within the php of the form so that it returns the new page from the anchor point onwards?

Thanks in advance :-)

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 9 months ago #143987

You would have to edit the file "filter" of the view "product" via the menu Display>views and change 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 something like that:
<form action="<?php echo $url; ?>#myanchor" method="post" name="<?php echo 'hikashop_filter_form_' . $this->params->get('main_div_name'); ?>" enctype="multipart/form-data">

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

Time to create page: 0.063 seconds
Powered by Kunena Forum