Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a:5:{i:0;s:62:"You cannot define a correlation name 'shipping' more than once";i:1;s:2687:"#0 /var/www/vhosts/MYSITE/httpdocs/lib/Varien/Db/Select.php(281): Zend_Db_Select->_join('left join', Array, 'main_table.enti...', Array, NULL)
- #1 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Zend/Db/Select.php(373): Varien_Db_Select->_join('left join', Array, 'main_table.enti...', Array, NULL)
- #2 /var/www/vhosts/MYSITE/httpdocs/app/code/local/Atwix/ExtendedGrid/Model/Observer.php(34): Zend_Db_Select->joinLeft(Array, 'main_table.enti...', Array)
- #3 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Model/App.php(1357): Atwix_ExtendedGrid_Model_Observer->salesOrderGridCollectionLoadBefore(Object(Varien_Event_Observer))
- #4 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Atwix_ExtendedGrid_Model_Observer), 'salesOrderGridC...', Object(Varien_Event_Observer))
- #5 /var/www/vhosts/MYSITE/httpdocs/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('sales_order_gri...', Array)
- #6 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(590): Mage::dispatchEvent('sales_order_gri...', Array)
- #7 /var/www/vhosts/MYSITE/httpdocs/lib/Varien/Data/Collection/Db.php(565): Mage_Core_Model_Resource_Db_Collection_Abstract->_beforeLoad()
- #8 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(951): Varien_Data_Collection_Db->load()
- #9 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(1008): Mage_Adminhtml_Block_Widget_Grid->_exportIterateCollection('_exportCsvItem', Array)
- #10 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php(703): Mage_Adminhtml_Block_Widget_Grid->getCsvFile()
- #11 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Sales_OrderController->exportCsvAction()
- #12 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('exportCsv')
- #13 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
- #14 /var/www/vhosts/MYSITE/httpdocs/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
- #15 /var/www/vhosts/MYSITE/httpdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
- #16 /var/www/vhosts/MYSITE/httpdocs/index.php(87): Mage::run('', 'store')
- #17 {main}";s:3:"url";s:103:"/index.php/spadmin/sales_order/exportCsv/key/54346fe7eb59bee82fd6e0a6aa777ff2/internal_order_ids/21318/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
- <?xml version="1.0"?>
- <config>
- <modules>
- <Atwix_ExtendedGrid>
- <version>1.0.1</version>
- </Atwix_ExtendedGrid>
- </modules>
- <global>
- <blocks>
- <atwix_extendedgrid>
- <class>Atwix_ExtendedGrid_Block</class>
- </atwix_extendedgrid>
- </blocks>
- <helpers>
- <atwix_extendedgrid>
- <class>Atwix_ExtendedGrid_Helper</class>
- </atwix_extendedgrid>
- </helpers>
- <models>
- <atwix_extendedgrid>
- <class>Atwix_ExtendedGrid_Model</class>
- </atwix_extendedgrid>
- <sales_resource>
- <rewrite>
- <order_grid_collection>Atwix_ExtendedGrid_Model_Resource_Sales_Order_Grid_Collection</order_grid_collection>
- </rewrite>
- </sales_resource>
- </models>
- </global>
- <adminhtml>
- <events>
- <sales_order_grid_collection_load_before>
- <observers>
- <atwix_exgrid>
- <model>atwix_extendedgrid/observer</model>
- <method>salesOrderGridCollectionLoadBefore</method>
- </atwix_exgrid>
- </observers>
- </sales_order_grid_collection_load_before>
- </events>
- <layout>
- <updates>
- <atwix_extendedgrid>
- <file>atwix/extendedgrid.xml</file>
- </atwix_extendedgrid>
- </updates>
- </layout>
- </adminhtml>
- </config>
- <?php
- class Atwix_ExtendedGrid_Model_Observer
- {
- /**
- * Joins extra tables for adding custom columns to Mage_Adminhtml_Block_Sales_Order_Grid
- * @param Varien_Object $observer
- * @return Atwix_Exgrid_Model_Observer
- */
- public function salesOrderGridCollectionLoadBefore($observer)
- {
- $collection = $observer->getOrderGridCollection();
- $select = $collection->getSelect();
- $collection->getSelect()->joinLeft(array('shipping'=>'sales_flat_order_address'),
- 'main_table.entity_id = shipping.parent_id AND shipping.address_type="shipping"',array('shipping.country_id AS bp'));
- $select->group('main_table.entity_id');
- }
- /**
- * callback function used to filter collection
- * @param $collection
- * @param $column
- * @return $this
- */
- }
- <?php
- class Atwix_ExtendedGrid_Model_Resource_Sales_Order_Grid_Collection extends Mage_Sales_Model_Resource_Order_Grid_Collection
- {
- /**
- * Get SQL for get record count
- *
- * @return Varien_Db_Select
- */
- public function getSelectCountSql()
- {
- $countSelect = parent::getSelectCountSql();
- if (Mage::app()->getRequest()->getControllerName() == 'sales_order') {
- $countSelect->reset(Zend_Db_Select::GROUP);
- $countSelect->reset(Zend_Db_Select::COLUMNS);
- $countSelect->columns("COUNT(DISTINCT main_table.entity_id)");
- $havingCondition = $countSelect->getPart(Zend_Db_Select::HAVING);
- if (count($havingCondition)) {
- $countSelect->where(
- str_replace("group_concat(`sales_flat_order_item`.sku SEPARATOR ', ')", 'sales_flat_order_item.sku', $havingCondition[0])
- );
- $countSelect->reset(Zend_Db_Select::HAVING);
- }
- }
- return $countSelect;
- }
- /**
- * Init select
- * @return Mage_Core_Model_Resource_Db_Collection_Abstract
- */
- protected function _initSelect()
- {
- $this->addFilterToMap('store_id', 'main_table.store_id')
- ->addFilterToMap('created_at', 'main_table.created_at')
- ->addFilterToMap('updated_at', 'main_table.updated_at');
- return parent::_initSelect();
- }
- }
- <?php
- class Atwix_ExtendedGrid_Helper_Data extends Mage_Core_Helper_Abstract
- {
- /**
- * parameters for addColumnAfter method
- * @return array
- */
- public function getSkusColumnParams()
- {
- return array(
- 'header' => Mage::helper('sales')->__('Shipping Country'),
- 'index' => 'bp',
- 'width' => '60px',
- 'filter_index' => 'shipping.country_id'
- );
- }
- }
- #1 /var/www/html/lib/Zend/Db/Select.php(357): Varien_Db_Select->_join('left join', Array, 'payment.parent_...', Array, NULL)
- #2 /var/www/html/app/code/local/Atwix/ExtendedGrid/Model/Observer.php(33): Zend_Db_Select->joinLeft(Array, 'payment.parent_...', Array)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement