Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Shopping Cart quantity by attribute

Shopping Cart quantity by attribute

Locked

Views: 2,816

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
14 Aug 2008, 7:09 PM
#1
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Shopping Cart quantity by attribute

I searched the FAQ, but couldn't find this particular issue.

I need to set up my attributes on a product in a way that it forces the shopping cart to quantify the products based on attribute.

What the shopping cart does currently:
Customer buys Product A with Attribute (color) Red. Shopping cart now says "Product A, Red, quanity 1".
Customer then buys Product A with Attribute (color) Blue, and adds it to the current shopping cart. What the shopping cart now says is "Product A, Blue, quantity 2".

What I need is for the product to be defined by attribute, so the shopping cart says "Product A, Red, quantity 1. Product A, Blue, quantity 1."

Thanks in advance for any help! :D

25 Aug 2008, 5:13 PM
#2
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Re: Shopping Cart quantity by attribute

A follow up on the problem:

Still haven't found any setting that has fixed the issue. The only mod I've installed (before I made the initial post) was the "Group Price per Item" mod. However, the logins I'm using don't use any Group Pricing, and that doesn't seem to be the cause of the issue.

Also, it appears that the problem occurs when a user attempts to buy multiples of the same product, just with different non-priced attributes (in my specific case, having two item As, but just different colors).

I'm using version 1.3.8a of Zen Cart, and version 1.3.8 of the database patch level.

Any ideas guys? I'm stumped. :huh:

26 Aug 2008, 6:27 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Shopping Cart quantity by attribute

Zen Cart should be loading Products with different attributes as separate line items in the shopping_cart ...

Have you an URL where we could perhaps peek at this and see what it is doing?

26 Aug 2008, 8:22 PM
#4
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Re: Shopping Cart quantity by attribute

Sure! Here's the live site:
http://store.nationalminitrucks.com

I created a dummy login so you can try it out for yourself:
zencart (yes, I created a non e-mail login just for this)
zenned

(On Edit: zencart login does not use any Group Pricing, nor has it been set up beyond default login settings)

This does the same thing on regular, standard logins, so the non-standard one isn't doing anything.

To reproduce the issue:
Go to 'Mini Hauler' section.
Leave all attributes alone, except color. Pick any color (Pure White is default), and add to cart. Note the cart is correct.

Go back to 'Mini Hauler' section (doesn't seem to matter how you get there).
Leave all attributes alone again, but pick a different color (any seems to do). Now the cart will say 2 of the Hauler, in the last color you chose. Refreshing won't help. If you go back to modify, the Mini Hauler section now reads 2 Haulers under the last color selected.

Repeating this will only increase the quantity of the same order, with the last color selected.

Thanks for the help! :smile:

27 Aug 2008, 5:03 AM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Shopping Cart quantity by attribute

Is this a clean v1.3.8 or an upgrade?

Do you have any add-ons added to your site?

This is not how the attributes should be working ...

If this is a clean Zen Cart v1.3.8 and you have no add-ons, are you able to setup a test site in a test directory with a test database with the demo data just to try this with the default products to see if they work, and if so, try to make a product similar to this one and see if it now works?

I am not seeing why your site would behave in this manner, off the top of my head ...

27 Aug 2008, 4:14 PM
#6
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Re: Shopping Cart quantity by attribute

It's a clean install. Fairly recently, so I haven't had to do any updates.

The only mod I've installed is the "Group Price Per Item v1.3". Only modification I've done on that is change the names of the four preset pricing groups, according to instructions that came with the mod. I installed this early on, before most of the store was set up. I installed it before SSL (see below).

The modifications I've made to the store itself has been layout only (mostly just colors and main site size). I've made no modification to any of the functional code. The database was set up by hand, one item at a time. No automation tool was used, and the database was set up from scratch (from an 'empty' default install database). The only odd modification that was made to the store beyond this, was that I activated SSL after most things were set up.

I ran a sample install on my local machine, running under the latest Apache server, using default install only. It's the same install I used to set up the web store. I was unable to duplicate the issue by remaking the item on the local store. It broke out the items by different attributes correctly.

27 Aug 2008, 4:17 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Shopping Cart quantity by attribute

Sounds more and more like something is bad on your site ...

Are you able to reload the files from a clean download of Zen Cart v1.3.8, if you have not made any changes to the code?

27 Aug 2008, 11:03 PM
#8
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Re: Shopping Cart quantity by attribute

Reloading clean files doesn't help. So I tried something else. I took my existing live store database, and imported it into my clean, non-modified, non-mod'ed local default install of zencart (using a local version of phpMyAdmin). That created a working copy of the store on my local machine.

When I went to add the Haulers, it exhibited the same behavior that it did on the online version, collecting different non-priced attributes together as a single order (with the exception that I get a "1364 Field 'customers_basket_id' doesn't have a default value" error on the first Hauler I try to add to the shopping cart. The error comes up, but the order still gets processed correctly).

This indicates that it's not the store's site code that's causing the problems, but something in the database itself (or somehow the database is set up in such a way that it's messing up the site's code functionality). The only modifications to the database itself are the four fields added by 'Group Price Per Item v1.3' (which are table columns, so should be ignored by the clean install), and for a couple logins created for special purposes by a couple of our clients, I have modified the login name so it doesn't contain an e-mail, but a name only (like the zencart login I gave here).

Hope this extra information helps!

28 Aug 2008, 3:02 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Shopping Cart quantity by attribute

pkazda:

1364 Field 'customers_basket_id' doesn't have a default value
That suggests that you are missing the "auto-increment" flag on that table, and most likely on all your tables.
Exporting and importing databases can sometimes lose that flag if you uncheck the option to include that data. Sometimes when moving between versions of MySQL that flag can also be dropped due to changes in the database engine.

That may or may not also be the cause of your attribute issues.

While the best way to fix your auto-increment issues is to work with a clean new install, you probably don't have one of those which also contains your live data.
So, there's a script in the /zc_install folder of the Zen Cart files which you can run to recreate all the autoincrement flags on the tables that come with a new install of Zen Cart.

28 Aug 2008, 5:22 PM
#10
pkazda avatar

pkazda

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

Re: Shopping Cart quantity by attribute

Alright, I believe I found the issue (and an odd one it seems to be at that).

First, the auto-increment script worked. Thank you. After that, I removed all side effects in the database from the Group Pricing Per Item mod, then deleted all customers and recreated a standard new one from scratch so I had, effective, a clean, unaltered install of the ZenCart code, plus a 'standard, default' database. The problem still existed. That indicated a problem with the product configuration, which is where I found this:

There appears to be a problem in ZenCart when parsing attributes in a certain way. I was able to reproduce the problem from scratch. It's remarkably simple (leading me to wonder if it's just on my install, if no one has just accidentally stumbled on it yet, or if they have, that for their configuration it actually mattered). This is how I reproduced the problem (I'll try to make this verbose so it can be produced without ambiguity):

I set up an item (priced at $6,522.22). For attributes, I included a checkbox attribute (with 2 items, pricing doesn't seem to matter, my example was vehicle chassis options), and then a radio attribute (with 2 items, pricing doesn't seem to matter, my example was colors). No images or other modifications are made (or needed). Order is important. I found though that the problem still exists if you insert another attribute (say a dropdown) between the checkbox and radio attributes, however only one checkbox and one radio is needed (for simplicity sake).

Reproducing the behavior of the issue: Make sure shopping cart is clear. (I did this next part logged in with a login that had Authorization Status 'Approved'.) Go to the product, select one checkbox attribute item (doesn't matter which one), and one radio attribute item (doesn't matter which one). Add to cart. Immediately return to item (doesn't matter how), and make sure the same checkbox attribute item is checked (no changes on the checkbox attribute should be made from the first product placed in the shopping cart). Select a different radio item. Add to cart. Now the cart groups the products together as a single order, quantity 2, of the last radio item selected. If a different checkbox item was selected, the cart breaks out the products correctly.

This problem works even if no radio option is selected the first time, then one is selected the second. What seems to matter is that the checkbox item stays the same (but checked), while the radio changes, on consecutive 'add to cat' operations.

The problem, fortunately, is easy to get around. I moved my color radio to the top, and it worked. I was seeing the problem largely because I had both the checkbox and radio items with a default item selected.

I hope this is clear enough. Can you reproduce this issue? If so, does anyone know a fix? If not, what would you suggest?

Thanks for all the help! :smile: