Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    25
    Plugin Contributions
    0

    Default New item added to cart when editing an existing item

    I've noticed when a customer adds a product to their cart then edits the order, it doesn't edit the item in their cart but instead addes a new identical item to the cart with the new option selected.

    Lets use a shirt offered in S,M,L sizes as an example.
    1. Customer goes to Shirt page selects Size M and adds to cart
    2. Customer decides they really want a Small and clicks on the item in the cart to modify the order.
    3. Zen-cart pulls up the item from the cart with the Shirt showing the Medium size the customer originally selected.
    4. Customer changes from M to S and clicks the "Add to Cart" button

    Now the shopping cart shows 2 shirts in the cart 1 in Medium and the other in Small.

    Any suggestions on how I might go about changing the function of the "Add to Cart" button into more of a "Save Changes to Item" button? Where it modifies the original item clicked on rather than adding a brand new item to the cart?

    Thanks!

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: New item added to cart when editing an existing item

    At this time, the Add to Cart is adding the Products as if they were separate items:
    Small
    Medium

    Otherwise, how do I buy a Small and Medium for the same order?

    We will be looking into Update vs Add to Cart options in future releases ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: New item added to cart when editing an existing item

    Quote Originally Posted by Ajeh View Post
    At this time, the Add to Cart is adding the Products as if they were separate items:
    Small
    Medium

    Otherwise, how do I buy a Small and Medium for the same order?

    We will be looking into Update vs Add to Cart options in future releases ...
    Thanks! glad to hear this might get addressed in future versions.

    Regarding your question of how to put both a small and medium item on the same order it's relatively easy.

    Only display the "Update" button if the user has navigated back to the product page using the Title of the item linked from the shopping cart. As this will put the products_id in the URL

    A fast check for this is:
    Code:
    if(is_array($_SESSION[cart]->contents[$_GET['products_id']])) { //display update button }
    with some error checking to make sure the $_GET and $_SESSION are sanitized valid data.

    This way if the user arrived back at the shirt page any other way besides attempting to edit the existing item, it just gets added to the cart like normal. If it was an attempt to edit they still have the option to add it as an additional item to cart or update the existing one.

    I've already added this function to the site I'm working on but it requires the user go through the additional step of figuring which of the 2 nearly identical items in the cart is the one they don't want and manually deleting it.

    thanks again!

 

 

Similar Threads

  1. v151 - main menu disappears when item added to shopping cart.
    By HammurIT in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 May 2015, 11:38 AM
  2. Editing Shopping Cart Sidebox to display only last item added
    By shakes222 in forum General Questions
    Replies: 1
    Last Post: 26 Oct 2010, 05:23 PM
  3. Item value charging twice when added to cart
    By Bikebits4you in forum Basic Configuration
    Replies: 4
    Last Post: 8 Jan 2010, 02:10 PM
  4. Replies: 0
    Last Post: 17 Mar 2009, 03:22 AM

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