Here is the scenario:

1. Set a product to have a stock count of 1
2. Go to a node that references this product
3. Click 'add to cart' button
4. On the refreshed page, the button still says 'add to cart'

This is incorrect behaviour.

Furthermore:

5. Click 'add to cart' again
6. The user correctly sees an error message, but the text is "The maximum quantity for PRODUCT that can be ordered is 1."

That's unhelpful, and untrue. There is no prohibition against ordering more than 1 of this product, it just so happens that *right now* you can only buy one because there's no more stock.

Comments

guy_schneerson’s picture

Category: bug » support
Priority: Major » Normal

Hi @joachim,
The idea behind stock version 2 is to provide flexible rules integration that allows users to customize the behaviour of stock control.
I have provided a very basic rule set and when Stock 2 is close to a full release I will probably ship it with one or more comprehensive rule sets. The nature of rules is such that it is difficult to update rules as those are configuration based and not in code so unlikely to do this before an RC version.
However if you have time you can create a sandbox module with alternative rule sets and I will be happy to add a link from the project page and possibly include it in a later version.

As far as this specific issue. the value stock-already-ordered is passed into the rule and you can use it to compare the stock level and disable the add to cart. As far as messages go these are easily configured using rules.

joachim’s picture

Category: support » bug

I thought the point was that this should work out of the box?

guy_schneerson’s picture

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

as i explained above will not commit to the rule set (works out of the box) untill a latte beta or an RC, until then users will need to configure rules.
I have started a new issue https://drupal.org/node/1744468 and any input would be helpful

guy_schneerson’s picture

Status: Closed (works as designed) » Postponed
guy_schneerson’s picture

Title: button should disable when stock reaches 0; error message unhelpful » Button should disable when stock level combined with the cart line item level is zero
joachim’s picture

> The nature of rules is such that it is difficult to update rules as those are configuration based and not in code so unlikely to do this before an RC version.

I don't understand what you mean by this.
The rules are defined in hook_default_rules_configuration(). You can change that code and the rules change.

The problem potentially lies in users who have already customized those rules, and who will find themselves with the quandary of either reverting their changes to get the new change from the code, or stick with their customization, or merge them somehow.

But this is a problem that faces any module that provides default components: the most common types being rules and views. This does not stop modules that provide default rules or views making changes to these when they can be improved.

Furthermore, in not fixing the problem, you're actually compounding it. Because anyone needing stock control right now is in a position where they have to customize the rule, because in its current state it's unusable. Therefore, rather than causing a minor, expected problem to anyone who's installed this since the alpha came out, you'll be causing this problem to those people plus everyone else who installs it between now and whenever you fix this. Which is more people.

So I don't understand why you're refusing to acknowledge this as a bug report -- I can't fathom of a client who's satisfied with this behaviour -- or why you're marking it as postponed.

guy_schneerson’s picture

Hi @joachim
Yes it is the issue of losing user configuration and I do not want to make incremental changes to the provided rules. I think it is reasonable to ask users (i will clarify this in the project and readme) to take control of the rules on an alpha version and feedback.
However I will use all constructive ideas and will be happy to consider a complete UI proposal earlier if one is provided, this is why I created a specific issue following the issues you raised.

brunorios1’s picture

please ignore this comment...
i didn't see that there is a "commerce simple stock rules" that provides the simple functionality out of the box...
thanks!