Close

Hellp; How can I know the product weight in a custom tab

ellerlor
10 years ago
#4031 Quote
Avatar
  • 21
Hi,
I want to use a custom tab to define the shipment cost; to do this I have to know the weight of the product. Into the _ProductCustomTab.cshtml page.
I put @using Nop.Core.Infrastructure as suggested by you and more other test but I am not able to know the weight of the product that I suppose I can find in Nop.Web.Models.Catalog.PopularProductTagsModel

Could you help me about this topic? It is the last steep before to go in production with my web site and nop templates plugin...

I am using Nop 3.2

Thanks in advance

Lorenzo
Boyko
10 years ago
#4037 Quote
Avatar
  • Moderator
  • 1570
ellerlor wrote:
Hi,
I want to use a custom tab to define the shipment cost; to do this I have to know the weight of the product. Into the _ProductCustomTab.cshtml page.
I put @using Nop.Core.Infrastructure as suggested by you and more other test but I am not able to know the weight of the product that I suppose I can find in Nop.Web.Models.Catalog.PopularProductTagsModel

Could you help me about this topic? It is the last steep before to go in production with my web site and nop templates plugin...

I am using Nop 3.2

Thanks in advance

Lorenzo


Hi Lorenzo,

I think it is not possible. Neither the ProductOverview nor the ProductDetials models contain the weight of the product. To achieve what you need you need to create a new action that will contain your custom logic for getting the weight and the calculations around it and call this action from the _ProductTabs.cshtml view into a custom tab.

Hope this helps!

Best Regards,
Nop-Templates.com Team
Regards,
Nop-Templates.com Team
ellerlor
10 years ago
#4040 Quote
Avatar
  • 21
Hi,
OK it is clear.. but what means " you need to create a new action" ..
First of all I have some problem to reference into your _ProductView.cs page my new development because I have not the project of Quick Tabs in my solution...

Thanks in advance for any better clarification
Boyko
10 years ago
#4060 Quote
Avatar
  • Moderator
  • 1570
ellerlor wrote:
Hi,
OK it is clear.. but what means " you need to create a new action" ..
First of all I have some problem to reference into your _ProductView.cs page my new development because I have not the project of Quick Tabs in my solution...

Thanks in advance for any better clarification


Hi ellerlor,

By creating a new action I meant to add a new method in one of the existing controllers in nopCommerce or in your own plugin controller. Then you can call this action from the Tabs view just like this:

@Html.Action("YourActionName", "YourControllerName", new { productId = Model.ProductId })


Your action will return some html that you can show in a tab. There is no need to reference any custom types in the Tabs view.

Hope this is clearer now!

Best Regards,
Nop-Templates.com Support Team
Regards,
Nop-Templates.com Team