When you add two products to a product display, and one has stock enabled for its product type, and the other one doesn't, the product that doesn't require stock is automatically marked as Out of Stock.

Comments

guy_schneerson’s picture

Assigned: Unassigned » guy_schneerson

and I thought I had all combination of products possible on my test site.
Will look into it.

guy_schneerson’s picture

the good news is: its only an issue on version 1 :)

guy_schneerson’s picture

OK i fixed the issue but its not going to be easy to implement.

I am attaching two patches:

enabled_stock_not_allways_checked_1415870_3.patch
This fixes the logic so the form validate always checks that stock is enabled, that's good because products with stock disabled can get validated when in a product display holding other products with stock enabled.
I see no issues in committing this patch (after testing).

enabled_stock_and_disabled_stock_ine_one_dispaly_1415870_3.patch
This is a small patch but potentially problematic:
The existing code sets: $stock_enabled[$key] = TRUE; if a product has no stock field.
The patch changes this to: $stock_enabled[$key] = FALSE;

The reason for the original code is that the stock field in the past did not default to zero, so a missing stock field was evaluated as zero.
While this has been fixed people that have enabled stock on products before this was fixed may have products that are showing as out of stock that will suddenly become available if this patch is committed.

I don't see an easy way to resolve it possible options:
1) create a more comprehensive patch that add an update that upgrades all existing products first (volunteers?).
2) not commit the second patch and update the readme file and documentation explaining & pointing to the patch.

Any other idea, let me know

guy_schneerson’s picture

Status: Needs review » Fixed

enabled_stock_not_allways_checked_1415870_3.patch is now committed as part of: http://drupalcode.org/project/commerce_stock.git/commit/0fcb18d.

will not commit enabled_stock_and_disabled_stock_ine_one_dispaly_1415870_3.patch (see #3 for more details)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

guy_schneerson’s picture

Category: bug » task
Status: Closed (fixed) » Active

It has been a while so will probably roll out enabled_stock_and_disabled_stock_ine_one_dispaly_1415870_3.patch with a warning in the read me file and release notes

lsolesen’s picture

Issue summary: View changes
Status: Active » Needs work