acqy wrote:Hi,
I'd like to know how does the attribute combination work in nopCommerce?
I was setting up a product with two attributes for a variant, which are Size and Color. I defined two combinations in attribute combination setup page: Size=8/Color=White, Size=9/Color=Blue.
When I was opening the product details page, it provided me two combo boxes that allowed me to specify the Size and Color. However these two combo boxes was populated with all "available" values for each attribute (like, the Size combobox has two options: 8 and 9, and the Color box also has two options: White and Blue). Therefore, I was still able to pick Size=9, Color=White, which was NOT defined in my attribute combination. The entire checkout process also worked smoothly without indicating me that I was chose an invalid attribute combination. What's wrong?
For the product variant, have you selected, "Track inventory for this variant by product attributes" for the
Manage Inventory option (on the "
Product Variant Info" tab)?
Additionally, after trying it out, it looks like unlisted combinations are not checked for being in-stock or not and the customer can add them to their cart. As a workaround, you can add the unavailable combinations (Size=9, Color=White) with a quantity of 0.
This can be fixed by adding the following to file: Libraries\Nop.BusinessLogic\Orders\ShoppingCartManager.cs after line #722 and rebuilding the solution.
else
{
warnings.Add(LocalizationManager.GetLocaleResourceString("ShoppingCart.OutOfStock"));
}
This change is for version 1.60 and makes attribute combinations that aren't specified for a product variant unavailable (shows error as "Out of Stock" when trying to add to cart) when the Manage Inventory option is set to "Track inventory for this variant by product attributes". This differs from the default behavior of allowing unspecified combinations to be added to the cart for these types of items.
.