Developer forum

Forum » PIM » ShopID in PIM Feed

ShopID in PIM Feed

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I am trying to use a PIM fed to get data out of the PIM.

My scope is to use a Save Feed Scheduled AddIn to save the feed output.

The issue I have is with the ShopID used when building the Model.Products.

Although I have selected a ShopID in the Feed Settings:

Without a QueryString Parameter, the result is not accurate.

Since this is triggered by the Scheduled task add in, I only have a few parameters available to configure:

Is there any way I can force a specific ShopId value to the context in the template?

I am using DW 9.14.7.

Thank you,
Adrian

 

 


Replies

 
Michael Knudsen
Reply

Hi Adrian,

- normally I use the below setting on the feed (parameters added on the query and of course used in the query):

Feed:

Query:

 

Br. Michael Knudsen

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Michael,

Thank you very much for the response.

I did the same. The problem is that the selection in the feed seems to be ignored and the scheduled task does not seem to use the same URL parameters as the feed. At least the ShopId is not set when the feed is accessed by the scheduled task. That's why I was looking for a way to set it in the template.

Adrian

 

 

 
Michael Knudsen
Reply

Hi Adrian,

- that sounds strange, because I have several solutions where we use the shopid parameter without any problems together with the scheduled task to store the feed in FILES. Both DW9.12 and newer versions.

For some reasons, I have the parameters in lowercase, but I recall that where a problem earlier, where the query won't accept "ShopId", but it only worked with "shopid". Dunno if that the case.

Br. Michael Knudsen

 
Anett Nissen
Anett Nissen
Reply

Hi Adrian

I have somtimes created different Queries for specific Feeds - eg. create an Austral.feed query that points down to the Austral Shop and use that for your feed

Maybe not elegant but functional :-)

Best regards Anett

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Michael,

I have made the same settings as yours and it still does not work with my setup.
However, I have adjusted a bit the template. In my template, I was using an old way of getting the primary group from the product:

product.Groups.FirstOrDefault()?.Id

This worked ONLY if I would access the feed with the parameter in the URL. If accessed from the scheduled task, this method would return null for some reason and that was my "not working" problem.

I have changed the logic to:

product.PrimaryOrDefaultGroup.Id

And now it works with the scheduled task.

Thank you very much for the help.

Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Anett,

Sure, that's a very good solution. And I am using it whenever it is suitable.

My confusion was generated not by the filtering of the products (which worked ok) but by the way the data was generated on the product.

And I suppose the ProductViewModel data is affected in some ways by the presence of the shopid parameter in the QueryString.

Anyway, I have managed to work around the issue for the moment. We'll see what other problems will arise :)

Thank you both for your contribution.


Adrian

 

You must be logged in to post in the forum