How to marked a product is in Compare List?

Create a folder under Nop.Web project, named Features

Create 2 new classes (CustomProductModelFactory and DependencyRegistrar under Features folder) as following

For nopCommerce 4.00

For nopCommerce 3.90

Open the Views\Shared\_ProductBox.cshtml file, add following code (the text in bold style)


<div class="product-item @Model.CustomProperties["InCompareList"]" data-productid="@Model.Id">

Open the Views\Product\ProductTemplate.Grouped.cshtml file, add following code (the text in bold style)


<div class="page product-details-page @Model.CustomProperties["InCompareList"]">

Open the Views\Product\ProductTemplate.Simple.cshtml file, add following code (the text in bold style)


<div class="page product-details-page @Model.CustomProperties["InCompareList"]">

Rebuild Nop.Web project

Leave your comment
Comments
4/12/2018 10:29 PM
Works perfectly on Version 3.90
Follow us