0

我有一个app/design/frontend/hopnew/default/template/checkout/cart/shipping.phtml文件。在其中,我要做的就是获取上次表单提交中设置的运输方式。我已经尝试了所有这些陈述,但它们都没有回应:

<?php
echo $this->getAddressShippingMethod();
echo "111<br />";
echo $this->getAddress()->getShippingMethod();
echo "222<br />";
echo $this->getQuote()->getShippingAddress()->getShippingMethod();
echo "333<br />";                                                                                                                                                                            
echo $this->getCheckout()->getQuote();
echo "444<br />";          
echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
echo "555<br />";

echo $this->getQuote();
echo "666<br />";

echo $this->getCheckout();
echo "777<br />";          
echo $this->getAddress();
echo "888<br />"; 
echo Mage::getSingleton('checkout/session')->getQuote();
echo "999<br />";
echo Mage::getSingleton('checkout/session')->getCheckout();
echo "10<br />";
echo Mage::getSingleton('checkout/session')->getAddress();
echo "11<br />";    
//          echo $this->_getQuote()->getShippingAddress()->getShippingMethod();
echo "12<br />";

我已经确认estimateUpdatePostAction()inapp/code/core/Mage/Checkout/controllers/CartController.php确实保存了运输方式。

那么现在如何从 shipping.phtml 文件中获取它?

4

1 回答 1

0

从最后一个订单中获取运输方式

$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();        
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$shipping_method = $order->getData("shipping_method");
于 2013-09-17T09:01:34.520 回答