예제 #1
0
 private function isMeetStopRequirements(Ess_M2ePro_Model_ListingsProducts $listingProduct)
 {
     // Ebay available status
     //--------------------
     if (!$listingProduct->isListed()) {
         return false;
     }
     if (!$listingProduct->isStoppable()) {
         return false;
     }
     if ($this->_ebayActions->isExistProductAction($listingProduct, Ess_M2ePro_Model_Connectors_Ebay_Item_Dispatcher::ACTION_STOP, array())) {
         return false;
     }
     //--------------------
     // Correct synchronization
     //--------------------
     if (!$listingProduct->getListing()->isSynchronizationNowRun()) {
         return false;
     }
     //--------------------
     // Check filters
     //--------------------
     if ($listingProduct->getSynchronizationTemplate()->isStopStatusDisabled()) {
         if ($listingProduct->getMagentoProduct()->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {
             return true;
         }
     }
     if ($listingProduct->getSynchronizationTemplate()->isStopOutOfStock()) {
         if (!$listingProduct->getMagentoProduct()->getStockAvailability()) {
             return true;
         }
     }
     if ($listingProduct->getSynchronizationTemplate()->isStopWhenQtyHasValue()) {
         $productQty = (int) $listingProduct->getQty(true);
         $typeQty = (int) $listingProduct->getSynchronizationTemplate()->getStopWhenQtyHasValueType();
         $minQty = (int) $listingProduct->getSynchronizationTemplate()->getStopWhenQtyHasValueMin();
         $maxQty = (int) $listingProduct->getSynchronizationTemplate()->getStopWhenQtyHasValueMax();
         if ($typeQty == Ess_M2ePro_Model_SynchronizationsTemplates::STOP_QTY_LESS && $productQty <= $minQty) {
             return true;
         }
         if ($typeQty == Ess_M2ePro_Model_SynchronizationsTemplates::STOP_QTY_MORE && $productQty >= $minQty) {
             return true;
         }
         if ($typeQty == Ess_M2ePro_Model_SynchronizationsTemplates::STOP_QTY_BETWEEN && $productQty >= $minQty && $productQty <= $maxQty) {
             return true;
         }
     }
     //--------------------
     return false;
 }