Hi im a newbie to Umbraco and i have question about adding , replacing ,.. model in Umbraco/ Merchello. My version of Umbraco CMS is 7.14 with Merchello/ FastTrack 2.7. I want to change the front page of the site to show all the products instead of only featured products, so i went to the ftStore in the template and change @Model.FeaturedProducts to @Model.Products but it tell me :"'FtStore' does not contain a definition for 'Products' ".
So i copy [ImplementPropertyType("products")] from another template (ftCategory) to ftStore in both all.generated.cs and model.generated.cs
and run
it show another error :
I really dont know how to fix this, in the ftCategory it had the same model as ftStore but it can call the Model.Products and ftStore cant ( after manually added). Can somebody help me, sorry for my bad english :(
First of all, I’d recommend reverting your ftStore model in all.generated.cs and model.generated.cs back to it’s original state – as this might cause some more headaches for you in the long-run.
To get the products, rather than adding a new property, you should take a look at the Services documentation (particularly the section on ProductService).
A quick example (which should work) would be something like:
var productService = MerchelloContext.Current.Services.ProductService;
var products = productService.GetAll();
Model return value cannot be null in FastTrack
Hi im a newbie to Umbraco and i have question about adding , replacing ,.. model in Umbraco/ Merchello. My version of Umbraco CMS is 7.14 with Merchello/ FastTrack 2.7. I want to change the front page of the site to show all the products instead of only featured products, so i went to the ftStore in the template and change @Model.FeaturedProducts to @Model.Products but it tell me :"'FtStore' does not contain a definition for 'Products' ". So i copy [ImplementPropertyType("products")] from another template (ftCategory) to ftStore in both all.generated.cs and model.generated.cs and run
it show another error :
I really dont know how to fix this, in the ftCategory it had the same model as ftStore but it can call the Model.Products and ftStore cant ( after manually added). Can somebody help me, sorry for my bad english :(
First of all, I’d recommend reverting your
ftStore
model inall.generated.cs
andmodel.generated.cs
back to it’s original state – as this might cause some more headaches for you in the long-run.To get the products, rather than adding a new property, you should take a look at the Services documentation (particularly the section on ProductService).
A quick example (which should work) would be something like:
is working on a reply...