Adding context (2) (2)

In order to enable context (e.g. add different prices or links depending on user location or any other context information), you will have to make corresponding changes in your CSV file (the information file you are uploading into your PIM account), as well as in your integration code.

How to add context information to the CSV file.

Adding context information to your integration

You need to add certain parameters to your integration code using Deployment Kit:

You need to add the following parameter to the piece of the code highlighted on the screenshot above:

 + '&context=string

The result you are supposed to get:

const fittingRoomEndpoint = server_address  + '/fitting-room'  + '?api_token=' + api_token  + '&bba=true'  + '&context=string ;
+ '&context=string

 instead of string, you should set your context.

For example, before we used Shop A, Shop B (“https://link_to_your_website_1/, https://link_to_your_website_2/”)

So, instead of string, you should set the following links:

 + '&context=“https://link_to_your_website_1/, https://link_to_your_website_2/” '

const fittingRoomEndpoint = server_address

 + '/fitting-room'

 + '?api_token=' + api_token

 + '&bba=true'

 + '&context=“https://link_to_your_website_1/, https://link_to_your_website_2/” '

;

 

Adding context when using the iframe method


For example, you have SiteAB, SiteBC, SiteDE:

Article Context

Article_promotional_price

Name

“SiteAB, SiteBC, SiteDE“

“50,220,50“

Article1

“SiteAB, SiteBC“

“51,221“

Article2

“SiteAB“

“52“

Article3

 

  1. For this src:
    https://pim-client.wizart.ai/fitting-room?api_token=your_API_token&en all products will be displayed.

 

2. For src: https://pim-client.wizart.ai/fitting-room?api_token=your_API_token&en&context=SiteAB
product Article1 (Article_promotional_price = 50), Article2 (Article_promotional_price = 51), Article3 (Article_promotional_price = 52) will be displayed.

3. For src: https://pim-client.wizart.ai/fitting-room?api_token=your_API_token&en&context=SiteBC
products Article1 (Article_promotional_price = 220), Article2 (Article_promotional_price = 221) will be displayed.

4.  For src: https://pim-client.wizart.ai/fitting-room?api_token=your_API_token&en&context=SiteDE
products Article1 (Article_promotional_price = 50) will be displayed.

This way you can control the visibility of the products on the website and the prices (any context-sensitive attribute (!if you have any context attribute except Article_context) for them).

 

Adding context when using Deployment Kit

First, you need to find the parameter “data-parameters” in the code of your button and add the context. For example, you have this code on your site 1 and the same code on site 2:

In “data-parameters” for site 1, you should add: “link_to_your_website_1/” (the same that you added in the CSV file)
data-parameters = “link_to_your_website_1/”
In “data-parameters” for the site 2, you should add: “link_to_your_website_2/” (the same that you added in CSV file)
data-parameters = “link_to_your_website_2/”

First, you need to find the parameter “data-parameters” in the code of your button and add context.
For example, you have this code on your site 1 and the same code on site 2:

In “data-parameters” for site 1, you should add: “link_to_your_website_1/” (the same that you added in the CSV file)
data-parameters = “link_to_your_website_1/”
In “data-parameters” for the site 2, you should add: “link_to_your_website_2/” (the same that you added in CSV file)
data-parameters = “link_to_your_website_2/”