Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default 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.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Simple javascript breaks 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default 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-->

  4. #4
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default 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.

  5. #5
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default 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?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default 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?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Dec 2004
    Posts
    104
    Plugin Contributions
    0

    Default 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.

 

 

Similar Threads

  1. Adding Google Translate Widget to website not working - "Breaking" layout
    By structuredcable in forum Addon Language Packs
    Replies: 5
    Last Post: 29 Oct 2013, 02:48 PM
  2. Replies: 3
    Last Post: 17 Oct 2013, 06:37 PM
  3. Simple add to cart button in Product info page
    By Macbos in forum Setting Up Categories, Products, Attributes
    Replies: 11
    Last Post: 14 Dec 2012, 07:09 PM
  4. Trying to add header links without breaking my layout
    By lalakerman in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Jul 2008, 08:46 PM
  5. super simple "add to cart" method? Flash site
    By spamuel in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Apr 2008, 04:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR