<?php // initialize Magento environment require_once "app/Mage.php"; Mage::app('admin')->setCurrentStore(0); // the export file contains SKUs and Status columns // in file var/urapidflow/export/existing_products.csv Mage::helper('urapidflow')->run("Export Existing Products"); // collect new skus from the feed $newSkus = array(); // the new products feed $fs = fopen('var/urapidflow/import/new_feed.csv', 'r'); $columns = fgetcsv($fs); // read column titles while (($r = fgetcsv($fs))) { $row = array_combine($columns, $r); $newSkus[$row['sku']] = 1; } fclose($fs); // the existing products export $fs = fopen('var/urapidflow/export/existing_products.csv', 'r'); $columns = fgetcsv($fs); // read column titles // new file to update products statuses $fd = fopen('var/urapidflow/import/update_status.csv', 'w'); fputcsv($fd, array('sku', 'status')); while (($r = fgetcsv($fs))) { $row = array_combine($columns, $r); // if you're using not English as a store language, change the status text if (empty($newSkus[$row['sku']]) && $row['status']!='Disabled') { fputcsv($fd, array($row['sku'], 0)); // you can also delete missing products (uRapidFlow Pro) // will require profile "Data Type" = "Product Extra" // fputcsv($fd, array('-CP', $r['sku'])); } } fclose($fs); fclose($fd); // add and update feed products, uses file var/urapidflow/import/new_feed.csv Mage::helper('urapidflow')->run("Import Products"); // update missing products status, uses file var/urapidflow/import/update_status.csv Mage::helper('urapidflow')->run("Update Product Status");