Displaying SKU on Category product listing page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 10 ans
We have a store with many categories and sub categories.

We would like to display product SKU with product listing on category pages (which displays list of products related to that particular category).

Example -

Product is here - http://www.drumracks.com.au/drum-spill-containment-stand-2-drums

It is under category - DRUM SPILL STAND

which displays all products related to that category here - http://www.drumracks.com.au/drum-spill-stand

We want to display SKU of this product http://www.drumracks.com.au/drum-spill-containment-stand-2-drums which is NS-SL2  on this category page (which is listing products related to that category) http://www.drumracks.com.au/drum-spill-stand

HOW DO WE DO THAT?

Please help us. We tried out many different ways but nothing works. it just shows error page.

Thanks in advance.
Il y a 10 ans
You should add

to the ProductOverviewModel:       public string Sku { get; set; }

to the PrepareProductOverviewModels method of the CatalogController:        

            Sku = product.Sku (when creating ProductOverviewModel)

to the _ProductBox.cshtml:       @Model.Sku
Il y a 10 ans
Hi

Thanks for the quick reply.

I can figure out that _ProductBox.cshtml is a file under /Views/Catalog/ folder and can place @Model.Sku anywhere to make it appear on the page.

but you have suggested 2 more changes. i am not able to figure out how/where to find them to put into? you have mentioned  about ProductOverviewModel and PrepareProductOverviewModels - where can i find them please?

thanks again.

(We are using nopCommerce 3.20 version)
Il y a 10 ans
mitulbhavsar wrote:
Hi

Thanks for the quick reply.

I can figure out that _ProductBox.cshtml is a file under /Views/Catalog/ folder and can place @Model.Sku anywhere to make it appear on the page.

but you have suggested 2 more changes. i am not able to figure out how/where to find them to put into? you have mentioned  about ProductOverviewModel and PrepareProductOverviewModels - where can i find them please?

thanks again.

(We are using nopCommerce 3.20 version)


hi mitulbhavsar,
you can find out  ProductOverviewModel  in the /Nop.Web/Models/Catalog/ProductOverviewModel.cs
Add new property as public string Sku { get; set; }

For PrepareProductOverviewModels go to /Nop.Web/Controllers/CatalogController.cs line number 317.

Don't forget to build Nop.Web project.
Il y a 10 ans
Mariann wrote:
You should add

to the ProductOverviewModel:       public string Sku { get; set; }

to the PrepareProductOverviewModels method of the CatalogController:        

            Sku = product.Sku (when creating ProductOverviewModel)

to the _ProductBox.cshtml:       @Model.Sku


Many thanks for this. following the above I have managed to add SKU and also StockAvailability to the _ProductBox.cshtml and now able to display these to on the category grid view.
Il y a 10 ans
Hi

Thanks for detailed explanation.

Shall i do this (create project and make other changes) through Visual Studio 2012?

Thanks again.
Il y a 10 ans
mitulbhavsar wrote:
Hi

Thanks for detailed explanation.

Shall i do this (create project and make other changes) through Visual Studio 2012?

Thanks again.


Yes, you should do this using VS 2012 or above.
Il y a 9 ans
Mariann wrote:
You should add

to the ProductOverviewModel:       public string Sku { get; set; }

to the PrepareProductOverviewModels method of the CatalogController:        

            Sku = product.Sku (when creating ProductOverviewModel)

to the _ProductBox.cshtml:       @Model.Sku


I think they have changed PrepareProductOverviewModels Methode in 3.40. How to do it now?
I dont get it to work, please help.
Il y a 9 ans
Sku should be Default in ProductOverviewModel
Il y a 8 ans
Anyone know how to do this in 3.7?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.