Thank you Josef,
This seems like exactly what I was looking for.
I have made some headway on this, but I'm really struggling on passing the SKU ID through to the macro. Hereis my macro code:
[assembly: RegisterExtension(typeof(SKUVariantMacros), typeof(SystemNamespace))]
public class SKUVariantMacros : MacroMethodContainer
{
[MacroMethod(typeof(string), "Gets the fully qualified name of the variant", 1)]
[MacroMethodParam(0, "param1", typeof(int), "The ID of the variant SKU")]
public static object GetSkuParentVariantName(EvaluationContext context, params object[] parameters)
{
var skuID = ValidationHelper.GetInteger(parameters[0], 0);
var variant = VariantHelper.GetVariantById(skuID);
if (variant == null)
{
var skuInfo = SkuHelper.GetSKUById(skuID);
if (skuInfo != null) return skuInfo.SKUName;
else return "";
}
return variant.ProductName + " - " + variant.VariantName;
}
}
And then this is how I'm calling it:
{%GetSkuParentVariantName(SKUID)%}
I have opened the extended field editor using the little arrow next to: Display name format, as without this, it wasn't working. I was getting a db error.
Can you tell me what I'm doing wrong?
Regards,
Gabor