Magento的pending訂單在使用者賬戶中不顯示的解決辦法
magento1.4以前的版本,在使用者的My Dashboard不現裡顯示,但是這個不能滿足客戶的需求,所以要解決這個問題。
首先我通過ftp進入網站,通過檢視相關模板我找到了訂單處理的類,在檔案/app/code/core/Mage/Sales/Block/Recent.php裡,在檔案裡有一段程式碼
parent::__construct();
//TODO: add full name logic
$orders = Mage::getResourceModel('sales/order_collection')
->addAttributeToSelect('*')
->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
->addAttributeToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
->addAttributeToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
->addAttributeToSort('created_at', 'desc')
->setPageSize('5')
->load()
;
$this->setOrders($orders);
}
我註釋掉了一條語句“->addAttributeToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()));
,檢測在前臺顯示出了pending狀態的訂單