This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
urapidflow:disable_missing_products [2010/09/09 18:12] unirgy |
urapidflow:disable_missing_products [2011/07/06 19:11] (current) unirgy |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Disable existing products that missing in the new products feed ====== | ||
| + | <file php urapidflow.php> | ||
| + | <?php | ||
| + | |||
| + | // initialize Magento environment | ||
| + | require_once " | ||
| + | Mage:: | ||
| + | |||
| + | // the export file contains SKUs and Status columns | ||
| + | // in file var/ | ||
| + | Mage:: | ||
| + | |||
| + | // collect new skus from the feed | ||
| + | $newSkus = array(); | ||
| + | |||
| + | // the new products feed | ||
| + | $fs = fopen(' | ||
| + | $columns = fgetcsv($fs); | ||
| + | while (($r = fgetcsv($fs))) { | ||
| + | $row = array_combine($columns, | ||
| + | $newSkus[$row[' | ||
| + | } | ||
| + | fclose($fs); | ||
| + | |||
| + | // the existing products export | ||
| + | $fs = fopen(' | ||
| + | $columns = fgetcsv($fs); | ||
| + | |||
| + | // new file to update products statuses | ||
| + | $fd = fopen(' | ||
| + | fputcsv($fd, | ||
| + | |||
| + | while (($r = fgetcsv($fs))) { | ||
| + | $row = array_combine($columns, | ||
| + | |||
| + | // if you're using not English as a store language, change the status text | ||
| + | if (empty($newSkus[$row[' | ||
| + | fputcsv($fd, | ||
| + | // you can also delete missing products (uRapidFlow Pro) | ||
| + | // will require profile "Data Type" = " | ||
| + | // fputcsv($fd, | ||
| + | } | ||
| + | } | ||
| + | fclose($fs); | ||
| + | fclose($fd); | ||
| + | |||
| + | // add and update feed products, uses file var/ | ||
| + | Mage:: | ||
| + | |||
| + | // update missing products status, uses file var/ | ||
| + | Mage:: | ||
| + | |||
| + | </ | ||