Exemple #1
0
 public function __construct(array $config)
 {
     $source = is_string($config) ? $config : $config['file'];
     if (!is_string($source)) {
         Mage::throwException(Mage::helper('importexport')->__('Source file path must be a string'));
     }
     if (!is_readable($source)) {
         Mage::throwException(Mage::helper('importexport')->__("%s file does not exists or is not readable", $source));
     }
     if (!is_file($source)) {
         Mage::throwException(Mage::helper('importexport')->__("%s isn't a file, probably a folder.", $source));
     }
     Mage::helper('ho_import/log')->log(Mage::helper('ho_import')->__("Loading source file %s", $source));
     $this->_source = $source;
     parent::__construct($this->_source);
     if ($config['has_headers'] && is_numeric($config['has_headers'])) {
         $this->_hasHeaders = true;
         $this->rewind();
     }
     return $this;
 }
 public function __construct($file)
 {
     parent::__construct($file);
     foreach ($this as $row) {
         $this->fields = $row;
         break;
     }
 }