Esempio n. 1
0
 private function inspectRevisePriceRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
 {
     // Prepare actions params
     //--------------------
     $actionParams = array('only_data' => array('price' => true));
     //--------------------
     // eBay available status
     //--------------------
     if (!$listingOther->isListed()) {
         return false;
     }
     if (!$listingOther->isRevisable()) {
         return false;
     }
     if (is_null($listingOther->getProductId())) {
         return false;
     }
     if ($this->_runnerActions->isExistProductAction($listingOther, Ess_M2ePro_Model_Connector_Server_Ebay_Item_Dispatcher::ACTION_REVISE, $actionParams)) {
         return false;
     }
     //--------------------
     // Correct synchronization
     //--------------------
     if (!$listingOther->getAccount()->getChildObject()->isOtherListingsMappedSynchronizationEnabled()) {
         return false;
     }
     if (!$listingOther->getChildObject()->getSynchronizationModel()->isReviseWhenChangePrice()) {
         return false;
     }
     //--------------------
     // Check filters
     //--------------------
     $ebayListingOther = $listingOther->getChildObject();
     $currentPrice = $ebayListingOther->getMappedPrice();
     if (is_null($currentPrice)) {
         return false;
     }
     $onlinePrice = $ebayListingOther->getOnlinePrice();
     if ($currentPrice != $onlinePrice) {
         $this->_runnerActions->setProduct($listingOther, Ess_M2ePro_Model_Connector_Server_Ebay_Item_Dispatcher::ACTION_REVISE, $actionParams);
         return true;
     }
     //--------------------
     return false;
 }
 /**
  * @param Ess_M2ePro_Model_Listing_Other $listingOther
  * @return bool
  * @throws Ess_M2ePro_Model_Exception_Logic
  */
 protected function isMeetReviseGeneralRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
 {
     if (!$listingOther->isListed() || !$listingOther->isRevisable()) {
         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;
     }
     return true;
 }
Esempio n. 3
0
 private function inspectRevisePriceRequirements(Ess_M2ePro_Model_Listing_Other $listingOther)
 {
     // Prepare actions params
     //--------------------
     $actionParams = array('only_data' => array('price' => true));
     //--------------------
     // eBay available status
     //--------------------
     if (!$listingOther->isListed()) {
         return false;
     }
     if (!$listingOther->isRevisable()) {
         return false;
     }
     if (is_null($listingOther->getProductId())) {
         return false;
     }
     if ($this->getRunner()->isExistProduct($listingOther, Ess_M2ePro_Model_Listing_Product::ACTION_REVISE, $actionParams)) {
         return false;
     }
     //--------------------
     /* @var $ebaySynchronizationTemplate Ess_M2ePro_Model_Ebay_Listing_Other_Synchronization */
     $ebaySynchronizationTemplate = $listingOther->getChildObject()->getSynchronizationModel();
     // Correct synchronization
     //--------------------
     if (!$ebaySynchronizationTemplate->isMode()) {
         return false;
     }
     if (!$ebaySynchronizationTemplate->isReviseWhenChangePrice()) {
         return false;
     }
     //--------------------
     // Check filters
     //--------------------
     $ebayListingOther = $listingOther->getChildObject();
     $currentPrice = $ebayListingOther->getMappedPrice();
     if (is_null($currentPrice)) {
         return false;
     }
     $onlinePrice = $ebayListingOther->getOnlinePrice();
     if ($currentPrice != $onlinePrice) {
         $this->getRunner()->addProduct($listingOther, Ess_M2ePro_Model_Listing_Product::ACTION_REVISE, $actionParams);
         return true;
     }
     //--------------------
     return false;
 }