开发者

Magento product imports from csv file

I want to import Magento products from my csv file, but when I import this csv file I get an error like this ( Skip import row, required field "sku" not defined) However, I had this field defined 开发者_如何学运维in my csv file.

If any one has any idea about that then please advise me. Which method should I follow to import my csv products to Magento

Thanks for help in advance


I find this solution its very simple:

  1. just go to system->import/export and then u export all product by csv

  2. now enter all other fields or attribute data in csv which u required.

  3. <?php
    set_time_limit(0);
    define('MAGENTO_MAGE_LOCATION','/your site name path/app/Mage.php');
    error_reporting(E_ALL);
    $handle = fopen("your csv name path.csv", "r");
    $count=0;
    while (($data = fgetcsv($handle)) !== FALSE)
    {
      $count++;
      if($data[0] != 'store')
      {
        require_once MAGENTO_MAGE_LOCATION;
        Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
        $product = Mage::getModel('catalog/product');
        $product->setSku($data[5]);
        $product->setName($data[7]);
         .
         .
         .
        try {
          $product->save();
          echo '<br> hi product save successfully in magento uniqe mobile store';
        }
        catch (Exception $ex) {  
          echo 'Handle the error';
        }
    
      }// end of if statment store 
    }// end of while loop 
    fclose($handle);
    ?>
    

use this code and set all products but all fields set acourding to ur CSV file. then run this code . its working i test this code. its my own creation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜