I'm using Magento CE 1.7. I want to add the customer telephone number to the Abandoned Cart grid (Reports->Shopping Carts->Abandoned Carts). I have overridden the block Mage_Adminhtml_Block_Report_Shopcart_Abandoned_Grid. My _prepareCollection() function is as below. But it loads the wrong telephone number. Can anyone suggest what tables should i join here or the issue with this code ? Any help will be appreciated.
protected function _prepareCollection() { $collection = Mage::getResourceModel('reports/quote_collection'); $filter = $this->getParam($this->getVarNameFilter(), array()); if ($filter) { $filter = base64_decode($filter); parse_str(urldecode($filter), $data); } if (!empty($data)) { $collection->prepareForAbandonedReport($this->_storeIds, $data); } else { $collection->prepareForAbandonedReport($this->_storeIds); } //----------------------------------------------------------------------- // Get customer telephone. $collection->getSelect() ->joinLeft( array('table_billing'=>'customer_entity_int'), ('table_billing.entity_id=main_table.customer_id AND table_billing.attribute_id=13'), // 'default_billing' attribute id = 13 array('table_billing_value'=>'value') ) ->joinLeft( array('table_billing_telephone'=>'customer_address_entity_varchar'), ('table_billing_telephone.entity_id=main_table.customer_id AND table_billing_telephone.attribute_id=31'), // 'telephone' attribute id = 31 array('telephone'=>'value') ); //----------------------------------------------------------------------- $this->setCollection($collection); return Mage_Adminhtml_Block_Report_Grid_Shopcart::_prepareCollection(); }