I'm getting product data through an api call and now i want to store this data in my magento store? can anyone help me out to store without duplication
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://magento.com/component/controller.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"appid: 9",
"appkey: 0325615546",
"cache-control: no-cache",
"data: { \"1474614118_1\": [ \"147461411870027\",\"147461411870027\"] }",
"functionname: get_products_by_ids",
"postman-token: fd83165f-51e2-4e26-c15f-df5aba3250d7"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Respose:
"data": {
"get_products_by_ids": [
{
"product_id": 0,
"name": "Fresco 2 pc",
"description": "Light Weight Cotton Blend Fabric 2 Pc. White color kameez with round neck, full sleeves, embroidery on the front paired with shalwar.",
"meta_title": "Fresco 2 pc",
"meta_description": "",
"meta_keyword": "",
"tag": "1474614118",
"model": "E02516-WHT",
"sku": "1474614118E02516-WHT",
"upc": "1474614118",
"ean": "1474614118",
"jan": "1474614118",
"isbn": "",
"mpn": "1474614118",
"location": "",
"quantity": "0",
"stock_status": "Out Of Stock",
"image": "http://www.wearego.com/image/catalog/eid2/E02516-WHT.JPG",
"manufacturer_id": null,
"manufacturer": null,
"price": "3950.0000",
"special": "1580.0000",
"reward": null,
"points": "0",
"tax_class_id": "14746141180",
"date_available": "2016-09-08",
"weight": "0.50000000",
"weight_class_id": "14746141181",
"length": "0.00000000",
"width": "0.00000000",
"height": "0.00000000",
"length_class_id": "14746141181",
"subtract": "1",
"rating": 0,
"reviews": 0,
"minimum": "1",
"sort_order": "1",
"status": "1",
"date_added": "2016-09-08 23:03:57",
"date_modified": "2016-09-08 23:03:57",
"viewed": "3899",
"vendor_id": "1474614118",
"addtionalimages": [
{
"product_image_id": "14746141184247",
"product_id": "147461411870027",
"image": "http://www.wearego.com/image/catalog/eid2/E02516-WHT-01.JPG"
},
{
"product_image_id": "14746141184248",
"product_id": "147461411870027",
"image": "http://www.wearego.com/image/catalog/eid2/E02516-WHT-02.JPG"
}
],
"options": [],
"categories": []
}
]
}
$response
, but basically you can just create (or load) a product and save the data using theset
methods. Could you update the question and add the content of$response
? – Arjen Miedema Feb 24 '17 at 6:49