我有一个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()
中的app/code/core/Mage/Checkout/controllers/CartController.php
确实可以保存送货方式。
那么现在如何从我的shipping.phtml文件中获取它?
答案 0 :(得分:0)
从最后一个订单获取送货方式
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$shipping_method = $order->getData("shipping_method");