Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Adding my simple javascript is breaking my add to cart

Adding my simple javascript is breaking my add to cart

Locked

Views: 1,084

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
27 Jan 2009, 12:42 AM
#1
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Adding my simple javascript is breaking my add to cart

Why would adding

<br class="clearBoth" /> <br><br> <center><FORM> <INPUT TYPE="button" VALUE="Add to Favorites" onClick='window.external.AddFavorite(location.href, document.title);'> </FORM></center>

between bof and eof anywhere above <!--eof Add to Cart Box--> on tpl_product_info_display.php

break my add to cart button, nothing happens. It does not matter where I put it. I have rearranged the page a lot, but all of the sections are complete.

The add to favorites that the java creates works, but it breaks the cart. Is this a common bug? I was trying to add it after my short description. I tried with and without <br class="clearBoth" /> and it does not make a difference.

I can put it under <!--eof Add to Cart Box--> and it works ok??
Thanks for any help on the matter.

Zen cart 1.3.8a
attribute_popup_large_images_1-0-3 and short description are the add ons that are related to this page.

27 Jan 2009, 12:46 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Adding my simple javascript is breaking my add to cart

... because you're likely putting your extra form between existing <form> and </form> tags, thus breaking the existing add-to-cart form already on the page.

27 Jan 2009, 1:54 AM
#3
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Re: Adding my simple javascript is breaking my add to cart

I can't see that this is the case. EXCEPT for the fact that at the end of the page in tpl_product_info_display.php (on my version and on the default version)
there is

<!--bof Form close--> </form> <!--bof Form close--> </div>

Any idea if this is the cause or how to solve, there is no <form> on the page.

Earlier on the page is the following, but I don't think it would have any relevance.

<!--bof Form start--> <?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?> <!--eof Form start-->
3 Feb 2009, 6:08 PM
#4
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Re: Adding my simple javascript is breaking my add to cart

<!--bof Form start--> <?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?> <!--eof Form start-->

reads like this when viewing source:

<!--bof Form start--> <form name="cart_quantity" action="http://xxx/action/add_product" method="post" enctype="multipart/form-data"> <!--eof Form start-->

so I guess that would be the front form I could not find.

3 Feb 2009, 6:29 PM
#5
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Re: Adding my simple javascript is breaking my add to cart

That being said, I can put:

<br class="clearBoth" /> <br><br> <center><FORM> <INPUT TYPE="button" VALUE="Add to Favorites" onClick='window.external.AddFavorite(location.href, document.title);'> </center>

into the page where I want and double the </form> at the very end of the tpl_product_info_display.php like this

<!--bof Form close--> </form></form> <!--bof Form close--> </div>

is there any reason that this would be unadviseable?

3 Feb 2009, 7:21 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Adding my simple javascript is breaking my add to cart

Why do you need any <FORM> and </FORM> tags at all? After all, you're already inside a form anyway, right?

4 Feb 2009, 4:37 PM
#7
member avatar

member

Zen Follower

Join Date:
Dec 2004
Posts:
102
Plugin Contributions:
0

Re: Adding my simple javascript is breaking my add to cart

I removed the extra <form></form> and everything still works. I did it that way because it was the way the example code was shown. Thank you for the help, I appreciate it.