/** * 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; }
/** * Send the new product to PredictionIO * * @param $productId * @return bool */ private function _sendToPredictionIO($productId) { return $this->_eventClient->saveProductData($productId, $this->_getProductCategoryCollection($productId)); }