When I click the "Add to Cart" button, the attribute Select Lists for the Product reset to their default values. I tested this in the demo as well with the same results.

This is similar to another issue that was patched here: http://drupal.org/node/1286244

Comments

rszrama’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Yeah, I don't really know what the problem is here. This is as designed - it basically resets the form to its initial state because it chooses attribute options based on the default product. Once you've submitted the form, it's essentially a new version of the same form and does not react to prior items added to the cart. So, there's the issue you've linked, and there's also another that will allow the Add to Cart form to work as a line item edit form - basically to modify the parameters of a product from a group that's already been added to the cart. As for the behavior of the form itself, though, it's working as designed.

jimmins’s picture

If this is working as designed, then it is poor design. This is certainly not best practice for a user interface. Any fields that are set by the user should remain that way and not be reset to default values.

rszrama’s picture

Perhaps I misunderstood you, but you've already submitted the form, right? The purpose of that form is simply to make a selection and add it to a cart, not to leave that form in that state in perpetuity. The action has been taken, the message has been displayed, and the customer may have in fact browsed or been redirected away. So perhaps you're saying the Add to Cart process isn't actually triggering for you?

jimmins’s picture

Yes, the product is correctly added to the cart, and a message is displayed indicating that it has been added to the cart. The user remains on the product page, but the attribute selections (including the image) are reset to default values instead of retaining what the user selected.

This behavior can be seen in the demo: http://demo.commerceguys.com/dc/catalog/coffee-holders/mug

First, you see a black mug. If you change it to the white mug and click "Add to Cart", the image reverts back to the black mug. I would prefer for the page to remember the selections that the user made, and I believe this is in agreement with gui best practices.

Just my two-cents. Thanks for all of the hard work you guys are doing!

rszrama’s picture

I see what you're saying - it doesn't do this because the subsequent pageload has no information about what was finally submitted via the form. It's definitely worth considering if there's some way to transmit the last selected product across the redirect Drupal does at the end of a form submission if that's the expected behavior. I'll keep it in the back of my mind, as I'd love to avoid a $_SESSION hack and think we might be able to fix this in conjunction with the issue to use the Add to Cart form as a line item edit form.

jimmins’s picture

Awesome. Thanks Ryan!

mengi’s picture

I am having the same issue but in a different way.

When I have two list(text) fields for the product and the user makes his selections in the wrong order, such as choosing a option in the 2nd list and then selecting a option in the 1st list, then the 2nd list option will reset to default. This could lead to a user ordering the wrong product if they don't realize that the 2nd list option reset.

Any recommendations on what I could do? Is there a way to remove the dependencies that the list fields have or another way to do this? I have considered the 'product options' module, but I need to have each product variation to have their own SKU.

no2e’s picture

mengi, you should create a new issue for your request. Or search for an existing issue about your cause. This looks similar: #1286244: Allow dependent attributes to preserve their default options if a matching product exists on an Add to Cart form

nelslynn’s picture

Version: 7.x-1.2 » 7.x-1.6
Status: Closed (works as designed) » Active

Just wondering if this issue will ever be addressed? A few posts back Ryan suggests maybe this will be addressed? For a store situation where a product has many attributes and options to select from, the user experience is not good. The user might not notice options have changed simply by changing a 'certain' option, AND/OR they're not going to want to go back and reselect options that have just been 'reset' for them.

Here's an example of how a cart with multiple attributes should work. Note that no attributes change no matter what what attribute is modified
http://tinyurl.com/btkokat
This is a Wordpress/cart66 cart... maybe it can offer clues for the programmers on how to get Commerce to function like this (sorry, I wish I were a programmer)?

Or, maybe I'm missing something. Is there a way to set up attributes where they don't 'reset'?

Any suggestions would be appreciated. Thanks.

dlg0’s picture

I too would like to ask if there are plans to have this issue addressed?

jessepinho’s picture

I'd really like to see this issue addressed as well. Here's one possible approach: on each product field, there's a checkbox that reads: "Enable this field to function as an attribute field on Add to Cart forms." What if there were another checkbox beneath it that said: "Save user preferences for this field"? Then, for the rest of that user's session, the value she chooses for the particular field is auto-selected. Perhaps there could also be another checkbox that could determine whether to save the user's preference just for that particular product display, or also for any other product displays whose products have that field. Thoughts?

Tmanagement’s picture

amazing, thought that this was a bug! seems like it is expected behavior and indeed not user friendly. In my opinion it should be designed without a predefined sequence starting from the first going to the last. The idea behind it is that every selection is a single product. So why should it matter from which attribute you start? Depending on each selection you will find more or less attributes that can be selected as second, third, fourth etc .

By all means, do not add extra check boxes in the administrator area. Perhaps I am missing something but the above solution should be feasible I think.

jessepinho’s picture

@Tmanagement: you seem to be confusing this issue with #1286244: Allow dependent attributes to preserve their default options if a matching product exists on an Add to Cart form.

Another way this could be fixed: after adding to cart, the $form_state['redirect'] of the add to cart form could be set to the current URL, plus a query string containing the elements selected (like the Prepopulate module). The add to cart form could always check for such a query string, and if it exists, it could set its default values accordingly. That way, you can kill two birds with one stone: allow the add to cart values to remain the same after adding to cart (for just ONE pageload), and allow people to bookmark particular products in a multi-product product display node.

Thoughts?

Tmanagement’s picture

Hi Jessepinho,

Indeed my issue is discussed in the url given. However, your redefined solution seems much better! I am not in the position to comment on technical issues that might accompany your solution but from an UX standpoint much much better than #11

roball’s picture

Title: Add to Cart resets attribute select lists to default values » Do not reset attributes to default product on submitting the [ Add to Cart ] form
Version: 7.x-1.6 » 7.x-1.9
Category: Support request » Feature request
Issue summary: View changes

+1 for checking the QUERY_STRING, so it is possible to directly link to a certain product selection within a multi-product product display node. Currently this does not seem to be possible.