Froogle Schedule Task

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi Guys

I have a quick question about the Froogle plugin.

I have adjusted the code in the plugin to generate the same xml file name, e.g froogle.xml. The reason for this is the Google servers are configured to visit our servers on a daily basis rather than us submitting to them.

I was wondering if it's possible to schedule the feed to re-generate itself every day. The main reason being is we are unable to rely on the client to regenerate the feed manually after changing product details.

Is this possible in the current code base already?

If not, Would this be something where I should be using a scheduled task?

Thanks for reading!
12 years ago
It's already on the roadmap. Please vote here
12 years ago
Thanks Andrei

Sounds good - In the meantime we've added a Consumer to listen out for a product update and once triggered we re-build the xml file and overwrite the old file. This will keep us going for now.
12 years ago
chease wrote:
Thanks Andrei

Sounds good - In the meantime we've added a Consumer to listen out for a product update and once triggered we re-build the xml file and overwrite the old file. This will keep us going for now.


How did you implement the Consumer to listen for product updates? Did you use a webservice? Did you write it in the nopCommerce core codebase?
12 years ago
We adjusted the froogle plugin and listened out for the product consumer advising of a product change....

Here is the snippet of code, can't remember if we added code/references elsewhere.... but hopefully gives you an idea.

namespace Nop.Plugin.Feed.Froogle.Events
{
    public class ProductConsumer : IConsumer<EntityInserted<Product>>, IConsumer<EntityUpdated<Product>>
    {

        private readonly IPromotionFeedService _promotionFeedService;
        private readonly ILogger _logger;

        public ProductConsumer(ILogger logger, IPromotionFeedService promotionFeedService)
        {
            this._logger = logger;
            this._promotionFeedService = promotionFeedService;
        }

        public void HandleEvent(EntityInserted<Product> eventMessage)
        {
            GenerateFeed();
        }

        public void HandleEvent(EntityUpdated<Product> eventMessage)
        {
            GenerateFeed();
        }

        private void GenerateFeed()
        {
            try
            {
                string fileName = string.Format("froogle.xml");
                string filePath = string.Format("{0}content\\files\\exportimport\\{1}", HttpContext.Current.Request.PhysicalApplicationPath, fileName);
                using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                {
                    var feed = _promotionFeedService.LoadPromotionFeedBySystemName("PromotionFeed.Froogle");
                    feed.GenerateFeed(fs);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
            }
        }

    }
}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.