cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create localised media collection

0 Likes
577

Hi All, We have a requirement where each media attribute can have multiple assets as shown in below example. E.g. Product has attribute "Product Image", which can have images as "left image", "right image" etc. (this list may vary for different attributes) and all these images should be localised. i.e. EN can have different set of images for above defined types and DE can have different set.For multiple assets, we can use media Collection, and we tried localising the MediaCollection, but it dint work. Could you please provide the best approach for this requirement? Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

geffchang
Active Contributor

In items.xml, define the attribute as "localized:Media"

0 Likes

Hi Geff, Thank you for the reply. But we would need localized media collection to meet this requirement. When we tried with "localized:MediaCollection", build got failed with message as "due to missing type 'localized:MediaCollection'"

Former Member
0 Likes

Hi , I'm trying to do the same, did you find a way to it?

Former Member
0 Likes

Create a new table CountrySpecificMediaModel having 3 attributes

  1. productcode

  2. countryIso

  3. MediaCollection

When fetching a product media, run the following query

 select {csm.pk} from {CountrySpecificMedia as csm}, {Product as p} where {p.code} = {csm.productcode} and {csm.country} = <get country iso code from sesssion>


This query will give you SearchResult. Now do the following.

 SearchResult<CountrySpecifiMediaModel> queryResult = <results from previous query>
 
 CountrySpecifiMediaModel csm = queryResult.getResult().get(0)
 Collection<MediaModel> medias = csm.getMediaCollection();