Example #1
0
 protected function _prepareCollection()
 {
     /** @var $connRead Varien_Db_Adapter_Pdo_Mysql */
     $connRead = Mage::getSingleton('core/resource')->getConnection('core_read');
     // Prepare selling format collection
     // ---------------------------------------
     $collectionSellingFormat = Mage::getModel('M2ePro/Template_SellingFormat')->getCollection();
     $collectionSellingFormat->getSelect()->reset(Varien_Db_Select::COLUMNS);
     $collectionSellingFormat->getSelect()->columns(array('id as template_id', 'title', new Zend_Db_Expr('\'' . self::TEMPLATE_SELLING_FORMAT . '\' as `type`'), 'create_date', 'update_date'));
     $collectionSellingFormat->getSelect()->where('component_mode = (?)', $this->nick);
     // ---------------------------------------
     // Prepare synchronization collection
     // ---------------------------------------
     $collectionSynchronization = Mage::getModel('M2ePro/Template_Synchronization')->getCollection();
     $collectionSynchronization->getSelect()->reset(Varien_Db_Select::COLUMNS);
     $collectionSynchronization->getSelect()->columns(array('id as template_id', 'title', new Zend_Db_Expr('\'' . self::TEMPLATE_SYNCHRONIZATION . '\' as `type`'), 'create_date', 'update_date'));
     $collectionSynchronization->getSelect()->where('component_mode = (?)', $this->nick);
     // ---------------------------------------
     // Prepare union select
     // ---------------------------------------
     $unionSelect = $connRead->select();
     $unionSelect->union(array($collectionSellingFormat->getSelect(), $collectionSynchronization->getSelect()));
     // ---------------------------------------
     // Prepare result collection
     // ---------------------------------------
     $resultCollection = new Varien_Data_Collection_Db($connRead);
     $resultCollection->getSelect()->reset()->from(array('main_table' => $unionSelect), array('template_id', 'title', 'type', 'create_date', 'update_date'));
     // ---------------------------------------
     //        echo $resultCollection->getSelectSql(true); exit;
     $this->setCollection($resultCollection);
     return parent::_prepareCollection();
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     // Initialization block
     //------------------------------
     $this->setId('commonAmazonTemplateGrid');
     //------------------------------
 }
Example #3
0
 protected function _prepareColumns()
 {
     $this->addColumnAfter('marketplace', array('header' => Mage::helper('M2ePro')->__('Marketplace'), 'align' => 'left', 'type' => 'options', 'width' => '100px', 'index' => 'marketplace_id', 'filter_index' => 'marketplace_id', 'filter_condition_callback' => array($this, 'callbackFilterMarketplace'), 'frame_callback' => array($this, 'callbackColumnMarketplace'), 'options' => $this->getEnabledMarketplaceTitles()), 'type');
     parent::_prepareColumns();
     $options = array(self::TEMPLATE_SELLING_FORMAT => Mage::helper('M2ePro')->__('Selling Format'), self::TEMPLATE_SHIPPING_OVERRIDE => Mage::helper('M2ePro')->__('Shipping Override'), self::TEMPLATE_DESCRIPTION => Mage::helper('M2ePro')->__('Description'), self::TEMPLATE_SYNCHRONIZATION => Mage::helper('M2ePro')->__('Synchronization'));
     $this->getColumn('type')->setData('options', $options);
     $this->getColumn('title')->setData('header', Mage::helper('M2ePro')->__('Title / Description Policy Category'));
     $this->getColumn('title')->setData('frame_callback', array($this, 'callbackColumnTitle'));
     $this->getColumn('title')->setData('filter_condition_callback', array($this, 'callbackFilterTitle'));
     return $this;
 }