Announcement

Collapse
No announcement yet.

Add To Cart in div format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add To Cart in div format

    I'm having a bit of an issue here, I've moved my site over to a div format as tables annoy me and im getting an error with the add to cart button on the listing page.

    I've got everything within the same call functions and my "buy" buttons one category pages, the home page and related items works... just not the add to cart function.

    <!--START: addtocart-->
    <!--START: quantity-->
    <!--START: quantity_items-->
    <span class="listprice">[lowbound][highbound]</span>
    <span class="listprice">[PRICE]</span>
    <!--END: quantity_items-->
    <!--END: quantity-->
    <div class="listprice"><strong>[product_quantity]</strong>
    <!--START: qtybox-->
    <input type="text" size="3" name="qty-0" value="1" onChange="validateValues(document.add,1);">
    <!--END: qtybox--></div>
    <!--START: reminders_block-->
    <div class="listprice"><strong>[product_reminder]</strong>
    <select name="reminder" class="txtBoxStyle" ID="Select1">
    <!--START: reminders_frequency_option-->
    <option value="[optionvalue]" [selected]>[optiontext]</option>
    <!--END: reminders_frequency_option-->
    </select></div>
    <!--END: reminders_block-->
    <input type="button" onClick="check_and_add(document.add);" name="Add" value="[product_addtocart]" class="btn" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'">
    <!--END: addtocart-->
    Last edited by Gaelen; 07-11-2011, 01:54 PM.

  • #2
    Without a test and live template and not sure if it matters but this may be the missing link

    class="price-info"

    in your add to cart button
    .
    Clayton
    Go Live Industries

    Comment


    • #3
      that's a style and shouldn't affect the button function at all. But to be sure I tried it with no results

      Comment


      • #4
        I've changed the button to
        <input type="button" value="[product_addtocart]" onClick="window.location='add_cart.asp?quick=1&ite m_id=[catalogid]'" class="btn" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'">
        and it works except if you want to add multiples of a single item. I'm still stumped but this might help debug it

        Comment


        • #5
          Code:
          <!--START: qtybox-->
          <input id="qtybox" type="text" size=2 name="qty-0" value=1 onChange="validateValues(document.add,1);">
          <!--END: qtybox-->
          
          <!--START: addtocart-->
          <div class="buttons" align="center" style="margin-top:5px;">
          <button type="submit" name="www" class="positive" onclick="check_and_add(document.add);"><img src="assets/images/designelements/icons/cart_put.png" alt=""/> 
          Add To Cart</button></div>
          <!--END: addtocart-->
          This is my actual add to cart button and quantity (dont know if that helps)... be sure you have all the java script intact...

          Comment


          • #6
            Thanks for the reference, although I can't see anything different from yours to mine. I'm going to check through my JS files and see if something is double referencing

            Comment


            • #7
              I don't know your original code but this would be the result of mine.

              Code:
              <!--START: addtocart-->
              <div align="center" class="item">
              <strong>[product_quantity]</strong> 
              <div align="center" class="price-info">
              <!--START: qtybox--><input type="text" size="3" name="qty-0" value="1" onchange="validateValues(document.add,1);" class="txtBoxStyle"> <!--END: qtybox--><!--START: reminders_block-->
              <div align="center" class="price-info">
              <strong>[product_reminder]</strong><br />
              <select name="reminder" class="txtBoxStyle" id="Select1">
              <!--START: reminders_frequency_option-->
              <option value="[optionvalue]" [selected]>[optiontext]</option><!--END: reminders_frequency_option-->
              </select> <!--END: reminders_block-->
              <div align="center" class="price-info">
              <input type="button" onclick="check_and_add(document.add);" name="Add" value="[product_addtocart]" class="btn" onmouseover="this.className='btn_over'" onmouseout="this.className='btn'">
              <!--END: addtocart-->
              .
              Clayton
              Go Live Industries

              Comment


              • #8
                my original code is posted above... and yours did not work either. Any other ideas?

                Comment


                • #9
                  AS frustrating as it is... you might have to go back and start over.

                  Copy the original code and past it into your template... see if the button works. If it does, then you know its something you did. If it does not, the problem is deeper.

                  If the copied code works, then cut and paste your new button to replace the button on the original file, but change nothing else... If that works then you know the problem is not the button, but something somewhere else on the page... keep working backwards until you find it.

                  Comment


                  • #10
                    I've copied the code out of the original template including the script in the page with no luck.

                    I have a feeling this is going to be a pain in the ass

                    Comment


                    • #11
                      The original code above is only a small section many times need to see and test the whole page.

                      Sounds like it may be time to delete the page. So 3dcart will reference the template from the common folder. (or copy page from common folder)
                      .
                      Clayton
                      Go Live Industries

                      Comment


                      • #12
                        I've written in a replacement for now, debugging day continues

                        Comment


                        • #13
                          I'm pretty sure that the <form> on the page is required for the button to work. Here is how my page does it:


                          Code:
                          <form enctype="multipart/form-data" method="post" action="add_cart.asp" name="add" id="add">
                          <div> <!-- encloses form -->
                          <input type="hidden" name="item_id" value="[catalogid]">
                          <input type="hidden" name="itemid" value="[id]" ID="itemid">
                          <input type="hidden" name="category_id" value="[catid]">
                          
                          
                          
                          <!--START: addtocart-->
                          	<div style="margin-top:5px">
                          		
                          		<div style="float:right">
                          			<strong>[product_quantity]</strong>
                          			<!--START: qtybox-->
                          			<input type="text" size="3" name="qty-0" value="1" onChange="validateValues(document.add,1);">
                          			<br>
                          			<!--END: qtybox-->
                          		</div>
                          		
                          		<div style="float:right;margin-top:5px">					
                          			<a href="javascript:{}" class="button red dropshadow rounded-corners_sm" onclick="check_and_add(document.add);" name="Add"><b>+ Add to Cart</b></a>	
                          		</div>	
                          		
                          		<br style="clear:both">	
                          	</div>
                          <!--END: addtocart-->
                          			
                          </div> <!-- encloses form -->
                          </form>

                          Comment


                          • #14
                            Thank you!

                            somehow I moved my add to cart button above the beginning of the form...it works again :D

                            Comment


                            • #15
                              No problem. I've managed to get my entire site into DIV and CSS format that validates 4.01 strict. Let me know if you have any more questions. I put some info in this thread: http://forums.3dcart.com/store-desig...-opinions.html

                              Comment

                              Working...
                              X