Announcement

Collapse
No announcement yet.

Allow calculate shipping on ENTER press.

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

  • Allow calculate shipping on ENTER press.

    I was informed today by tennesseecheesecake that when you pressed "enter" in the zipcode area it actually cleared the cart... this is due to the fact that the clear cart, shipping, and coupon code all use the same form.

    I have checked other peoples carts and while no other cart cleared the items (must be my customization) it also did not calculate the shipping, simply nothing would happen on an enter press for shipping zip.

    I have found a solution:

    Code:
    <input style="height:21px;  text-align:center; margin-top:2px;" onFocus="if(this.value == 'Zip Code') { this.value = ''; }" 
    onBlur="if(this.value == '') { this.value = 'Zip Code'; }" 
    onkeypress="if (event.keyCode == 13) { document.getElementById('shipping').click(); return false; }"
    type="text" name="shipping_zip" size="8" value="Zip Code" id="Text3">
    
    <input id="shipping" type="button" value="Go!" class="btn"
    onClick="document.shipquote.shipping_zip.value=document.recalculate.shipping_zip.value;document.shipquote.submit();" 
    onMouseOver="this.className='btn_over'" 
    onMouseOut="this.className='btn'" name="Button4">
    By the way, this code will also autofill the text area with "zipcode" but clear the area when the customer clicks on the text area to enter their zip. I prefer this to having to say "zipcode: [Text Area]", and anytime you autofill text in, you have to make sure it clears when clicked, or the customer will have to delete the text, which is annoying!
    Last edited by NMTEACO; 08-10-2011, 08:01 PM.

  • #2
    David,

    This is great! Thank you for posting your solution. 3dcart should pay you for this. I can't imagine why they wouldn't just fix this themselves.

    Thanks again!

    Comment


    • #3
      Originally posted by tennesseecheesecake.com View Post
      David,
      3dcart should pay you for this.

      Thanks again!
      I'm not going to hold my breath ;)

      Comment


      • #4
        A little clarification for those of you who may want to fix this problem and just want to copy and paste. This is for the regular view cart not quickcart. You are on your own for quickcart.

        It is the view_cart.html template, available in the common folder if you haven't edited it yet.

        Open up your view_cart.html file in notepad or some other text editor and search for ShipQuote.

        Then...

        Replace this:
        Code:
        <!--START: ShipQuote-->
        					<tr class="alternative">
        						<td class="item" width="150" align="right"><strong>[viewcart_shipping-header]</strong></td>
        						<td><input type="text" name="shipping_zip" size="14" value="[shipping_zip]" class="txtBoxStyle" id="Text3"></td>
        						<td width="15"><input type="button" value="Go!" class="btn" onClick="document.shipquote.shipping_zip.value=document.recalculate.shipping_zip.value;document.shipquote.submit();" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'" name="Button4"></td>
        						<td class="item">[viewcart_shipping-message]</td>
        					</tr>
        					<!--START: viewcart_ship-->
        					<tr class="alternative">
        						<td>&nbsp;</td>
        						<td class="item" colspan="4"> [shipping_city] [shipping_state] [shipping_zip]<br />
        							<select class="txtBoxStyle">
        								<!--START: Shippers-->
        								<option><b>[OPTION-SHIPPER]</b> <i>[OPTION-DESCRIPTION]</i> [OPTION-PRICE]</option>
        								<!--END: Shippers-->
        							</select>
        							&nbsp;
        							<input type="button" class="btn" value="Clear" onClick="document.shipquote.action='shipquote.asp?action=clean';document.shipquote.submit();" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'" id="Button5" name="Button5">
        						</td>
        					</tr>
        					<!--END: viewcart_ship-->
        					<!--END: ShipQuote-->
        with this:
        Code:
        					<!--START: ShipQuote-->
        					<tr class="alternative">
        						<td class="item" width="150" align="right"><strong>[viewcart_shipping-header]</strong></td>
        						<td><input style="height:21px;  text-align:center; margin-top:2px;" onFocus="if(this.value == 'Zip Code') { this.value = ''; }" onBlur="if(this.value == '') { this.value = 'Zip Code'; }" onkeypress="if (event.keyCode == 13) { document.getElementById('shipping').click(); return false; }" type="text" name="shipping_zip" size="8" value="Zip Code" id="Text3">
        						<td width="15"><input id="shipping" type="button" value="Go!" class="btn" onClick="document.shipquote.shipping_zip.value=document.recalculate.shipping_zip.value;document.shipquote.submit();" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'" name="Button4">				<td class="item">[viewcart_shipping-message]</td>
        					</tr>
        					<!--START: viewcart_ship-->
        					<tr class="alternative">
        						<td> </td>
        						<td class="item" colspan="4"> [shipping_city] [shipping_state] [shipping_zip]<br />
        							<select class="txtBoxStyle">
        								<!--START: Shippers-->
        								<option><b>[OPTION-SHIPPER]</b> <i>[OPTION-DESCRIPTION]</i> [OPTION-PRICE]</option>
        								<!--END: Shippers-->
        							</select>
        							 
        							<input type="button" class="btn" value="Clear" onClick="document.shipquote.action='shipquote.asp?action=clean';document.shipquote.submit();" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'" id="Button5" name="Button5">
        						</td>
        					</tr>
        					<!--END: viewcart_ship-->
        					<!--END: ShipQuote-->
        And viola. David is a genius and has a cool store. Go buy some tea.

        -Will
        www.tennesseecheesecake.com

        Comment


        • #5
          Thanks! haven't installed it but will tomorrow. I know we are getting abandons when people put in the zip, hit enter and get nothing.

          Comment


          • #6
            Just installed the code. Works great. Thank you.
            David
            David's Gifts and Things

            Wholesale Gifts, Home Decorating, Jewelry and More

            Quality, Selection, Value Always

            The more you buy the more you save!

            Comment


            • #7
              Couldn't wait, and working here just fine.

              Much better! May take out the "zip code" fill in but huge difference to the customers experience.

              Thanks David for the code and thanks Will for making it a ten second job.

              Comment


              • #8
                "Clear Cache" is your friend - Works great! Thanks!

                Comment


                • #9
                  Thanks so much for sharing - I didn't realize this was happening until I saw this thread.

                  You have a wonderful site by the way :)
                  Chris
                  TC Life Safety
                  TC Wireless

                  Comment


                  • #10
                    Is there a sample of the actual code section that needs replacing?
                    The whole section has too many style changes for us to use cut and paste.
                    Thanks!

                    Comment


                    • #11
                      Originally posted by Mark View Post
                      Is there a sample of the actual code section that needs replacing?
                      The whole section has too many style changes for us to use cut and paste.
                      Thanks!
                      yes, the code is in blue and red in my original post. Its a java-script line that needs to be added to the the form field, and then you need to add an ID to the button, so it knows which button to press.

                      Comment


                      • #12
                        Thanks, I'll try that. The code posted is very different from ours. We have the older code. none of that Blur, onFocus or onkeypress or anything that remotely resembles that. :)

                        Comment


                        • #13
                          Originally posted by Mark View Post
                          Thanks, I'll try that. The code posted is very different from ours. We have the older code. none of that Blur, onFocus or onkeypress or anything that remotely resembles that. :)
                          The onblur and onfocus stuff is the customization, that's what your trying to avoid, so just stick with the blue one "onkeypress"; that's how it knows you press enter.

                          Comment


                          • #14
                            Thanks!
                            Got it working. This should help alot!
                            Thanks for the tip, folks! :)

                            Comment


                            • #15
                              Awesome! Thank you so much.
                              ____
                              kem
                              AddressNumbers.com
                              Address Plaques, Memorials, Specialty Items and more
                              Last edited by kem; 08-13-2011, 05:09 PM.
                              kem
                              AddressNumbers.com
                              Address Plaques, Memorials, Home & Garden Decor, Gifts and more.

                              Comment

                              Working...
                              X