I'm currently working through the examples within the documentation. A section of code doesn't appear to be correct. That, or I've made a mistake else where.
My 'list-products' page is throwing a guid related error, due to this line:
var result = contentProduct.GetPropertyValue("merchelloproduct").ToString();
This is obviously returning a string, but it's not returning a string containing a guid. It's returning:
I had run across this issue, and just figured it out myself.
The page I am using is inheriting the UmbracoTemplatePage.
MerchelloHelper Merchello = new MerchelloHelper();
Guid key = new Guid(CurrentPage.product.Key.ToString());
var product = Merchello.Query.Product.GetByKey(key);
Obtaining a product GUID
Hello,
I'm currently working through the examples within the documentation. A section of code doesn't appear to be correct. That, or I've made a mistake else where.
My 'list-products' page is throwing a guid related error, due to this line:
This is obviously returning a string, but it's not returning a string containing a guid. It's returning:
As you'd expect, knock-off the 'ToString; and we get the {Merchello.Web.Models.ContentEditing.ProductDisplay} object.
When debugging I can see that the object has a property (among others), called 'Key'. This is the Guid i'm trying to access..
The property isn't available to me it would seem.
Any ideas?
cheers
Adding
I had run across this issue, and just figured it out myself.
The page I am using is inheriting the UmbracoTemplatePage.
is working on a reply...