Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', '1');
- ini_set('max_execution_time', 1000);
- require_once dirname(__FILE__) . './../app/Mage.php';
- Mage::app('default');
- $file = 'o.csv';
- $csv = new Varien_File_Csv();
- $data = $csv->getData($file);
- $array = array();
- foreach ($data as $d) {
- $row = array();
- $row[] = $d['0'];
- if ($d[0] != '') {
- $r = explode(',', $d[0]);
- var_dump($r);
- $orderRow = array();
- foreach($r as $o) {
- $orderRow[] = $o;
- $order = Mage::getModel('sales/order')->loadByIncrementId($o);
- var_dump($order->getData());
- $orderRow[] = $order->getData('base_subtotal');
- }
- die();
- $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$d[0]);
- if ($product && $product->getId()) {
- echo $d[0];
- echo '<hr>';
- Mage::getSingleton('catalog/category_api')->assignProduct($catId, $product->getId());
- }
- }
- }
- ?>
- </pre>
- <hr/>
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement