Ejemplo n.º 1
0
 /**
  * Method called on the cron to do the export
  *
  * @return bool
  */
 public function export()
 {
     $productExport = $this->_getProductsForExport();
     $productCount = count($productExport);
     $exportCount = 0;
     foreach ($productExport as $productId => $categories) {
         try {
             $this->_eventClient->saveProductData($productId, $categories);
             $this->_setExportedProducts($productId);
             ++$exportCount;
         } catch (\Exception $e) {
             $this->_logger->addCritical("Product ID - {$productId} failed to export: " . $e);
             return false;
         }
     }
     $this->_updateDatabase();
     $this->_logger->addInfo("Successfully exported " . $exportCount . " out " . $productCount . " products ");
     return true;
 }