Exemple #1
0
<!DOCTYPE HTML>
<html>
	<head>
		<?php 
include 'awsScript.php';
?>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
	</head>
	
	<body>
		<?php 
itemLookup('B000MXKMJY');
?>
	</body>
</html>
            fwrite($log, "FAILED to update old item_prices record with end_date for {$row['id']} :: " . $dbh->error . "\n");
            return false;
        }
    }
    $query = "INSERT INTO item_prices (item_id, item_price_type_id, price, start_date, end_date) VALUES ('{$itemid}', '{$type}', '{$price}', '{$start}', NULL)";
    if (!$dbh->query($query)) {
        fwrite($log, "FAILED to insert new item_prices record - {$query} :: " . $dbh->error . "\n");
        return false;
    }
    return true;
}
print "\nProcessing price sheet file ";
// Cycle through the main loop
while (($data = fgetcsv($file, 1024, ',')) !== false) {
    print '.';
    if ($item_id = itemLookup($data[0], $data[1])) {
        // set the UK price
        if (!$data[3]) {
            // skip to next record
            fwrite($log, "MISSING PRICE value for {$item_id} :: " . $dbh->error . "\n");
            continue;
        }
        itemPrice($item_id, $data[3], 6, $data[2]);
        if ($data[4]) {
            // US price
            itemPrice($item_id, $data[4], 1, $data[2]);
        }
        if ($data[5]) {
            // CAN price
            itemPrice($item_id, $data[5], 3, $data[2]);
        }