close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Shopping-Cart Quantity Updates

Thread began 12/01/2009 4:07 am by dnys04173367569 | Last modified 12/08/2009 3:39 pm by Jason Byrnes | 2011 views | 5 replies |

dnys04173367569

Shopping-Cart Quantity Updates

I have a couple of problem's with how the shopping cart system seems to be working in Ecart.

Problem 1:

I have set-up a basic page with two seperate add to cart buttons for two seperate products.

When I add the first item to the shopping cart the product is added to the cart correctly.

However, many online customers will try and change the quantity of items in the cart by entering a new value in the Quantity Field and then press the <Enter> key on their keyboard to update the quantity. [Which seems to be standard on many web sites].

However, Ecart does not seem to accept this type of update in the quantity field when there is only one item in the cart and therefore customers have to always use the update button.

Is there anyway this can be made to work with the quantity field, without putting a dropdown list in and made to accept only values. As currently if a customer enters any text in the quantity field and uses the Update Cart button the item is removed from the cart and I expect the same would happen if the <Enter> button option was made available and text was entered by mistake.


Problem 2 and more concerning

When I add a second item to the shopping cart the second item is also added to the cart

However, if the online customer then attempts to update the quantity of any of the items in the cart by entering a new value in the Quantity Field and then press the <Enter> key on their keyboard to update the quantity. They are sent back to the page they orignally came from.

I know that customers could then go back into the cart and enter the quantity and hopefully remember to press the update cart button, but there is a good potential that customer may decide to move away from the site because of the problem.

------------------------------------------------------------------------------------

I am raising the issue as it happens not only on the main site I am currently developing, but has happened in a test site of just two main pages, developed in Ecart alone.

Page 1 - Includes the two Add to Cart Buttons

Page 2 - The Cart

------------------------------------------------------------------------------------

Is there some setting that I need to make to make this work properly as I am aware that some Webassist sites do not have this problem. My website is being developed in PHP.

Sign in to reply to this post

Jason ByrnesWebAssist

these two issues are related to the same cause.


The Continue, Update and Clear cart buttons are all submit buttons on the cart form.


When you press the enter key, it will activate the first submit button on the page.


by default, the continnue shopping button is the first one:

html:
<input type="submit" name="WA_Store_Cart_Continue_100" id="WA_Store_Cart_Continue_100" value="Continue Shopping"  alt="Continue Shopping" />
<input type="submit" name="WA_Store_Cart_Clear_100" id="WA_Store_Cart_Clear_100" value="Clear Cart" alt="Clear Cart" />
<input type="submit" name="WA_Store_Cart_Update_100" id="WA_Store_Cart_Update_100" value="Update Cart" alt="Update" />





you can rearrange the buttons so that the update button is the first one:

html:
<input type="submit" name="WA_Store_Cart_Update_100" id="WA_Store_Cart_Update_100" value="Update Cart"  alt="Update" />
<input type="submit" name="WA_Store_Cart_Continue_100" id="WA_Store_Cart_Continue_100" value="Continue Shopping" alt="Continue Shopping" />
<input type="submit" name="WA_Store_Cart_Clear_100" id="WA_Store_Cart_Clear_100" value="Clear Cart" alt="Clear Cart" />





this way the update will be triggered when the user hits the enter key.

Sign in to reply to this post

dnys04173367569

I appreciate the quick response and this seems to have partially solved the following :

After re-arranging the buttons so that the update button is the first one triggered when the user hits the <Enter> key. This has successfully solved the issue that I was having where the end user would be directed back to the previous page, now the cart no longer goes to the previous screen when pressing the <Enter> key in the quantity field. Thanks.

---------------------------------------------------------------------------------------

When there is more than one item listed the user is able to change any of the quantities by pressing the <Enter> key. However the problem still remains that the end user is still unable to change the quantity by hitting the <Enter> key, if there is only one item in the cart.

Only one item in cart - <Enter> key does not update quantities.
More than one item in cart - <Enter> key works and updates quantities.

If the cart had more than one item in it, then the end user reduced the number of items back to only one item listed again, the <Enter> button will again not change the quantity of that item by entering a value and pressing the <Enter> key.

I have checked this on my two page test site, the main site I am currently working on and someone elses live site that has been created using Ecart.

---------------------------------------------------------------------------------------

I also still have the problem that if there is more than one item in the cart and the end user enters none numerical characters in the quantity field the line is deleted in the cart. How can I get the cart to not accept the input of none numerical characters in the Quantity field if there are more than one item in the cart.

I would appreciate any responce on the two issues above.

Sign in to reply to this post

Jason ByrnesWebAssist

The First problem is browser specific. In IE, if there is only one item, the enter key will not work, in FireFox, though, it does.

Unfortunately, there is not a way to force IE to behave differently in this situation. The problem is caused by a bug in IE and the way it deals with forms that have only one text box.

Forms in IE that have only one text box will not send the submit button as part of the form when the enter key is used to trigger the submit.


The update cart behavior is triggered on the Update Cart submit button.
When there is only one quantity field present in the form, the Update Cart button is not included as part of the forms submitted information when the enter key is pressed, so the update cart behavior cannot be triggered.

For the second problem, find the following code in the ecart include file:

php:
if (isset($_POST[$this->CartName."_Quantity_".$n])) {

      $itemQuantity = floatval($_POST[$this->CartName."_Quantity_".$n]);
    }




and change it to:

php:
if (isset($_POST[$this->CartName."_Quantity_".$n]) && is_numeric($_POST[$this->CartName."_Quantity_".$n])) {

      $itemQuantity = floatval($_POST[$this->CartName."_Quantity_".$n]);
    }




The eCart include file will be in the WA_ecart folder, it will have the following naming convention:
<Cart Name>_PHP.php

where <Cart Name> is the name of the cart.

Sign in to reply to this post

dnys04173367569

Positive Support - Many Thanks

Thank you for the responce.

The change to the Quantity code works perfectly - Many thanks.

I do hope that the developers at Webassist will update the relevant quantity code element in any future update. So that I and others do not need to look to do the change in any future developments, I can not see why the change would be a issue to anyone as quantities would always be a numerical value in my view.

As for the second issue - yes IE is the problem - I have added a hidden form element between the buttons and the closing </form> which solves the issue in IE. However, I would like to know if any developers have views on how secure and appropriate this maybe.

I do believe that the ability for customers/end users to be able to adjust quantities the same way at all times is beneficial.

Because I have added the hidden element outside of the repeating area I do not believe that it would be too detrimental to page loading as it will not be repeated as more and more items are loaded into the cart.


code php.....

<td><input type="image" src="../../img/form/btn_proceed.gif" value="Checkout" name="Checkout_1" /></td>
</tr>
</table>
<input name="" type="text" value="" style="display: none;" />
</form>

Sign in to reply to this post

Jason ByrnesWebAssist

This has been logged as a bug, so should be addressed in future updates to ecart.


As for adding an extra hidden element to the page, I see no problems with this approach, it should not effect load time or security.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...