HomeHome Product Discus... Product Discus...RazorCartRazorCartModel contents in cshtml pagesModel contents in cshtml pages
Previous
 
Next
New Post
11/29/2018 11:12 AM
 
I've been asked to customize the Product Details page and a few others for a store we are developing. I can see @Model in the page code but can't figure out how to see what's in the Model so I can leverage it.

I need to know (1) if the current user is logged in, and (2) if the current user has a customer record, (3) what the UDFB2 field value for that customer is if the customer exists. Also I need some Store Config values, I have put some custom config information. I could probably work back to get the customer data through SQL if I knew the DNN Login ID (if the user was logged in) but it might already be in the Model and I just don't know the syntax to get to it.

The Product Detail cshtml looks to use RazorCart.ProductDetails.Models.DetailModel. I have the pipeline customization project and have browsed through the DLLs but can't find anything that looks to match to a Prduct Detail page model. Am I just not seeing it or is it not there? If not, is there anywhere that I can go look up what's in the Model on each page so I know what I have to work with?

I've been able to dig blindly a bit. I can use
@{
  var vStatus = "(not found)";
 if (Model.Product != null)
  {
    vStatus = "Prioduct exists!";
  }
}
but hopefully there is a better way than this,

Model.Product on the Product Details page seems to correspond to RazorCart.Service.Data.ModelDataContext.Product. Is this correct or is it another object?

How can I, in the different cshtmls that might be customized, know what objects and data is in the Model for each page?

Thank you,
George Butler


 
New Post
11/29/2018 3:02 PM
 
Hi George,
There are 2 ways to do this:

1.  Use the Intellisense Viewset Manager, you can download it here https://www.smith-consulting.com/Port...wsetManager.zip

Extract it inside: /Portals/{ID}/RazorCart/

The project includes all references for the view files but not the files themselves, when you “Copy Viewset” from Admin-Console then the files can be opened/edited in Visual Studio with Razor IntelliSense.


2.  Use your browsers dev tools to get the model property names as described in this help article https://helpdesk.smith-consulting.com...g-viewsets.aspx


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
11/30/2018 8:24 AM
 
This is incredibly useful! Thank you so much!

G
 
Previous
 
Next
HomeHome Product Discus... Product Discus...RazorCartRazorCartModel contents in cshtml pagesModel contents in cshtml pages