Originally posted by kocourek
View Post
Although my promotion feed templates are dynamic, the trigger for them is manual. I have not put much time into triggering the feed generation based on when a price group is active. We do not run enough promotions for me to justify that. As a store operator, I do not believe there is a way to easily do this.
But I have been thinking about this since your last post, so I rubbed my two brain cells together to give them some exercise.
The first step would be to set up a generic promotion feed that takes in the price group name from the URL parameters as a global variable. The price group name can then be used within the feed header template to alter the products processed.
If you don't need a file stored on your server, and a real-time generated feed is adequate, provide the marketplace the URL to your feed with the URL parameters included. EG "https://www.store.com/my_feed?Feed_AccessKey=test&promotion=myPriceFroup Name" This step would require scheduling the promotion at each marketplace.
If you need a promotion feed file, you could set up a daily(?) scheduled task and in that scheduled task loop through your price groups, identify the active ones, check if the feed file exists, then run the promotional feed. (don't actually use this code, it's literally brain vomit. I'm even not certain you can alter a feed output filename from within the feed)
Again, don't use this code, this doesn't handle any file cleanup and will stack feed generation for all active price groups without a feed file. I'm only including it because it was fun to think it this far through. But hopefully, it helps point you in the right direction.
****TLDR*****
There are currently three ways to generate a feed that I am aware of. 1)Scheduled Task 2)Manual execution from within the admin. 3) Execution via URL. There is not a native way to hook into the Price Group start and end times to generate a feed.
But I have been thinking about this since your last post, so I rubbed my two brain cells together to give them some exercise.
The first step would be to set up a generic promotion feed that takes in the price group name from the URL parameters as a global variable. The price group name can then be used within the feed header template to alter the products processed.
If you don't need a file stored on your server, and a real-time generated feed is adequate, provide the marketplace the URL to your feed with the URL parameters included. EG "https://www.store.com/my_feed?Feed_AccessKey=test&promotion=myPriceFroup Name" This step would require scheduling the promotion at each marketplace.
If you need a promotion feed file, you could set up a daily(?) scheduled task and in that scheduled task loop through your price groups, identify the active ones, check if the feed file exists, then run the promotional feed. (don't actually use this code, it's literally brain vomit. I'm even not certain you can alter a feed output filename from within the feed)
Code:
<mvt:do file="g.Module_Feature_PGR_DB" name="l.success" value="PriceGroupList_Load_All(l.currentPriceGroups)" /> <mvt:foreach array="l.currentPriceGroups" iterator="l.priceGroup"> <mvt:assign name="l.isValid" value="{ (l.priceGroup:dt_start ISNULL OR s.dyn_time_t GT l.priceGroup:dt_start) AND (l.priceGroup:dt_end ISNULL OR s.dyn_time_t LT l.priceGroup:dt_end)}" /> <mvt:if expr="{NOT l.isValid}"> <mvt:foreachcontinue /> </mvt:if> <mvt:if expr="NOT(fexists( '/path/to/your/feeds/' $ l.priceGroup.name $ '.csv' ) AND NOT(fexists( '/path/to/your/feeds/' $ l.priceGroup.name $ '.tsv' ))"> <mvt:assign name="l.feedUrl" value="'https://www.store.com/my_feed?Feed_AccessKey=test&promotion=' $ l.priceGroup.name"/> <mvt:call action="l.feedUrl" METHOD="'GET'"> <mvt:eval expr = "s.callvalue " /> </mvt:call> <mvt:if> </mvt:foreach>
****TLDR*****
There are currently three ways to generate a feed that I am aware of. 1)Scheduled Task 2)Manual execution from within the admin. 3) Execution via URL. There is not a native way to hook into the Price Group start and end times to generate a feed.
Leave a comment: