/** * @param Ess_M2ePro_Model_Listing_Other $listingOther * @return bool * @throws Ess_M2ePro_Model_Exception * @throws Ess_M2ePro_Model_Exception_Logic */ public function isMeetStopRequirements(Ess_M2ePro_Model_Listing_Other $listingOther) { if (!$listingOther->isListed() || !$listingOther->isStoppable()) { 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->isStopStatusDisabled() && !$listingOther->getMagentoProduct()->isStatusEnabled()) { return true; } if ($ebaySynchronizationTemplate->isStopOutOfStock() && !$listingOther->getMagentoProduct()->isStockAvailability()) { return true; } if ($ebaySynchronizationTemplate->isStopWhenQtyHasValue()) { $productQty = $ebayListingOther->getMappedQty(); if (!is_null($productQty)) { $typeQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueType(); $minQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMin(); $maxQty = (int) $ebaySynchronizationTemplate->getStopWhenQtyHasValueMax(); if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_LESS && $productQty <= $minQty) { return true; } if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_MORE && $productQty >= $minQty) { return true; } if ($typeQty == Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) { return true; } } } return false; }