Page Scrolling Selects Field of Form in Zen Cart

By Melanie Prough on Thursday, January 21, 2010
Filed Under: Zen Cart Tips












Quick tip here, for a aggravating problem. We commonly install the returns authorization module for Zen Cart. It’s nice and very effective. The returns page has the ability to define text, making it the logical choice for your returns policy.

Only recently we have had this problem, but a store we are developing had a particularly long warranty and returns message. When loading the returns page, because it contains a form the standard Zen Cart onload, thus loading the top field of the form as selected… In this case 3/4 of the way down the page. To load this at the top instead, we had to craft a quick way to exclude this page from the standard onload.

To accomplish this, in your template override version of tpl_main_page.php we will add a conditional statement excluding the onload for the returns page.

Find this line:

$body_id = ($this_is_home_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);

Add the following directly after:

if ($current_page_base == 'returns') $zv_onload = '';

The only changed line is added (in bold) to accomplish this. This could also be handy for customers with a large amount of defined text on their contact page… as it will load the selected first field of the form as well.

if ($current_page_base == 'contact_us') $zv_onload = '';

If I remember, I will update the module with this information and resubmit it to Zen Cart.

Tags: , , , , , , ,

Comments are closed.

Template Original