protected function _prepareCollection() { $collection = Mage::getResourceModel('xtento_orderexport/history_collection'); if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_QUOTE) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('sales/' . $this->_getProfile()->getEntity())), 'main_table.entity_id = object.entity_id', array('object.entity_id')); } else { if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_AWRMA) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('awrma/entity')), 'main_table.entity_id = object.id', array('object.id')); } else { if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_BOOSTRMA) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('ProductReturn/rma')), 'main_table.entity_id = object.rma_id', array('object.rma_id')); } else { if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('customer/entity')), 'main_table.entity_id = object.entity_id', array('object.entity_id')); } else { if (Mage::helper('xtcore/utils')->mageVersionCompare(Mage::getVersion(), '1.4.0.1', '>')) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('sales/' . $this->_getProfile()->getEntity())), 'main_table.entity_id = object.entity_id', array('object.increment_id')); } } } } } $collection->addFieldToFilter('main_table.profile_id', $this->_getProfile()->getId()); $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { $collection = Mage::getResourceModel('xtento_orderexport/history_collection'); if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_QUOTE) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('sales/' . $this->_getProfile()->getEntity())), 'main_table.entity_id = object.entity_id', array('object.entity_id')); } else { if ($this->_getProfile()->getEntity() == Xtento_OrderExport_Model_Export::ENTITY_CUSTOMER) { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('customer/entity')), 'main_table.entity_id = object.entity_id', array('object.entity_id')); } else { $collection->getSelect()->joinLeft(array('object' => $collection->getTable('sales/' . $this->_getProfile()->getEntity())), 'main_table.entity_id = object.entity_id', array('object.increment_id')); } } $collection->addFieldToFilter('main_table.profile_id', $this->_getProfile()->getId()); $this->setCollection($collection); return parent::_prepareCollection(); }