2016-02-24 90 views
0

我試圖在確認頁面中以多筆訂單獲取所有「訂單」。Magento multishipping:獲取所有訂單或訂單ID

在標準模式下使用:

$orderId = $this->getOrderId(); 

$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); 

但是當我使用在multishipping模式,我總是得到一箇舊秩序。

回答

1

如果你有multishipping order你仍然會有一個報價,但很少有訂單鏈接到這個報價。 1.獲取最後報價ID:

$lastQuoteId = Mage::getSingleton('checkout/session')->getLastQuoteId(); 

2.這句話拿到訂單:

$orderCollection = Mage::getModel('sales/order')->getCollection(); 
$orderCollection->addFieldToFilter('quote_id', array('eq' => $lastQuoteId)); 
$orders = $orderCollection->getItems(); 

或訂單ID:

$orderCollection = Mage::getModel('sales/order')->getCollection() 
$orderCollection->getSelect() 
    ->reset(Zend_Db_Select::COLUMNS) 
    ->columns('entity_id'); 
+0

謝謝,但我得到這個錯誤https://開頭gist.github.com/iesta/a9937bc2789d33626b92 – Sucrenoir

+0

是的,我得到它的工作Thx – Sucrenoir

相關問題