Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / New item added to cart when editing an existing item

New item added to cart when editing an existing item

Locked

Started by jds580s on 23 Feb 2009, 5:24 PM · Views: 1,360

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
23 Feb 2009, 5:24 PM
#1
jds580s avatar

jds580s

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Post #1 by jds580s

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!

23 Feb 2009, 5:36 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #2 by ajeh

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? :blink:

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!

23 Feb 2009, 7:39 PM
#3
jds580s avatar

jds580s

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Post #3 by jds580s

Ajeh:

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? :blink:

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:

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!