예제 #1
0
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel($this->_getCollectionClass());
     $collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id and sales_flat_order_address.address_type = "shipping"', array('postcode'));
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
예제 #2
0
 /**
  * Adding item data using second query because:
  *
  * - Join causes use of temporary table == slow
  * - Wrapping the main query as a subquery is too complex
  * - We want to show all order items for orders that matched filter by sku/name
  *
  * @return $this
  */
 protected function _prepareCollection()
 {
     parent::_prepareCollection();
     if (Mage::getStoreConfig(self::XML_PATH_RENDER_COLUMN) && !$this->_isExport) {
         $orderIds = array();
         $orderCollection = $this->getCollection();
         /** @var $orderCollection Mage_Sales_Model_Mysql4_Order_Grid_Collection */
         foreach ($orderCollection as $order) {
             $orderIds[] = $order->getEntityId();
         }
         $conn = Mage::getSingleton('core/resource')->getConnection('read');
         /* @var $conn Zend_Db_Adapter_Pdo_Abstract */
         // Increase max length of group concat fields for long product names
         $conn->exec('SET SESSION group_concat_max_len = 4096;');
         $itemsCollection = new Varien_Data_Collection_Db($conn);
         $itemsCollection->getSelect()->from(array('soi' => $orderCollection->getTable('sales/order_item')), array('order_id', 'skus' => new Zend_Db_Expr('group_concat(`soi`.sku SEPARATOR " ^ ")'), 'qtys' => new Zend_Db_Expr('group_concat(`soi`.qty_ordered SEPARATOR " ^ ")'), 'names' => new Zend_Db_Expr('group_concat(`soi`.name SEPARATOR " ^ ")')))->where('order_id IN (?)', $orderIds)->group('order_id');
         foreach ($itemsCollection as $object) {
             $order = $orderCollection->getItemById($object->getOrderId());
             $order->setSkus($object->getSkus());
             $order->setQtys($object->getQtys());
             $order->setNames($object->getNames());
         }
     }
     Mage::app()->dispatchEvent('cm_orderproducts_sales_order_grid_prepareCollection', ['block' => $this]);
     return $this;
 }
예제 #3
0
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel($this->_getCollectionClass());
     $collection->getSelect()->joinLeft('allpago_clearsale_orders', 'allpago_clearsale_orders.order_id=main_table.entity_id', array('status_clearsale'));
     $collection->getSelect()->group('entity_id');
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
예제 #4
0
 protected function _prepareCollection()
 {
     // TODO: add full name logic
     // TODO: encapsulate this logic into collection
     $collection = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect('*')->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')->addExpressionAttributeToSelect('billing_name', 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', array('billing_firstname', 'billing_lastname'))->addExpressionAttributeToSelect('shipping_name', 'CONCAT({{shipping_firstname}},  IFNULL(CONCAT(\' \', {{shipping_lastname}}), \'\'))', array('shipping_firstname', 'shipping_lastname'));
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
예제 #5
0
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel($this->_getCollectionClass());
     //we changed mysql query, we added inner join to order item table
     $collection->join('sales/order_item', 'order_id=entity_id', array('name' => 'name', 'sku' => 'sku', 'qty_ordered' => 'qty_ordered'), null, 'left');
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
예제 #6
0
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel($this->_getCollectionClass());
     $collection->getSelect()->joinLeft(array('sfoi' => 'sales_flat_order_item'), 'main_table.entity_id=sfoi.order_id', array('sku' => 'sfoi.sku'));
     $collection->addExpressionFieldToSelect("sku", "GROUP_CONCAT(sku SEPARATOR ' , ')", $fields = "");
     $collection->getSelect()->group("entity_id");
     $collection->getSelect()->joinLeft(array('sfo' => 'sales_flat_order'), 'main_table.entity_id=sfo.entity_id', array('customer_email'));
     $this->setCollection($collection);
     $collection->addFilterToMap('created_at', 'main_table.created_at');
     return parent::_prepareCollection();
 }
예제 #7
0
 protected function _prepareCollection()
 {
     $actions = array();
     if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
         $actions[] = array('caption' => Mage::helper('sales')->__('View'), 'url' => array('base' => '*/sales_order/view'), 'field' => 'order_id');
     }
     if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
         $actions[] = array('caption' => Mage::helper('sales')->__('Delete'), 'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'), 'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '), 'field' => 'order_id');
     }
     $this->addColumn('action', array('header' => Mage::helper('sales')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => $actions, 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
     return parent::_prepareCollection();
 }
예제 #8
0
 protected function _prepareCollection()
 {
     if (!Mage::helper("iwd_ordermanager")->enableCustomGrid()) {
         return parent::_prepareCollection();
     }
     $filter = $this->prepareFilters();
     $collection = Mage::getResourceModel("sales/order_grid_collection");
     $collection = Mage::getModel('iwd_ordermanager/order_grid')->prepareCollection($filter, $collection);
     $this->setCollection($collection);
     Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
     return $this;
 }
예제 #9
0
 protected function _prepareCollection()
 {
     if (Mage::helper('wsacommon')->getNewVersion() >= 8) {
         $collectionClass = $this->_getCollectionClass();
         $collection = Mage::getResourceModel($collectionClass);
         //added this
         if (Mage::helper('wsacommon')->isModuleEnabled('Webshopapps_Ordermanager', 'order_export/export_orders/active')) {
             $collection->join('ordermanager/exported', 'entity_id=order_id', 'exported');
         }
         $this->setCollection($collection);
     }
     return parent::_prepareCollection();
 }
예제 #10
0
 protected function _prepareCollection()
 {
     if ($vendor = Mage::helper('smvendors')->getVendorLogin()) {
         $grandParent = get_parent_class(get_parent_class($this));
         $collection = Mage::getResourceModel($this->_getCollectionClass());
         $collection->join(array('smo' => 'smvendors/order'), 'main_table.entity_id = smo.order_id AND smo.vendor_id = ' . $vendor->getId(), array('vendor_increment_id' => 'smo.increment_id', 'vendor_grand_total' => 'smo.grand_total', 'vendor_status' => 'smo.status'));
         Mage::dispatchEvent('smvendors_sales_order_grid_prepare_collection', array('order_collection' => $collection));
         $this->setCollection($collection);
         return call_user_func(array($grandParent, '_prepareCollection'));
     } else {
         return parent::_prepareCollection();
     }
 }
예제 #11
0
 protected function _prepareCollection()
 {
     $collection = Mage::getResourceModel($this->_getCollectionClass());
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
 /**
  * {@inheritdoc}
  */
 protected function _prepareCollection()
 {
     $result = parent::_prepareCollection();
     Mage::dispatchEvent('adminhtml_sales_order_grid_prepare_collection', array('block' => $this));
     return $result;
 }
예제 #13
0
파일: Bluemoon.php 프로젝트: nopro/bluemoon
 protected function _prepareCollection()
 {
     parent::_prepareCollection();
     return $this;
 }