Page 1 of 1

import data for Advanced Stock Options

Posted: 09 Jan 2024, 04:58
by Mantrid
I have a supplier's catalog in CSV
having the following structure :

pairCode; SKU; name; category; price; variant
22 ; 123 ; t-shirtA ;t-shirt\female;777;L
22 ; 124 ; t-shirtA ;t-shirt\female;777; XL
22 ; 125 ; t-shirtA ;t-shirt\female;777;XXL
pairCode; SKU; name; category; price; variant
23 ; 126 ; t-shirtB ;t-shirt\female;775;L
23 ; 127 ; t-shirtB ;t-shirt\female;775; XL
23 ; 128 ; t-shirtB ;t-shirt\female;775;XXL

I understand that I will have to transform my CSV into a format compatible with the format that phoka cart can import.

are there any functions or API that will help me import my data into Advanced Stock Options?

data from Advanced Stock Options CSV field have JSON data :

"[{""id"":28,""product_id"":1,""product_key"":""1:YToxOntpOjU7YToxOntpOjU7aTo1O319:"",""stock"":3,""attributes"":""a:1:{i:5;a:1:{i:5;i:5;}}""},{""id"":29,""product_id"":1,""product_key"":""1:YToxOntpOjU7YToxOntpOjc7aTo3O319:"",""stock"":2,""attributes"":""a:1:{i:5;a:1:{i:7;i:7;}}""}]"

or attribute JSON :

"{""5"":{""id"":5,""title"":""Size"",""alias"":""size"",""required"":1,""type"":3,""published"":1,""options"":{""5"":{""id"":5,""title"":""128"",""alias"":""128"",""published"":1,""amount"":""0.0000"",""operator"":""+"",""stock"":0,""operator_weight"":""+"",""weight"":""0.0000"",""image"":"""",""image_medium"":"""",""image_small"":""attribute\/classic_32x32px_vel_128.png"",""download_folder"":""ad96451347bee262"",""download_file"":"""",""download_token"":""9d77b595dc9e301a3245bd1c24013815e6cc1e69c3b2ad2d9c342d3303b06c9d"",""color"":"""",""default_value"":1,""required"":1,""type"":0},""7"":{""id"":7,""title"":""146"",""alias"":""146"",""published"":1,""amount"":""0.0000"",""operator"":""+"",""stock"":0,""operator_weight"":""+"",""weight"":""0.0000"",""image"":"""",""image_medium"":"""",""image_small"":""attribute\/classic_32x32px_vel_146.png"",""download_folder"":""7af815fcbff45844"",""download_file"":"""",""download_token"":""a94961a0ba4ebcd54f470328cf7066e2c56a1b25e25c8cf438baea13752f6c30"",""color"":"""",""default_value"":0,""required"":0,""type"":0}}}}"

what is the easiest way for transform supplier's catalog to JSON field ? or may be direct api for create product variants ?
which JSON attributes and CSV fields are required?

Re: import data for Advanced Stock Options

Posted: 10 Jan 2024, 01:24
by Jan
Hi, the best way is to create some demo product with attributes and export it, to see all values which need to be set in the CSV/JSON :idea:

Jan