Beispiel #1
0
 public function process()
 {
     $dispatcherObject = $this->modelFactory->getObject('Amazon\\Connector\\Dispatcher');
     $connectorObj = $dispatcherObject->getCustomConnector('Amazon\\Search\\Custom\\' . ucfirst($this->getSearchMethod()) . '\\Requester', $this->getConnectorParams(), $this->listingProduct->getAccount());
     $dispatcherObject->process($connectorObj);
     return $this->prepareResult($connectorObj->getPreparedResponseData());
 }
Beispiel #2
0
 public function setListingProduct(\Ess\M2ePro\Model\Listing\Product $listingProduct)
 {
     if (!is_null($listingProduct->getActionConfigurator())) {
         $actionConfigurator = $listingProduct->getActionConfigurator();
     } else {
         $actionConfigurator = $this->modelFactory->getObject('Ebay\\Listing\\Product\\Action\\Configurator');
     }
     $this->listingProduct = $listingProduct->load($listingProduct->getId());
     $this->listingProduct->setActionConfigurator($actionConfigurator);
     $this->marketplace = $this->listingProduct->getMarketplace();
     $this->account = $this->listingProduct->getAccount();
 }
Beispiel #3
0
 private function getProductStatusChanges(\Ess\M2ePro\Model\Listing\Product $listingProduct, array $change)
 {
     $data = array();
     $qty = (int) $change['quantity'] < 0 ? 0 : (int) $change['quantity'];
     $qtySold = (int) $change['quantitySold'] < 0 ? 0 : (int) $change['quantitySold'];
     if (($change['listingStatus'] == self::EBAY_STATUS_COMPLETED || $change['listingStatus'] == self::EBAY_STATUS_ENDED) && $qty == $qtySold) {
         $data['status'] = \Ess\M2ePro\Model\Listing\Product::STATUS_SOLD;
     } else {
         if ($change['listingStatus'] == self::EBAY_STATUS_COMPLETED) {
             $data['status'] = \Ess\M2ePro\Model\Listing\Product::STATUS_STOPPED;
         } else {
             if ($change['listingStatus'] == self::EBAY_STATUS_ENDED) {
                 $data['status'] = \Ess\M2ePro\Model\Listing\Product::STATUS_FINISHED;
             } else {
                 if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE && $qty - $qtySold <= 0) {
                     $data['status'] = \Ess\M2ePro\Model\Listing\Product::STATUS_HIDDEN;
                 } else {
                     if ($change['listingStatus'] == self::EBAY_STATUS_ACTIVE) {
                         $data['status'] = \Ess\M2ePro\Model\Listing\Product::STATUS_LISTED;
                     }
                 }
             }
         }
     }
     $accountOutOfStockControl = $listingProduct->getAccount()->getChildObject()->getOutOfStockControl(true);
     if (isset($change['out_of_stock'])) {
         $data['additional_data'] = array('out_of_stock_control' => (bool) $change['out_of_stock']);
     } elseif ($data['status'] == \Ess\M2ePro\Model\Listing\Product::STATUS_HIDDEN && !is_null($accountOutOfStockControl) && !$accountOutOfStockControl) {
         // Listed Hidden Status can be only for GTC items
         if (is_null($listingProduct->getChildObject()->getOnlineDuration())) {
             $data['online_duration'] = \Ess\M2ePro\Helper\Component\Ebay::LISTING_DURATION_GTC;
         }
         $additionalData = $listingProduct->getAdditionalData();
         empty($additionalData['out_of_stock_control']) && ($additionalData['out_of_stock_control'] = true);
         $data['additional_data'] = json_encode($additionalData);
     }
     if ($listingProduct->getStatus() == $data['status']) {
         return $data;
     }
     $data['status_changer'] = \Ess\M2ePro\Model\Listing\Product::STATUS_CHANGER_COMPONENT;
     $statusChangedFrom = $this->getHelper('Component\\Ebay')->getHumanTitleByListingProductStatus($listingProduct->getStatus());
     $statusChangedTo = $this->getHelper('Component\\Ebay')->getHumanTitleByListingProductStatus($data['status']);
     if (!empty($statusChangedFrom) && !empty($statusChangedTo)) {
         // M2ePro\TRANSLATIONS
         // Item Status was successfully changed from "%from%" to "%to%" .
         $this->logReportChange($listingProduct, $this->getHelper('Module\\Translation')->__('Item Status was successfully changed from "%from%" to "%to%" .', $statusChangedFrom, $statusChangedTo));
     }
     $this->activeRecordFactory->getObject('ProductChange')->addUpdateAction($listingProduct->getProductId(), \Ess\M2ePro\Model\ProductChange::INITIATOR_SYNCHRONIZATION);
     if ($this->listingsProductsLockStatus[$listingProduct->getId()]) {
         $this->listingsProductsIdsForActionSkipping[] = $listingProduct->getId();
     }
     return $data;
 }