I am working on my first uCommerce project. When I visit a category the Catalog.cshtml throws an error, the file contains this code, an example of a URL where the Catalog.cshtml fail could be: http://www.domain.com/store/partne/2.3-mw/c-26/c-75/
File contains the basic code from the demo store, I have tried looking into the stack trace to see if I could get more information about why it give me and error.
From the stack trace I get this:
Error Loading Razor Script (file: Store Catalog) Object reference not
set to an instance of an object. at
ASP.PagemacroScriptsStoreCatalogcshtml.Execute() in
d:\customer\macroScripts\Store\Catalog.cshtml:line 10 at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at
System.Web.WebPages.WebPage.ExecutePageHierarchy() at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) at
umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro,
INode currentPage) at
umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode
currentPage) 0.334953 0.006805 macro Error loading MacroEngine script
(file: /Store/Catalog.cshtml, Type: '' Object reference not set to an
instance of an object. at
ASP.PagemacroScriptsStoreCatalogcshtml.Execute() in
d:\customer\macroScripts\Store\Catalog.cshtml:line 10 at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at
System.Web.WebPages.WebPage.ExecutePageHierarchy() at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) at
umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro,
INode currentPage) at
umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode
currentPage) at umbraco.macro.loadMacroScript(MacroModel macro) at
umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
First I thought I got because I don´t have add an image to the category or a product.
We are running Umbraco 4.11.10 and uCommerce 6.0.3.14141
That causes problems. Try do a check for category is null. In case it's null throw an exception with a test message. That way you can easy track if its that line. Otherwise do you use Visual Studio? In that case you can actually debug it fairly easy that way.
Catalog.cshtml throws an error on a category
Hi
I am working on my first uCommerce project. When I visit a category the Catalog.cshtml throws an error, the file contains this code, an example of a URL where the Catalog.cshtml fail could be: http://www.domain.com/store/partne/2.3-mw/c-26/c-75/
File contains the basic code from the demo store, I have tried looking into the stack trace to see if I could get more information about why it give me and error.
From the stack trace I get this:
First I thought I got because I don´t have add an image to the category or a product.
We are running Umbraco 4.11.10 and uCommerce 6.0.3.14141
Any help will be appreciated.
/Dennis
Hi Dennis,
My guess would be that this line:
@if(!string.IsNullOrEmpty(category.ImageMediaId))
That causes problems. Try do a check for category is null. In case it's null throw an exception with a test message. That way you can easy track if its that line. Otherwise do you use Visual Studio? In that case you can actually debug it fairly easy that way.
Best regards
Martin
Hi,
I found out that, the line that makes problem is this:
If I see in the App_Code folder the files is but have this path:
/App_Code/uCommerce/Helpers and in the helpers folder I have these files:
Category.cshtml
Product.cshtml
ProductReview.cshtml
Review.cshtml
Should the Category.cshtml file be in a folder named Review or what could be the reason why my Catalog.cshtml throws an error.
Any help will be appreciated.
/Dennis
It turns out I got this error because I don´t have any facts.
But I managed to solve the issue.
Thanks Martin for taking your time to help me
/Dennis
is working on a reply...