Hello All,
I am writing a module to import data from a particular Web Page Builder (WPB) into Shopify.
I am basing the import on a unique ID from WPB in its Product Image Database. The WPB database can have the same unique ID represented multiple times in the data set, one for each image that is used for that product.
Shopify also uses a unique ID it calls "Handle" - it too can be in the data set multiple times when there are more than one image for a product,
For multiple images for a single product, Shopify requires that the Image Position column is denoted with a 1, 2, 3 and so on so it can assign those images to a product in the correct order.
So, if Product A has a unique ID of 1234 in the WPB database, and there are 5 images associated with the product, then 1234 will be represented 5 times in the data set, with the only difference being the image URL. The same logic applies to Shopify.
I need for the code to recognise the ID from WPB is represented multiple times, and increment the Image Position by 1 when it encounters the duplicates.
Again, using the above example, the first time 1234 is in the Shopify data set, it will have the value 1 in the Image Location column, the second time it appears will have 2 and so on until the last time it appears it will have a 5.
I hope that makes sense, and some brilliant person can help!!
Cheers, Toby.
I am writing a module to import data from a particular Web Page Builder (WPB) into Shopify.
I am basing the import on a unique ID from WPB in its Product Image Database. The WPB database can have the same unique ID represented multiple times in the data set, one for each image that is used for that product.
Shopify also uses a unique ID it calls "Handle" - it too can be in the data set multiple times when there are more than one image for a product,
For multiple images for a single product, Shopify requires that the Image Position column is denoted with a 1, 2, 3 and so on so it can assign those images to a product in the correct order.
So, if Product A has a unique ID of 1234 in the WPB database, and there are 5 images associated with the product, then 1234 will be represented 5 times in the data set, with the only difference being the image URL. The same logic applies to Shopify.
I need for the code to recognise the ID from WPB is represented multiple times, and increment the Image Position by 1 when it encounters the duplicates.
Again, using the above example, the first time 1234 is in the Shopify data set, it will have the value 1 in the Image Location column, the second time it appears will have 2 and so on until the last time it appears it will have a 5.
I hope that makes sense, and some brilliant person can help!!
Cheers, Toby.