You have no items in your shopping cart.

Saturday, November 23, 2024 3:18:07 PM

Example of plugin for FeedManager

Posted: 6 years ago

#8218 Quote

Support

Posted: 6 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