Beispiel #1
0
	while ( ($data = fgetcsv ( $handle, 1000, "," )) !== FALSE ) {

		//$d [] = $data;
		//print_r($d);
		$products[$data[16]] = "";
		//getByName($data);

	}
	fclose ( $handle );

	
}

foreach($products as $name=>$nothing)
{
	$products[$name] = getProductBySku(trim($name));
}


//echo "<pre>";
//print_r($products);
//echo "</pre>";



echo"found : ".count($found)."<br>\nnone : ".count($none)."<br>\nmultiple : ".count($multiple)."<br>";

echo "----------------Found---------------<br>";
echo "<pre>";
print_r($found);
echo "</pre>";
require __DIR__ . '/vendor/autoload.php';
use phpish\shopify;
require __DIR__ . '/conf.php';
require __DIR__ . '/includes/functions.php';
require __DIR__ . '/spreadsheet-reader/php-excel-reader/excel_reader2.php';
require __DIR__ . '/spreadsheet-reader/SpreadsheetReader.php';
echo "<pre>";
$PricePlanReader = new SpreadsheetReader('price_plan.xls');
$pricePlans = getPricePlans($PricePlanReader);
$shopify = shopify\client(SHOPIFY_SHOP, SHOPIFY_APP_API_KEY, SHOPIFY_APP_PASSWORD, true);
$products = getShopifyProducts($shopify);
$response = getVariants($products, $pricePlans);
$updatedVariantsCnt = 0;
foreach ($response as $variantData) {
    $variantId = $variantData['id'];
    $values = getProductBySku($variantData['sku']);
    $basicVariants = getbasicVariants($values);
    $priceVariant = array('price' => $variantData['price']);
    $variant = array_merge($priceVariant, $basicVariants);
    $data = array('variant' => $variant);
    updateVariants($shopify, $data, $variantId);
    usleep(500000);
    $updatedVariantsCnt++;
}
echo "</pre>";
?>

	Updated <?php 
echo $updatedVariantsCnt;
?>
 Products Variants.<br />