/** * @param Ess_M2ePro_Model_Listing_Other $listingOther * @return bool * @throws Ess_M2ePro_Model_Exception * @throws Ess_M2ePro_Model_Exception_Logic */ public function isMeetRelistRequirements(Ess_M2ePro_Model_Listing_Other $listingOther) { if (!$listingOther->isStopped() || !$listingOther->isRelistable()) { return false; } if (is_null($listingOther->getProductId())) { return false; } /** @var Ess_M2ePro_Model_Ebay_Listing_Other $ebayListingOther */ $ebayListingOther = $listingOther->getChildObject(); $ebaySynchronizationTemplate = $ebayListingOther->getSynchronizationModel(); if (!$ebaySynchronizationTemplate->isMode()) { return false; } if (!$ebaySynchronizationTemplate->isRelistMode()) { return false; } if ($ebaySynchronizationTemplate->isRelistFilterUserLock() && $listingOther->getStatusChanger() == Ess_M2ePro_Model_Listing_Product::STATUS_CHANGER_USER) { return false; } if ($ebaySynchronizationTemplate->isRelistStatusEnabled() && !$listingOther->getMagentoProduct()->isStatusEnabled()) { return false; } if ($ebaySynchronizationTemplate->isRelistIsInStock() && !$listingOther->getMagentoProduct()->isStockAvailability()) { return false; } if ($ebaySynchronizationTemplate->isRelistWhenQtyHasValue()) { $productQty = $ebayListingOther->getMappedQty(); if (!is_null($productQty)) { $result = false; $typeQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueType(); $minQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueMin(); $maxQty = (int) $ebaySynchronizationTemplate->getRelistWhenQtyHasValueMax(); if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_LESS && $productQty <= $minQty) { $result = true; } if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_MORE && $productQty >= $minQty) { $result = true; } if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::RELIST_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) { $result = true; } if (!$result) { return false; } } } return true; }