protected function _prepareCollection() { // Get collection logs //-------------------------------- $collection = Mage::getModel('M2ePro/Synchronization_Log')->getCollection(); //-------------------------------- $channel = $this->getData('channel'); if (!empty($channel)) { $collection->getSelect()->where('component_mode = ?', $channel); } else { $components = $this->viewComponentHelper->getActiveComponents(); $collection->getSelect()->where('component_mode IN(\'' . implode('\',\'', $components) . '\') OR component_mode IS NULL'); } if (isset($components) && in_array(Ess_M2ePro_Helper_Component_Ebay::NICK, $components) && Mage::helper('M2ePro/View_Ebay')->isSimpleMode()) { $excludeTasks = array(Ess_M2ePro_Model_Synchronization_Log::TASK_FEEDBACKS, Ess_M2ePro_Model_Synchronization_Log::TASK_OTHER_LISTINGS); $collection->getSelect()->where('task NOT IN (' . implode(',', $excludeTasks) . ')'); } // we need sort by id also, because create_date may be same for some adjacents entries //-------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } //-------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { $listingData = Mage::helper('M2ePro/Data_Global')->getValue('temp_data'); // Get collection logs //-------------------------------- $collection = Mage::getModel('M2ePro/Listing_Other_Log')->getCollection(); //-------------------------------- // Join amazon_listings_table //-------------------------------- $collection->getSelect()->joinLeft(array('lo' => Mage::getResourceModel('M2ePro/Listing_Other')->getMainTable()), '(`main_table`.listing_other_id = `lo`.id)', array('account_id' => 'lo.account_id', 'marketplace_id' => 'lo.marketplace_id'))->joinLeft(array('ea' => Mage::getResourceModel('M2ePro/Ebay_Account')->getMainTable()), '(`lo`.account_id = `ea`.account_id)', array('account_mode' => 'ea.mode')); //-------------------------------- // Set listing filter //-------------------------------- if (isset($listingData['id'])) { $collection->addFieldToFilter('`main_table`.listing_other_id', $listingData['id']); } //-------------------------------- // prepare components //-------------------------------- $components = $this->viewComponentHelper->getActiveComponents(); $collection->getSelect()->where('main_table.component_mode IN(\'' . implode('\',\'', $components) . '\') OR main_table.component_mode IS NULL'); //-------------------------------- // we need sort by id also, because create_date may be same for some adjacents entries //-------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } //-------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { $listingData = Mage::helper('M2ePro')->getGlobalValue('temp_data'); // Get collection logs //-------------------------------- $collection = Mage::getModel('M2ePro/Listing_Log')->getCollection(); //-------------------------------- $components = Mage::helper('M2ePro/Component')->getActiveComponents(); $collection->getSelect()->where('component_mode IN(\'' . implode('\',\'', $components) . '\') OR component_mode IS NULL'); // Set listing filter //-------------------------------- if (isset($listingData['id'])) { $collection->addFieldToFilter('listing_id', $listingData['id']); } //-------------------------------- // we need sort by id also, because create_date may be same for some adjacents entries //-------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } //-------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { // Get collection logs //-------------------------------- $collection = Mage::getModel('M2ePro/Listing_Log')->getCollection(); //-------------------------------- // Set listing filter //-------------------------------- if ($this->getEntityId()) { $collection->addFieldToFilter('listing_id', $this->getEntityId()); } //-------------------------------- // prepare components //-------------------------------- $components = $this->viewComponentHelper->getActiveComponents(); $collection->getSelect()->where('component_mode IN(\'' . implode('\',\'', $components) . '\') OR component_mode IS NULL'); //-------------------------------- // we need sort by id also, because create_date may be same for some adjustment entries //-------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } //-------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { // Get collection logs //-------------------------------- $collection = Mage::getModel('M2ePro/Synchronization_Log')->getCollection(); //-------------------------------- $components = Mage::helper('M2ePro/Component')->getActiveComponents(); $collection->getSelect()->where('component_mode IN(\'' . implode('\',\'', $components) . '\') OR component_mode IS NULL'); // we need sort by id also, because create_date may be same for some adjacents entries //-------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } //-------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { // Get collection logs // --------------------------------------- $collection = Mage::getModel('M2ePro/Listing_Log')->getCollection(); // --------------------------------------- // Set listing filter // --------------------------------------- if ($this->getEntityId()) { if ($this->isListingProductLog() && $this->getListingProduct()->isComponentModeAmazon() && $this->getListingProduct()->getChildObject()->getVariationManager()->isRelationParentType()) { $collection->addFieldToFilter(array(self::LISTING_PRODUCT_ID_FIELD, self::LISTING_PARENT_PRODUCT_ID_FIELD), array(array('attribute' => self::LISTING_PRODUCT_ID_FIELD, 'eq' => $this->getEntityId()), array('attribute' => self::LISTING_PARENT_PRODUCT_ID_FIELD, 'eq' => $this->getEntityId()))); } else { $collection->addFieldToFilter($this->getEntityField(), $this->getEntityId()); } } // --------------------------------------- // prepare components // --------------------------------------- $channel = $this->getRequest()->getParam('channel'); if (!empty($channel) && $channel != Ess_M2ePro_Block_Adminhtml_Common_Log_Tabs::CHANNEL_ID_ALL) { $collection->getSelect()->where('component_mode = ?', $channel); } else { $components = $this->viewComponentHelper->getActiveComponents(); $collection->getSelect()->where('component_mode IN(\'' . implode('\',\'', $components) . '\') OR component_mode IS NULL'); } // --------------------------------------- // we need sort by id also, because create_date may be same for some adjustment entries // --------------------------------------- if ($this->getRequest()->getParam('sort', 'create_date') == 'create_date') { $collection->setOrder('id', $this->getRequest()->getParam('dir', 'DESC')); } // --------------------------------------- // Set collection to grid $this->setCollection($collection); return parent::_prepareCollection(); }