Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
Is it possible to get typecontent from product variants, when i try:
IProductContent productContent = merchelloHelper.TypeProductContentBySku(masterProduct.Sku);
I get content, when i try:
IProductContent productVariantContent = merchelloHelper.TypeProductContentBySku(variantProduct.Sku);
productVariantContent is null. If noticed there is IProductVariantContent, but I can't find something like merchelloHelper.TypeProductVariantContentBySku
Best, Wesley
Found it,
It seems that a IProductContent has a collection of IProductVariantContent which could be found either by SKU or selected option choices.
https://github.com/Merchello/Merchello/issues/1486
So based on BazaarSiteApiController in the Bazaar example store
I now have this code that works:
var product = _merchello.Query.Product.GetByKey(productKey); var variant = product.GetProductVariantDisplayWithAttributes(optionsArray); IProductContent masterProductContent = null; IProductVariantContent variantProductContent = null; masterProductContent = _merchello.TypeProductContentBySku(product.Sku); variantProductContent = masterProductContent.ProductVariants.First(x => x.Key == variant.Key);
@Wesley
You should be able to
var masterProductContent = _merchello.TypedProductContent(productKey); var variantProductContent = masterProductContent.ProductVariants.First(x => ...
Thanks Rusty, will try that out!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get TypeContent from Variant
Hi,
Is it possible to get typecontent from product variants, when i try:
I get content, when i try:
productVariantContent is null. If noticed there is IProductVariantContent, but I can't find something like merchelloHelper.TypeProductVariantContentBySku
Best, Wesley
Found it,
It seems that a IProductContent has a collection of IProductVariantContent which could be found either by SKU or selected option choices.
https://github.com/Merchello/Merchello/issues/1486
So based on BazaarSiteApiController in the Bazaar example store
I now have this code that works:
@Wesley
You should be able to
Thanks Rusty, will try that out!
is working on a reply...