Developer forum

Forum » Development » Feed file export scheduled task not adding user to price context

Feed file export scheduled task not adding user to price context

Lasse Larsen
Reply

Im having a proplem where, when trying to generate my PIM feed using the Feed file export scheduled task, i am not getting a user passed to me through the PriceContext.

I do have the language and currency, but not the user.

This is only when the feed is generated using the scheduled task. When calling the feed fron the url, the user, on the feed is set on the price context.

When calling the feed from the scheduled task:


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Lasse,

What about ShopID? Do you get that?

I have posted a similar issue but related to ShopID: https://doc.dynamicweb.com/forum/pim/pim/shopid-in-pim-feed

I have noticed that the settings on the Feed itself are not honored. I was afraid it was some setting on my end but it seems that your expectation is similar to mine.

Maybe DW will investigate it further.

Adrian

 

 
Lasse Larsen
Reply

Hi Adrian,

Unfortunately not. It looks like the only thing i get is the country and currency passed from the scheduled task.

I think you are right about the feed settings not being honored.

When running the feed, from the URL directly, Customer and Shop is set on the context:

 

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi folks,

The context driven parameters of the feed cannot be deciphered by the scheduled task. There simply isn't any context.

The work-around is to copy the desired URL from the bottom of the feed setup screen. Paste this URL to a scheduled task and execute the URL instead.

In my example it looks like

http://915.local.dynamicweb.dk/dwapi/Feeds/GetFeedOutput?Id=1&languageId=LANG1&currencyId=USD&shopId=SHOP2&UserId=Ch5jnzy%2FdvU%3D&LoadVariantInfoOnVariants=True

You will see that there is a hashed version of the UserId. Grab the output and save it.

Hope the above makes sense.

BR
Snedker

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Morten,

Thank you for the workaround.

For now, I can probably use the suggestion but wouldn't it make sense to use the settings of the feed in the context if there are none in the URL?

My expectation, based on the interface and the whole setup, was that the feed would honor those settings and not just use them to create URL parameters. This way you can also avoid having to pass sensitive data (like the UserID) in the URL.

I understand that it's not how it works now, but maybe it makes sense to consider it as a feature.

Thank you,

Adrian

 
Anders Ebdrup
Anders Ebdrup
Reply

Dear Adrian & Morten,

 

I totally agree with you Adrian! Hopefully, Morten, you will look into a better solution here?

 

Best regards, Anders

 
Lasse Larsen
Reply

Hi, Morten, from what I can see everything is available to the scheduled task. The settings are just not set but ignored.

We have access to the feed in the FeedExportHelper GenerateFile.

Here we can set both shop and user id on the FeedContextConfiguration, we just need to encrypt the userid, as the code further down expects to get the user id passed in that format.

  • feedContextConfiguration.UserId = Crypto.Encrypt(feed.UserId.ToString());
  • feedContextConfiguration.ShopId = feed.ShopIds.FirstOrDefault();

When inserting these two lines both are passed correctly to the PriceContext.

It is also possible to get language and currency code directly from the feed in the same way.

 

I think there is a possible confusion in what part of the code is responsible for handling the feed settings. When I use a Scheduled task in this way, where I pass it a feed, my expectations are that the setting on the feed is honoured. Right now, the responsibility is given to the scheduled task, and I can’t really see the reason as to why that is the case? Everything we need for the FeedContextConfiguration is already present on the feed.

I can see a case for allowing the scheduled task to override default feed settings, but from what I can see right now its the settings from the scheduled task or no settings.

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply
This post has been marked as an answer

Hi, 

the issue is reproduced on last DW9.15.8. New task #14114 has been created to research the suggestion and fix it in this or other way. Thanks.

BR, Oleg QA

Votes for this answer: 1
 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

The problem regarding #14115 (Not 14114) on Feed file export scheduled task

Now fixed in Dynamicweb version 9.15.10
https://doc.dynamicweb.dk/downloads/dynamicweb-9

Sorry for any inconvenience this may have caused 

Kind Regards
Dynamicweb Care Support
Kristian Kirkholt

 

You must be logged in to post in the forum