Beispiel #1
0
 protected function _prepareCollection()
 {
     // Update statistic table values
     $this->activeRecordFactory->getObject('Listing')->getResource()->updateStatisticColumns();
     $this->activeRecordFactory->getObject('Ebay\\Listing')->getResource()->updateStatisticColumns();
     $aTable = $this->activeRecordFactory->getObject('Account')->getResource()->getMainTable();
     $mTable = $this->activeRecordFactory->getObject('Marketplace')->getResource()->getMainTable();
     // Get collection of listings
     $collection = $this->ebayFactory->getObject('Listing')->getCollection();
     $collection->getSelect()->join(array('a' => $aTable), '(`a`.`id` = `main_table`.`account_id`)', array('account_title' => 'title'));
     $collection->getSelect()->join(array('m' => $mTable), '(`m`.`id` = `main_table`.`marketplace_id`)', array('marketplace_title' => 'title'));
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
Beispiel #2
0
 protected function _prepareCollection()
 {
     // Update statistic table values
     $this->activeRecordFactory->getObject('Amazon\\Listing')->getResource()->updateStatisticColumns();
     // Get collection of listings
     $collection = $this->amazonFactory->getObject('Listing')->getCollection();
     // Set global filters
     // ---------------------------------------
     $filterSellingFormatTemplate = $this->getRequest()->getParam('filter_amazon_selling_format_template');
     $filterSynchronizationTemplate = $this->getRequest()->getParam('filter_amazon_synchronization_template');
     if ($filterSellingFormatTemplate != 0) {
         $collection->addFieldToFilter('second_table.template_selling_format_id', (int) $filterSellingFormatTemplate);
     }
     if ($filterSynchronizationTemplate != 0) {
         $collection->addFieldToFilter('second_table.template_synchronization_id', (int) $filterSynchronizationTemplate);
     }
     // ---------------------------------------
     // join marketplace and accounts
     // ---------------------------------------
     $collection->getSelect()->join(array('a' => $this->activeRecordFactory->getObject('Account')->getResource()->getMainTable()), '(`a`.`id` = `main_table`.`account_id`)', array('account_title' => 'title'))->join(array('m' => $this->activeRecordFactory->getObject('Marketplace')->getResource()->getMainTable()), '(`m`.`id` = `main_table`.`marketplace_id`)', array('marketplace_title' => 'title'));
     // ---------------------------------------
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }