Grouping Specification Attributes - Specification Type

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
As of now, it seems that the attributes for product specifications cannot be grouped.

It would be nice to assign some grouping to these spec attributes instead of displaying a long list.
For example, car specs being grouped as Exterior, Interior, Mechanical, Electrical, etc.

I just tried to add a column SpecificationType... unfortunately I am not able to have these multiple partial views render correctly on the page by passing in a SpecificationType parameter.  Perhaps caching issue?  It just repeats the first specified specification type even though the parameter is working/filtering.
11 years ago
par6 wrote:
As of now, it seems that the attributes for product specifications cannot be grouped.

It would be nice to assign some grouping to these spec attributes instead of displaying a long list.
For example, car specs being grouped as Exterior, Interior, Mechanical, Electrical, etc.

I just tried to add a column SpecificationType... unfortunately I am not able to have these multiple partial views render correctly on the page by passing in a SpecificationType parameter.  Perhaps caching issue?  It just repeats the first specified specification type even though the parameter is working/filtering.

Maybe it can help you to use instead product tags as groups, so you can also have searches by tags
11 years ago
I am trying to visually separate the different specification groups instead of just a list.
So the thought was to create multiple partial views after adding a specificationtype column... but thinking it could be easier than that.

Basically:

Interior
     fabric cloth
     color  black

Exterior
     color white
     wheels  17 inch

Instead of

     fabric cloth
     color  black
     color white
     wheels  17 inch
11 years ago
par6 wrote:
I am trying to visually separate the different specification groups instead of just a list.
So the thought was to create multiple partial views after adding a specificationtype column... but thinking it could be easier than that.

Basically:

Interior
     fabric cloth
     color  black

Exterior
     color white
     wheels  17 inch

Instead of

     fabric cloth
     color  black
     color white
     wheels  17 inch

Ah ok. Here is an example (v1.9) of using different specifications (grey background at the left column) for filtering
11 years ago
Thank you but no, not filtering.  Displaying.  For example, take a look at this spec sheet on CNET

http://reviews.cnet.com/digital-cameras/sony-cyber-shot-dsc/4507-6501_7-35326410.html

See how they are listed while grouped?
11 years ago
par6 wrote:
Thank you but no, not filtering.  Displaying.  For example, take a look at this spec sheet on CNET

http://reviews.cnet.com/digital-cameras/sony-cyber-shot-dsc/4507-6501_7-35326410.html

See how they are listed while grouped?


This is great. I am trying to upload the Specification like you displayed in the above link using excel spreadsheet while uploading products. Is that possible?

I have 1000's of products for which I need to upload all the details of the products in one shot. Please guide me to upload the product specifications like in the sample page you displayed through excel.

Thanks,
Jeevan
11 years ago
Hello jeevankumarkr,

You should be asking this question on the general help section of the forum.
This is for suggestions/feedback.

But you are going to probably end up using SQL scripts to upload multiple specifications by associating the product id to the Product_SpecificationAttribute_Mapping table to SpecificationAttributeOption and the SpecificationAttribute tables
10 years ago
Any update on this? Any idea on how to do this?

Thanks
10 years ago
par6 wrote:
As of now, it seems that the attributes for product specifications cannot be grouped.

It would be nice to assign some grouping to these spec attributes instead of displaying a long list.
For example, car specs being grouped as Exterior, Interior, Mechanical, Electrical, etc.

I just tried to add a column SpecificationType... unfortunately I am not able to have these multiple partial views render correctly on the page by passing in a SpecificationType parameter.  Perhaps caching issue?  It just repeats the first specified specification type even though the parameter is working/filtering.


I ended up with the follwing ProductSpesifications.cshtml view. Correct me if this isnt what you wanted. I did notice the age of the post, and you might have found a better solution.

@model IList<ProductSpecificationModel>
@using Nop.Web.Models.Catalog;
@if (Model.Count > 0)
{
    <div class="product-specs-box">
        <div class="title">
            <strong>@T("Products.Specs")</strong>
        </div>
        <table class="data-table">
            <colgroup>
                <col width="25%" />
                <col />
            </colgroup>
            <tbody>
                @foreach (var attr in Model.GroupBy(o => o.SpecificationAttributeId))
                {
                        <tr>
                            <td class="a-left spec-name">
                                @attr.FirstOrDefault().SpecificationAttributeName
                            </td>
                            <td class="a-left spec-value">
                                @foreach (var attrOp in attr.Take(attr.Count()-1))
                                {
                                    @attrOp.SpecificationAttributeOption<text>,</text>
                                }
                                @foreach (var attrOp in attr.Skip(attr.Count()-1).Take(1))
                                {
                                    @attrOp.SpecificationAttributeOption
                                }
                            </td>
                        </tr>                              
                    }
            </tbody>
        </table>
    </div>
}
9 years ago
lintho wrote:
As of now, it seems that the attributes for product specifications cannot be grouped.

It would be nice to assign some grouping to these spec attributes instead of displaying a long list.
For example, car specs being grouped as Exterior, Interior, Mechanical, Electrical, etc.

I just tried to add a column SpecificationType... unfortunately I am not able to have these multiple partial views render correctly on the page by passing in a SpecificationType parameter.  Perhaps caching issue?  It just repeats the first specified specification type even though the parameter is working/filtering.

I ended up with the follwing ProductSpesifications.cshtml view. Correct me if this isnt what you wanted. I did notice the age of the post, and you might have found a better solution.

@model IList<ProductSpecificationModel>
@using Nop.Web.Models.Catalog;
@if (Model.Count > 0)
{
    <div class="product-specs-box">
        <div class="title">
            <strong>@T("Products.Specs")</strong>
        </div>
        <table class="data-table">
            <colgroup>
                <col width="25%" />
                <col />
            </colgroup>
            <tbody>
                @foreach (var attr in Model.GroupBy(o => o.SpecificationAttributeId))
                {
                        <tr>
                            <td class="a-left spec-name">
                                @attr.FirstOrDefault().SpecificationAttributeName
                            </td>
                            <td class="a-left spec-value">
                                @foreach (var attrOp in attr.Take(attr.Count()-1))
                                {
                                    @attrOp.SpecificationAttributeOption<text>,</text>
                                }
                                @foreach (var attrOp in attr.Skip(attr.Count()-1).Take(1))
                                {
                                    @attrOp.SpecificationAttributeOption
                                }
                            </td>
                        </tr>                              
                    }
            </tbody>
        </table>
    </div>
}


Hi there,

Just to add on to the topic, I refactored lintho's code to make it shorter.

....... snippet.......

                @foreach (var attr in Model.GroupBy(o => o.SpecificationAttributeId))
                {
                    var attrValues = String.Join(", ", attr.Select(x => x.SpecificationAttributeOption).ToArray());
                    <tr>
                        <td class="a-left spec-name">
                            @attr.FirstOrDefault().SpecificationAttributeName
                        </td>
                        <td class="a-left spec-value">
                            @attrValues                          
                        </td>
                    </tr>
                }
....... snippet.......

Also, if you make this change, you might also want to do the same thing for the compare product view. (CompareProducts.cshtml)


......snippet......

                   @foreach (var specificationAttribute in specificationAttributes)
                    {
                        <tr class="specification">
                            <td>@specificationAttribute.SpecificationAttributeName
                            </td>
                            @foreach (var product in Model.Products)
                            {
                                var specValue = string.Empty;
                                var foundProductSpec = product.SpecificationAttributeModels.FirstOrDefault(psa => psa.SpecificationAttributeId == specificationAttribute.SpecificationAttributeId);
                              
                                if (foundProductSpec != null)
                                {                                    
                                    var specValues = product.SpecificationAttributeModels.Where(o =>o.SpecificationAttributeId == foundProductSpec.SpecificationAttributeId)
                                        .Select(x=>x.SpecificationAttributeOption).ToList();
                                    
                                    // concat string with delimiter
                                    specValue = String.Join(", ", specValues.ToArray());                                    
                                  
                                }

                                <td style="width: @columnWidth;" class="a-center">
                                    @if (!String.IsNullOrEmpty(specValue))
                                    {
                                       @specValue
                                    }
                                    else
                                    {
                                        <text>&nbsp;</text>
                                    }
                                </td>
                            }
                        </tr>                    
                    }
.....snippet.....
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.