SUGGESTION : create product attributes the same way we create discounts - in one location so they ar

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Just want to add another name to those who are eagerly awaiting this feature.
13 years ago
I am just browsing for a solution to this, has that been integrated in any newer versions since last post?
13 years ago
Hi All,

Best practise might be a attributes pool, don't need to change current data structure. we put all attributes(black,white, small, large etc.) in a table, and put all of them into a multi-selection control then allow us to batch add attributes to a attribute category(size, colour etc.)

any comment?
13 years ago
haydie wrote:
@ esutter

since   the introduction of the product copy feature in v1.5 this is not so much of an issue (I still like the idea in principle )

but now you could spend a little time creating a template product with the different attributes and easily copy this  product - including all the attributes


still, every enhancement is a step forward - go vote for it :
http://nopcommerce.codeplex.com/workitem/7796


A Variant Copy feature that allows you to create template variants within the producty will also be useful for this and other purposes.
11 years ago
I just added a comment to the work item:

http://nopcommerce.codeplex.com/workitem/7796
11 years ago
esutter wrote:
I just added a comment to the work item:

http://nopcommerce.codeplex.com/workitem/7796


The concept of attribute templates is a key issue in Nop which has to be adressed. There are several threads in this forum requesting/commenting this feature. I think its worth commenting it and essuter has done a very good analysis that can be the basis for further discussion; therefore I am copying it below:

Goudinov wrote Today at 2:06 PM
Another avenue worth exploring would be attribute groups and attribute inheritance.

You could create many attributes outside of the product and place them into a group. For instance:

Group: Clothing Attributes
Attributes and values
Color - Red, Blue, Pink, White, Black
Size - S, M, L, XL

Then you have products
Short Sleeve Shirt
Long Sleeve Shirt
Tank Top Shirt
Hoodie
Jacket
Cap Sleeve Shirt
Baby Doll Shirt
Ringer Shirt
Crop Top Shirt
Toddler Romper

You add the "Clothing Attributes" group to all of these products.

From here, you would have some options for variations of the group.

Scenario #1
You add a new color that ALL products now come in. So you add "Purple" to the "Clothing Attributes" group. All products that use the Clothing Attributes group are now available in Purple.

Scenario #2
The Short Sleeve Shirts are now available in XXL size. You add the product attribute value of XXL to the Short Sleeve Shirt's "Size" attribute that it was using from the Clothing Attributes group

Scenario #3 Group Inheritance
Only the following six products are now available in GREEN and YELLOW. Short Sleeve Shirt, Long Sleeve Shirt, Tank Top Shirt, Cap Sleeve Shirt, Baby Doll Shirt, Ringer Shirt. You make a new attribute group "Clothing Attributes GY" which inherits "Clothing Attributes". To this group, you add the colors Green and Yellow, then change the Attribute Group for the six products from "Clothing Attributes" to "Clothing Attributes GY".
In this scenario, you can still apply the color purple to the original "Clothing Attributes" group and the "Clothing Attributes GY" would inherit the change making all product available in Purple while still only making the GY products available in Green and Yellow.

Scenario #4 (this is the opposite of Scenario #2)
The Long Sleeve Shirt is now no longer available in Pink. In the attributes for Long Sleeve, which uses the "Clothing Attributes" group, you specify that Pink is not available for that product only, but since it still inherits "Clothing Attributes", any additions to the group will be added to this product.

Scenario #4 (Opposite of Scenario 3)
Much like you could exclude an attribute value from a group for a particular product, you could exclude a value or attribute from a group which inherits a parent group.
Create "Clothing Attributes 2" group which inherits "Clothing Attributes" group
For "Clothing Attributes 2" group, make "Pink" unavailable.
Apply "Clothing Attributes 2" group to applicable products.

Does anyone else have a headache now, or is it just me?
11 years ago
eadameg wrote:
I just added a comment to the work item:

http://nopcommerce.codeplex.com/workitem/7796

The concept of attribute templates is a key issue in Nop which has to be adressed. There are several threads in this forum requesting/commenting this feature. I think its worth commenting it and essuter has done a good analysis that can be the bassis for further discussion; therefore I am copying it below:

Goudinov wrote Today at 2:06 PM
Another avenue worth exploring would be attribute groups and attribute inheritance.

You could create many attributes outside of the product and place them into a group. For instance:

Group: Clothing Attributes
Attributes and values
Color - Red, Blue, Pink, White, Black
Size - S, M, L, XL

Then you have products
Short Sleeve Shirt
Long Sleeve Shirt
Tank Top Shirt
Hoodie
Jacket
Cap Sleeve Shirt
Baby Doll Shirt
Ringer Shirt
Crop Top Shirt
Toddler Romper

You add the "Clothing Attributes" group to all of these products.


In the past weeks I have been checking how other shopping cart softwares (like Magento, ZdNode, etc.)  tackle this concept, so here are my two cents:

In Nop all product attributes are used for various purposes whereas in other software they distinguish:
- Combination Attributes Groups or Sets: which are variations (some call it Variants or interdependent attributes) of the same product which vary by sizes, colors, fabric, etc. They are similar to the Attribute Group defined by Goudinov but they include Inventory and other properties.Products have only one Group or  Set of Combination Attributes which include all which represent all the variatons of the same product (example color and size in Guodinov example). Normaly inventory is associated for each possible combination of the attributes (like it is done in Nop when you define the attribute combinations. See example in admin demo in ProductVariantAttributes tab>AttributesCombinations tab). In this case it is not necesary to define non-existant combinations (or they can be set with inventory=0).

- Simple attributes (or independent attributes): which are used for addons to the product such as embroiding or printing in clothes

- Associated Products: which are other products which could be bundled with the main product (examples the cufflinks for a shirt or the printer and additional software for a computer). In some shopping carts they are treated in anoter section/tab of the product, similar to Related Products.

Suggestion 1) Create Combination Attributes Group

They  would be as a Attribute Groups as defined by Goudinov, but they would include Inventory and SKU Modifiers (see this work item). Each product can have only one Combination Attributes Set and each set can built from up to 5 attributes (size, color, fabic, etc.).

It is important to mention that in garment industry (in which the concept of  Combination Attributes Groups is mostly used) it is very common to have a standard set of inventory for similar types of products (see example in table below). Each set for instance has the same inventory for each size (they follow the Normal/Gauss curve which reflects the demand for sizes), and some colors/fabrics with more demand have more sets (in example: White with 2 sets) or follow another size pattern (as in example: Black)
                INVENTORY         
  S  M  L  XL  XXL
Red  1  2  3  2  1
Blue  1  2  3  2  1
Pink  1  2  3  2  1
White  2  4  6  4  2
Black  1  3  4  3  1

Below is a table with an example of SKU Modifiers. The SKU of each combination is built appending the SKU Modifier to the SKU of the product variant (example: 123). So for the Red-M the SKU would be 123-R-M.
                               SKU MODIFIERS          
  S  M  L  XL  XXL
Red  -R-S  -R-M  -R-L  -R-X  -R-XX
Blue  -Bu-S  -Bu-M  -Bu-L  -Bu-X  -Bu-XX
Pink  -P-S  -P-M  -P-L  -P-X  -P-XX
White  -W-S  -W-M  -W-L  -W-X  -W-XX
Black  -Bl-S  -Bl-M  -Bl-L  -Bl-X  -Bl-XX

The Attribute Combination  table would look similar to this:
.Red S 1 -R-S
.Red M 2 -R-M
...
There are 2 options to build/edit the table (both necessary):
1) Manual: line by line; in a similar fashion as the attribute combination table of a product variant is built in Nop admin.

2) Automatic:
- Create the individual tables for each attributes which include Inventory (exampleS Size:(1,2,3,2,1); Color:(1,1,1,2,1)) and "sub-SKU-Modifiers" (Size:(-S,-M,-L,-X,-XX); Color:(-R,-Bu,-P,-W,-Bl))
- Create the preliminar Combination Attribute Group selecting the corresponding attributes and pressing CREATE. The table will be created will all possible attribute combinations. Inventory would be the result of the multiplication of the individual inventory of each of the attributes (Example for White M = 2 x 2 = 4) and the Modifier the concatenation of the sub-modifiers (Example for White M = "-W" & "-M" = "-W-M").
- Make adjustments/edit the table: eliminate (delete unexistant combinations); edit some fields (example Inventory in Black M, L and XL); or add new combinations. For that the features in Option 1) would be suitable.


The rest would be very simmilar as proposed by Goudinov:
- Add/Associate the Attributes Combination Group to each product to built its individual attribute combination table
- And to replicate the 6 scenarios:
-- Edit the Attribute Combination Group (using Option 1) and then in bulk select which lines should be added to its associated products and which lines should be deleted in the product and/or the Attribute Combination Group tables.
-- Edit the individual tables for product attribute combinations.

I ended with  a headache too :-))
11 years ago
nice work, Eduardo!
11 years ago
I have suggestion for implementing SKU Modifiers.  It does not address the above issues of inventory, or setup/copy, but it does allow for generating "SKU MODIFIERS" like those given above by Eduardo.   E.g.
"The SKU of each combination is built appending the SKU Modifier to the SKU of the product variant (example: 123). So for the Red-M the SKU would be 123-R-M. "

And, I think it's very easy to implement and (headache free :)

The ProductVariant gets a new property/field:  SkuTemplate
The ProductVariantAttributeValue gets a new  property/field:  SkuModifier

The SkuTemplate provides the ability to format the SKU with tokens(placeholders), and any other needed separator characters.  So, as per above example, a product variant has attributes Size and Color.  Example SkuTemplate could then be
  "%Sku%-%Color%-%Size%"
or it could be
  "%Sku%-%Size%-%Color%"
(or, for that matter, it could be   "%Color%-%Sku%-%Size%", etc)

Each ProductVariantAttributeValue record would have a SkuModifier.   For example

Red  R
Blue Bu
etc.

Small S
Med   M
etc.

Thus for ProductVariant having SKU "12345", and SkuTemplate "%Sku%-%Color%-%Size%", and customer chooses Red/Med, the resulting SKU would be
12345-R-M



I just mocked it up using ProductVariant's AdminComment in place of SkuTemplate, and ProductVariantAttributeValue's DisplayOrder in place of SkuModifier

I created a new method FormatSkuWithAttributes


\src\Libraries\Nop.Services\Catalog\IProductAttributeFormatter.cs

        /// <summary>
        /// Formats sku with attribute sku modifiers
        /// </summary>
        /// <param name="productVariant">Product variant</param>
        /// <param name="attributes">Attributes</param>
        /// <returns>Formatted Sku</returns>
        string FormatSkuWithAttributes(ProductVariant productVariant, string attributes);


\src\Libraries\Nop.Services\Catalog\ProductAttributeFormatter.cs

        public string FormatSkuWithAttributes(ProductVariant productVariant, string attributes)
        {
            string skuTemplate = productVariant.AdminComment;   //TODO productVariant.SkuTemplate;

            if (String.IsNullOrWhiteSpace(skuTemplate))
            {
                return productVariant.Sku;
            }
            else
            {
                var result = new StringBuilder(skuTemplate);

                string tokenKey = "Sku";
                string tokenValue = productVariant.Sku;
                result.Replace(String.Format(@"%{0}%", tokenKey), tokenValue);

                var pvaCollection = _productAttributeParser.ParseProductVariantAttributes(attributes);
                foreach (var pva in pvaCollection)
                {
                    var valuesStr = _productAttributeParser.ParseValues(attributes, pva.Id);
                    foreach (string valueStr in valuesStr)
                    {
                        if (pva.ShouldHaveValues())
                        {
                            //attributes with values
                            int pvaId = 0;
                            if (int.TryParse(valueStr, out pvaId))
                            {
                                var pvaValue = _productAttributeService.GetProductVariantAttributeValueById(pvaId);
                                if (pvaValue != null)
                                {
                                    tokenKey = pva.ProductAttribute.Name;
                                    tokenValue = pvaValue.DisplayOrder.ToString("00");  //TODO pvaValue.SkuModifier;
                                    result.Replace(String.Format(@"%{0}%", tokenKey), tokenValue);
                                }
                            }
                        }
                    }
                }
                return result.ToString();
            }
        }
    
    }


I tested in in the Shopping Cart

\src\Presentation\Nop.Web\Controllers\ShoppingCartController.cs

        [NonAction]
        protected ShoppingCartModel PrepareShoppingCartModel(ShoppingCartModel model,
...
            #region Cart items

            foreach (var sci in cart)
            {
                var cartItemModel = new ShoppingCartModel.ShoppingCartItemModel()
                {
                    Id = sci.Id,
                    Sku = _productAttributeFormatter.FormatSkuWithAttributes(sci.ProductVariant, sci.AttributesXml),    //!!!!  this was sci.ProductVariant.Sku
...


For a complete solution, the above FormatSkuWithAttributes would also need to be called in other places - e.g.
PdfService
MessageTokenProvider
OrderController
ShoppingCartController (wishlist too)
(others??)
(EDIT 7/6   Plugins\Nop.Plugin.Widgets.GoogleAnalytics\Controllers\WidgetsGoogleAnalyticsController.cs too)
(EDIT 7/6+ Nop.Web\Administration\Controllers\OrderController.cs too)


(EDIT:  And it would be cool if AJAX could update the Sku displayed in the product-variant-line when customer is selecting the attributes!)
11 years ago
New York wrote:
I have suggestion for implementing SKU Modifiers.  It does not address the above issues of inventory, or setup/copy, but it does allow for generating "SKU MODIFIERS" like those given above by Eduardo.   E.g.
"The SKU of each combination is built appending the SKU Modifier to the SKU of the product variant (example: 123). So for the Red-M the SKU would be 123-R-M. "...


Greate contribution Dennis!!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.