示例#1
0
 public function process()
 {
     // Check tasks config mode
     //-----------------------------
     $buySynch = '/buy/templates/list/';
     $listMode = (bool) (int) Mage::helper('M2ePro/Module')->getSynchronizationConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/templates/revise/';
     $reviseMode = (bool) (int) Mage::helper('M2ePro/Module')->getSynchronizationConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/templates/relist/';
     $relistMode = (bool) (int) Mage::helper('M2ePro/Module')->getSynchronizationConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/templates/stop/';
     $stopMode = (bool) (int) Mage::helper('M2ePro/Module')->getSynchronizationConfig()->getGroupValue($buySynch, 'mode');
     if (!$listMode && !$reviseMode && !$relistMode && !$stopMode) {
         return false;
     }
     //-----------------------------
     // PREPARE SYNCH
     //---------------------------
     $this->prepareSynch();
     $this->createRunnerActions();
     //---------------------------
     // GET TEMPLATES
     //---------------------------
     $this->_profiler->addEol();
     $this->_lockItem->setPercents(self::PERCENTS_START + 5);
     $this->_lockItem->activate();
     //---------------------------
     // RUN CHILD SYNCH
     //---------------------------
     if ($listMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_List();
         $tempSynch->process();
     }
     if ($reviseMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Revise();
         $tempSynch->process();
     }
     if ($relistMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Relist();
         $tempSynch->process();
     }
     if ($stopMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Stop();
         $tempSynch->process();
     }
     //---------------------------
     // UNSET TEMPLATES
     //---------------------------
     Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Abstract::clearCache();
     //---------------------------
     // CANCEL SYNCH
     //---------------------------
     $this->executeRunnerActions();
     $this->cancelSynch();
     //---------------------------
 }
示例#2
0
 public function process()
 {
     // Check tasks config mode
     //-----------------------------
     $buySynch = '/buy/synchronization/settings/templates/start/';
     $startMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/synchronization/settings/templates/end/';
     $endMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/synchronization/settings/templates/list/';
     $listMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/synchronization/settings/templates/revise/';
     $reviseMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/synchronization/settings/templates/relist/';
     $relistMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     $buySynch = '/buy/synchronization/settings/templates/stop/';
     $stopMode = (bool) (int) Mage::helper('M2ePro/Module')->getConfig()->getGroupValue($buySynch, 'mode');
     if (!$startMode && !$endMode && !$listMode && !$reviseMode && !$relistMode && !$stopMode) {
         return false;
     }
     //-----------------------------
     // PREPARE SYNCH
     //---------------------------
     $this->prepareSynch();
     $this->createRunnerActions();
     //---------------------------
     // GET TEMPLATES
     //---------------------------
     $this->_profiler->addEol();
     $synchronizations = $this->getTemplatesWithListings();
     Mage::helper('M2ePro')->setGlobalValue('synchTemplatesArray', $synchronizations);
     $this->_lockItem->setPercents(self::PERCENTS_START + 5);
     $this->_lockItem->activate();
     //---------------------------
     // RUN CHILD SYNCH
     //---------------------------
     if ($startMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Start();
         $tempSynch->process();
     }
     if ($endMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_End();
         $tempSynch->process();
     }
     if ($listMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_List();
         $tempSynch->process();
     }
     if ($reviseMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Revise();
         $tempSynch->process();
     }
     if ($relistMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Relist();
         $tempSynch->process();
     }
     if ($stopMode) {
         $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Templates_Stop();
         $tempSynch->process();
     }
     //---------------------------
     // UNSET TEMPLATES
     //---------------------------
     Mage::helper('M2ePro')->unsetGlobalValue('synchTemplatesArray');
     //---------------------------
     // CANCEL SYNCH
     //---------------------------
     $this->executeRunnerActions();
     $this->cancelSynch();
     //---------------------------
 }