Saturday, November 23, 2024 3:18:07 PM
public class FeedManagerPlugin
{
public virtual string ReadAttributeValue(Product product, ProductAttributeCombination productAttributeCombination, string feedColumnName, string typeFeed)
{
string url = GetProductUrl(product);
if (productAttributeCombination != null)
{
url += "?sku=" + productAttributeCombination.Sku;
}
return url;
}
private IUrlHelperFactory _urlHelper
{
get
{
return EngineContext.Current.Resolve<IUrlHelperFactory>();
}
}
private IActionContextAccessor _actionContextAccessor
{
get
{
return EngineContext.Current.Resolve<IActionContextAccessor>();
}
}
private string GetProductUrl(Product product)
{
return _urlHelper.GetUrlHelper(_actionContextAccessor.ActionContext).RouteUrl(nameof(Product), new { SeName = product.GetSeName() }, "https");
}
}