<?php include dirname(__FILE__) . '/../config/config.inc.php'; include dirname(__FILE__) . '/../init.php'; ini_set('max_execution_time', 600); ini_set('memory_limit', '-1'); //$db = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); $sql = "select cp.id_product from ps_category_product cp \n inner join ps_product p on p.id_product = cp.id_product \n where id_category = 5 and p.active = 1 and p.quantity > 0 and p.is_exclusive = 1 and p.is_customizable = 0"; $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); $skus = getSKUs($res); $header = array('id', 'name', 'parent_id', 'variation', 'size', 'description', 'quantity', 'price', 'indusdiva_code', 'keywords', 'shipping sla', 'color', 'generic color', 'fabric', 'work type(pattern)', 'wash care', 'category', "occasion", "region", 'main image', 'other image 1', 'other image 2', 'other image 3', 'other image 4'); $cdata = tocsv($header) . "\n"; foreach ($skus as $sku) { $id_product = $sku["id_product"]; $id_sku = $sku["id_sku"]; $is_parent = $sku["is_parent"]; $has_children = empty($sku["attribute"]) ? false : true; $size = empty($sku["attribute"]) ? "" : $sku["attribute"]["attribute_name"]; $product = new Product($id_product, true, 1); $data = array(); $data[] = $id_sku; $data[] = $product->name; if ($is_parent) { $data[] = ""; $data[] = "Parent"; $data[] = ""; } else { $data[] = "ID-{$id_product}"; $data[] = "Child"; $data[] = "Bust: {$size} inch"; }
if (!defined('_PS_BASE_URL_')) { define('_PS_BASE_URL_', Tools::getShopDomain(true)); } $url = "https://api.flipkart.net/"; $username = "******"; $password = "******"; $db = Db::getInstance(_PS_USE_SQL_SLAVE_); $sql = getProductsSQL(); $products = $db->ExecuteS($sql); if (count($products) === 0) { echomsg("No New Products pending to be added"); echomsg("End - Feed Preparation"); return; } $success = true; $skus = getSKUs($products); $updated_skus = array(); foreach ($skus as $sku) { $id_product = $sku["id_product"]; $id_sku = $sku['id_sku']; $is_parent = $sku["is_parent"]; $has_children = empty($sku["attribute"]) ? false : true; $size = empty($sku["attribute"]) ? "One Size" : $sku["attribute"]["attribute_name"]; $force_inactive = isset($sku['inactive']) && (int) $sku['inactive'] === 1 ? true : false; $divaProduct = new Product($id_product, true, 1); echomsg("SKU #{$id_sku} - Start"); if ($is_parent === false && $has_children === false) { $id_product_attribute = null; } else { if ($is_parent) { $id_product_attribute = null;