Show Specification Attribute in Category Listing Page , Search result page -Nop 3.6

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi

I need to show product specification attributes in Category List page

E.g http://demo.nopcommerce.com/desktops    in this page  below to product title for each product.

I have nopcommerce version 3.6  

If anyone did it earlier please share the code.

Thanks in advance.
8 years ago
udal_cse wrote:
Hi

I need to show product specification attributes in Category List page

E.g http://demo.nopcommerce.com/desktops    in this page  below to product title for each product.

I have nopcommerce version 3.6  

If anyone did it earlier please share the code.

Thanks in advance.


Hi,

To achieve this you need to make the following modifications in the code.

1. Go to this file: /Presentation/Nop.Web/Controllers/CatalogController.cs.

2.On line 584 and line 1333 edit the code to look this way:
model.Products = PrepareProductOverviewModels(products, prepareSpecificationAttributes: true).ToList();


3. Now go to this file: /Presentation/Nop.Web/Views/Shared/_ProductBox.cshtml

and wherever you want place this code (I suggest you to be after the "add-info" div):

@if (Model.SpecificationAttributeModels.Count > 0)
{
  <div class="product-specs-box">
    <div class="title">
      <strong>@T("Products.Specs")</strong>
    </div>
    <div class="table-wrapper">
      <table class="data-table">
        <tbody>
          @foreach (var item in Model.SpecificationAttributeModels)
          {
            <tr>
              <td class="spec-name">
                @item.SpecificationAttributeName
              </td>
              <td class="spec-value">
                @Html.Raw(item.ValueRaw)
              </td>
            </tr>
          }
        </tbody>
      </table>
    </div>
  </div>
}



I hope this helped you!
8 years ago
Thanks

Its work for me.
7 years ago
In version 3.8 you need to do it on the productsController Line 1248

            var model = PrepareProductOverviewModels(products, true, true, productThumbPictureSize, prepareSpecificationAttributes:true).ToList();
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.