How does the Attribute Combination work in nopCommerce?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 年 前
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?
13 年 前
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.

.
13 年 前
Hi,

Is there a similar work around for version 1.90?

Thanks :)
13 年 前
The intended functionality for "Track inventory for this variant by product attributes" is to only track entries entered in "Attribute Combinations". Adding an entry and setting the stock quantity to 0 for an attribute combination that is unavailable will prevent it from being added to the cart or wishlist.

---

For 1.90, you can change the default behavior by adding the following code to: Libraries\Nop.BusinessLogic\Orders\ShoppingCartService.cs (after line #857) and recompiling the Nop.BusinessLogic project.
else
{
    warnings.Add(IoC.Resolve<ILocalizationManager>().GetLocaleResourceString("ShoppingCart.OutOfStock"));
}

With this change, attribute combinations that are not listed can not be added to the cart (will display an out of stock message).

.
13 年 前
Super...thanks a million :)

Is there a setting to allow the dropdowns to dynamically change depending on a selection? Or is this something that we would have to code into it ourselves?
13 年 前
Are there any configuration to change dinamically these combos to show only combinations that has stock?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.