protected function logError(\Ess\M2ePro\Model\Listing\Product $listingProduct, \Exception $exception)
 {
     /** @var \Ess\M2ePro\Model\Amazon\Listing\Log $logModel */
     $logModel = $this->activeRecordFactory->getObject('Amazon\\Listing\\Log');
     $logModel->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, $logModel->getNextActionId(), $this->getActionForLog(), $exception->getMessage(), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_ERROR, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_HIGH);
     $this->getHelper('Module\\Exception')->process($exception);
 }
 protected function addListingsProductsLogsMessage(\Ess\M2ePro\Model\Listing\Product $listingProduct, $text, $type = \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, $priority = \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_MEDIUM)
 {
     $action = \Ess\M2ePro\Model\Listing\Log::ACTION_TRANSLATE_PRODUCT;
     if ($this->getStatusChanger() == \Ess\M2ePro\Model\Listing\Product::STATUS_CHANGER_UNKNOWN) {
         $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_UNKNOWN;
     } else {
         if ($this->getStatusChanger() == \Ess\M2ePro\Model\Listing\Product::STATUS_CHANGER_USER) {
             $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_USER;
         } else {
             $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION;
         }
     }
     /** @var  $logModel \Ess\M2ePro\Model\Listing\Log */
     $logModel = $this->activeRecordFactory->getObject('Listing\\Log');
     $logModel->setComponentMode(\Ess\M2ePro\Helper\Component\Ebay::NICK);
     $logModel->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), $initiator, $this->getLogsActionId(), $action, $text, $type, $priority);
 }
Beispiel #3
0
 private function logListingProductMessage(\Ess\M2ePro\Model\Listing\Product $listingProduct, $action, $oldValue, $newValue)
 {
     // M2ePro\TRANSLATIONS
     // From [%from%] to [%to%].
     $log = $this->activeRecordFactory->getObject('Listing\\Log');
     $log->setComponentMode($listingProduct->getComponentMode());
     $log->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, NULL, $action, $log->encodeDescription('From [%from%] to [%to%].', array('from' => $oldValue, 'to' => $newValue)), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_LOW);
 }
 protected function addListingsProductsLogsMessage(\Ess\M2ePro\Model\Listing\Product $listingProduct, $text, $type = \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, $priority = \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_MEDIUM)
 {
     $action = \Ess\M2ePro\Model\Listing\Log::ACTION_TRANSLATE_PRODUCT;
     if ($this->params['status_changer'] == \Ess\M2ePro\Model\Listing\Product::STATUS_CHANGER_UNKNOWN) {
         $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_UNKNOWN;
     } else {
         if ($this->params['status_changer'] == \Ess\M2ePro\Model\Listing\Product::STATUS_CHANGER_USER) {
             $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_USER;
         } else {
             $initiator = \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION;
         }
     }
     switch ($type) {
         case \Ess\M2ePro\Model\Log\AbstractLog::TYPE_ERROR:
             $this->setStatus(\Ess\M2ePro\Helper\Data::STATUS_ERROR);
             break;
         case \Ess\M2ePro\Model\Log\AbstractLog::TYPE_WARNING:
             $this->setStatus(\Ess\M2ePro\Helper\Data::STATUS_WARNING);
             break;
         case \Ess\M2ePro\Model\Log\AbstractLog::TYPE_SUCCESS:
         case \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE:
             $this->setStatus(\Ess\M2ePro\Helper\Data::STATUS_SUCCESS);
             break;
         default:
             $this->setStatus(\Ess\M2ePro\Helper\Data::STATUS_ERROR);
             break;
     }
     $logModel = $this->activeRecordFactory->getObject('Listing\\Log');
     $logModel->setComponentMode(\Ess\M2ePro\Helper\Component\Ebay::NICK);
     $logModel->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), $initiator, $this->logsActionId, $action, $text, $type, $priority);
 }
Beispiel #5
0
 private function logListingProductMessage(\Ess\M2ePro\Model\Listing\Product $listingProduct, $action, $oldValue, $newValue, $messagePostfix = '')
 {
     // M2ePro\TRANSLATIONS
     // From [%from%] to [%to%].
     $log = $this->activeRecordFactory->getObject(ucfirst($listingProduct->getComponentMode()) . '\\Listing\\Log');
     $oldValue = strlen($oldValue) > 150 ? substr($oldValue, 0, 150) . ' ...' : $oldValue;
     $newValue = strlen($newValue) > 150 ? substr($newValue, 0, 150) . ' ...' : $newValue;
     $messagePostfix = trim(trim($messagePostfix), '.');
     if (!empty($messagePostfix)) {
         $messagePostfix = ' ' . $messagePostfix;
     }
     if ($listingProduct->isComponentModeEbay() && is_array($listingProduct->getData('found_options_ids'))) {
         $collection = $this->activeRecordFactory->getObject('Listing\\Product\\Variation\\Option')->getCollection()->addFieldToFilter('main_table.id', array('in' => $listingProduct->getData('found_options_ids')));
         $additionalData = array();
         foreach ($collection as $listingProductVariationOption) {
             /** @var \Ess\M2ePro\Model\Listing\Product\Variation\Option $listingProductVariationOption  */
             $additionalData['variation_options'][$listingProductVariationOption->getAttribute()] = $listingProductVariationOption->getOption();
         }
         if (!empty($additionalData['variation_options']) && $collection->getFirstItem()->getProductType() == \Ess\M2ePro\Model\Magento\Product::TYPE_BUNDLE) {
             foreach ($additionalData['variation_options'] as $attribute => $option) {
                 $log->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, NULL, $action, $log->encodeDescription('From [%from%] to [%to%]' . $messagePostfix . '.', array('!from' => $oldValue, '!to' => $newValue)), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_LOW, array('variation_options' => array($attribute => $option)));
             }
             return;
         }
         $log->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, NULL, $action, $log->encodeDescription('From [%from%] to [%to%]' . $messagePostfix . '.', array('!from' => $oldValue, '!to' => $newValue)), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_LOW, $additionalData);
         return;
     }
     $log->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, NULL, $action, $log->encodeDescription('From [%from%] to [%to%]' . $messagePostfix . '.', array('!from' => $oldValue, '!to' => $newValue)), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_NOTICE, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_LOW);
 }
Beispiel #6
0
 /**
  * @param \Ess\M2ePro\Model\Listing\Product $listingProduct
  * @param \Ess\M2ePro\Model\Connector\Connection\Response\Message $message
  * @param int $priority
  */
 public function logListingProductMessage(\Ess\M2ePro\Model\Listing\Product $listingProduct, \Ess\M2ePro\Model\Connector\Connection\Response\Message $message, $priority = \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_MEDIUM)
 {
     if ($this->storeMode) {
         $this->storedMessages[] = array('type' => $this->initLogType($message), 'text' => $message->getText());
         return;
     }
     $this->getListingLog()->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), $this->initiator, $this->actionId, $this->action, $message->getText(), $this->initLogType($message), $priority);
 }
Beispiel #7
0
 protected function logListingProductException(\Ess\M2ePro\Model\Listing\Product $listingProduct, \Exception $exception, $action, $params)
 {
     $logModel = $this->activeRecordFactory->getObject('Listing\\Log');
     $logModel->setComponentMode(\Ess\M2ePro\Helper\Component\Ebay::NICK);
     $action = $this->recognizeActionForLogging($action, $params);
     $initiator = $this->recognizeInitiatorForLogging($params);
     $logModel->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), $initiator, $this->logsActionId, $action, $exception->getMessage(), \Ess\M2ePro\Model\Log\AbstractLog::TYPE_ERROR, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_HIGH);
 }
Beispiel #8
0
 private function logReportChange(\Ess\M2ePro\Model\Listing\Product $listingProduct, $logMessage)
 {
     if (empty($logMessage)) {
         return;
     }
     $log = $this->activeRecordFactory->getObject('Listing\\Log');
     $log->setComponentMode(\Ess\M2ePro\Helper\Component\Ebay::NICK);
     $log->addProductMessage($listingProduct->getListingId(), $listingProduct->getProductId(), $listingProduct->getId(), \Ess\M2ePro\Helper\Data::INITIATOR_EXTENSION, $this->getLogsActionId(), \Ess\M2ePro\Model\Listing\Log::ACTION_CHANNEL_CHANGE, $logMessage, \Ess\M2ePro\Model\Log\AbstractLog::TYPE_SUCCESS, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_LOW);
 }