New Widget Zone

Posted: September 20, 2019 at 7:54 AM Quote #247773
Hi,

I'm having a few issues with adding a new widget zone within the _ProductReviewOverview.cshtml.
This is the markup:

@await Component.InvokeAsync("Widget", new { widgetZone = "review_scorecard", additionalData = Model.Id})


But I receive the following error:
One or more compilation failures occurred:
\Themes\PowerShop\Views\Product\_ProductReviewOverview.cshtml(20,130): error CS1061: 'ProductReviewOverviewModel' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'ProductReviewOverviewModel' could be found (are you missing a using directive or an assembly reference?)


Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:
C:\inetpub\wwwroot\matakki.com\Themes\PowerShop\Views\Product\_ProductReviewOverview.cshtml(20,130): error CS1061: 'ProductReviewOverviewModel' does not contain a definition for 'Id' and no extension method 'Id' accepting a first argument of type 'ProductReviewOverviewModel' could be found (are you missing a using directive or an assembly reference?)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(RazorCodeDocument codeDocument, String generatedCode)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---


Anybody be able to shed some light on this issue would be great

Kind regards

Nick
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: September 20, 2019 at 8:01 AM Quote #247774
Hello,

The ProductReviewOverviewModel doesn't have a property "Id" so you cannot use the following code - "Model.Id".
I think you are trying to pass the product id to your widget's invoke method. If that is the case the ProductReviewOverviewModel has a property of ProductId which you can use. Try to replace the Model.Id in your code with Model.ProductId.

Hope that helps!

Regards,
Anton
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.Nop-Templates.com - the best place for nopCommerce themes and plugins

Follow us on
Facebook: http://www.facebook.com/NopTemplates
Twitter: http://twitter.com/NopTemplates
Blog: http://www.nop-templates.com/blog

www.Nop-Templates.com
nopCommerce Solution Partners
Posted: September 20, 2019 at 8:37 AM Quote #247776
Many thanks Anton,

Your solution worked great.

Kind regards
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.