protected function getLockIdentifier() { if (!empty($this->params['switch_to'])) { $switchTo = $this->params['switch_to']; if ($switchTo === \Ess\M2ePro\Model\Amazon\Listing\Product\Action\Request\Qty::FULFILLMENT_MODE_AFN) { return 'switch_to_afn'; } if ($switchTo === \Ess\M2ePro\Model\Amazon\Listing\Product\Action\Request\Qty::FULFILLMENT_MODE_MFN) { return 'switch_to_mfn'; } } return parent::getLockIdentifier(); }
public function setListingsProducts(array $listingsProducts) { parent::setListingsProducts($listingsProducts); foreach ($this->listingsProducts as $listingProduct) { $listingProduct->setData('synch_status', \Ess\M2ePro\Model\Listing\Product::SYNCH_STATUS_OK); $listingProduct->setData('synch_reasons', null); $additionalData = $listingProduct->getAdditionalData(); unset($additionalData['synch_template_list_rules_note']); $listingProduct->setSettings('additional_data', $additionalData); $listingProduct->save(); } return $this; }
protected function filterLockedListingsProducts() { parent::filterLockedListingsProducts(); if (empty($this->params['remove'])) { return; } foreach ($this->listingsProducts as $key => $listingProduct) { /** @var \Ess\M2ePro\Model\Amazon\Listing\Product $amazonListingProduct */ $amazonListingProduct = $listingProduct->getChildObject(); if (!$amazonListingProduct->getVariationManager()->isRelationParentType()) { continue; } if (!$listingProduct->isSetProcessingLock('child_products_in_action')) { continue; } // M2ePro\TRANSLATIONS // Another Action is being processed. Try again when the Action is completed. $message = $this->modelFactory->getObject('Connector\\Connection\\Response\\Message'); $message->initFromPreparedData('Delete and Remove action is not supported if Child Products are in Action.', \Ess\M2ePro\Model\Connector\Connection\Response\Message::TYPE_ERROR); $this->getLogger()->logListingProductMessage($listingProduct, $message, \Ess\M2ePro\Model\Log\AbstractLog::PRIORITY_MEDIUM); unset($this->listingsProducts[$key]); } }