Developer forum

Forum » Development » DWAPI not returning image pattern images

DWAPI not returning image pattern images

Arnór Halldórsson
Arnór Halldórsson
Reply

Hola senores,

When calling f.e. /dwapi/ecommerce/products/{id} we always get an empty list for ImagePatternImages.

If we manually upload images to products through PIM or Ecommerce then we get the image list under AssetCategories, but never any images when using image naming patterns.

We checked the source code (roughly) and think we saw something that might possibly be suspicious.

In the ImagePatternManager constructor you initialize an empty list for foundPatterns, set it as the value of ActivePatterns but then pass foundPatterns into the AddPattern method.

Then when looping through the patterns and gathering the images for ImagePatternImages you use ActivePatterns, now it should be populated due to pass-by-reference to foundPatterns:

I doubt this is what's messing things up, but it was the only thing that I saw that rang any sorts of warning bells for me so I wanted to point it out rather than not.

We've tried this against all our DW solutions running DW versions 9.12.7 or later and none of them return any values in ImagePatternImages.

Is this a known bug or are we messing something up on our end?

Best regards,
Nóri


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Arnor

Thank you for reporting.

I can reproduce the issue - we will have a look at this!

BR Nicolai

Votes for this answer: 1
 
Arnór Halldórsson
Arnór Halldórsson
Reply

My maaaaaan! :D 

Thank you!

BR - Nóri

 
Stanislav Smetanin Dynamicweb Employee
Stanislav Smetanin
Reply
This post has been marked as an answer

Hi Arnor,
Could you please say, does your query string look like this?
http://swiftdemo.local.dynamicweb.dk/dwapi/ecommerce/products/10001?CurrencyCode=DKK&CountryCode=DK&ShopId=shop5&LanguageId=LANG1

Note that shop id is represented in lowercase.

I have found that ImagePatternManager uses ShopId from query string

And then, because in my case I have Shop with id SHOP5 (but not the shop5), it returns null. As a result - nothing in the ImagePatternImages.

So could you please use upper case for Shop and write here your result?

Kind regards.

Votes for this answer: 2
 
Nicolai Pedersen
Reply

One thing to add to this - image patterns can be set in a number of ways.

You have to use the version where they are setup on the shop and then specifically specify the shopid on the endpoint so it can be discovered. The reason is that a product can be in many shops, and the endpoint needs to find the correct version.

BR Nicolai

 
Arnór Halldórsson
Arnór Halldórsson
Reply

Hi guys,

Adding the ShopId to the query worked :D And like you said Stanislav the ShopId value must match the case of the value in the DB.

Afterwards it's actually kinda obvious since the new image naming patterns are set on the Shop itself...

Thanks alot guys!

Best regards,
Arnór

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Arnór 

The problem with ShopID has been fixed and implemented in Dynamicweb hotfix 9.13.5
Get this from the download section: https://doc.dynamicweb.com/downloads/dynamicweb-9

Kind Regards
Dynamicweb Care Support
Kristian Kirkholt

 

You must be logged in to post in the forum