You have no items in your shopping cart.

Friday, April 26, 2024 3:27:16 PM

Example of plugin for FeedManager

Posted: 5 years ago

#8218 Quote

Support

Posted: 5 years ago

#8218 Quote
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");
        }
    }

Powered by nopCommerce

Copyright © 2023 FoxNetSoft. All rights reserved