Пример #1
0
 public function finish()
 {
     parent::finish();
     $batchModel = Mage::getSingleton('dataflow/batch');
     $params = $batchModel->getParams();
     $filename = 'inventory' . $this->getRunDate() . '.csv';
     $path = Mage::getBaseDir('var') . DS . 'log' . DS . 'import' . DS . $this->__vendorName . DS . 'inventory';
     if (file_exists($path . DS . $filename)) {
         if (!empty($params['log_path'])) {
             $resource = $this->getInventoryLogResource();
             $resource->write($filename, $path . DS . $filename);
         }
         if (!empty($params['log_email'])) {
             $this->sendEmail('Attached is the inventory update reporting or download <a href="{file}">here</a>', $path . DS . $filename, $filename);
         }
         @unlink($path . DS . $filename);
     } else {
         if (!empty($params['log_email'])) {
             $this->sendEmail('There is nothing that can be changed');
         }
     }
     //$batchId = $batchModel->getId();
     //Mage::getSingleton('core/session')->unsetData('import_date_'. $batchId);
 }