【问题标题】:Get billing information in order review section of one page checkout in Magento在 Magento 的一页结帐的订单审查部分中获取帐单信息
【发布时间】:2012-07-07 13:27:21
【问题描述】:

我正在尝试在 Magento 1.7.0 的一页结帐的“订单审核”部分中显示帐单和运输信息。

但是,它根本不想合作。我尝试了各种论坛和 SO 中提到的几种方法。但这些方法似乎都不起作用。

这是我已经尝试过的。

http://www.magentocommerce.com/boards/viewthread/55281/

http://www.magentocommerce.com/boards/viewthread/55281/

任何帮助将不胜感激! 提前致谢。

【问题讨论】:

    标签: php magento checkout


    【解决方案1】:
    Mage::getSingleton('checkout/session')->getQuote()
                                          ->getShippingAddress()
                                          ->getData();
    
    
    Mage::getSingleton('checkout/session')->getQuote()
                                          ->getBillingAddress()
                                          ->getData();
    

    将为您提供包含当前订单的账单和运输信息的数组。根据上下文,您可能还需要调用

    Mage::getSingleton('checkout/session')->getQuote()
                                          ->collectTotals();
    

    为了使订单税、小计等正确。

    【讨论】:

    • 我有机会尝试一下,它奏效了。非常感谢!
    【解决方案2】:

    您可以将地址作为对象获取:

    $checkout = Mage::getSingleton('checkout/session')->getQuote();
    $billing = $checkout->getBillingAddress();
    $shipping = $checkout->getShippingAddress();
    

    并将它们显示为 html 文本:

    echo $billing->format("html");
    echo $shipping->format("html");
    

    【讨论】:

      【解决方案3】:

      您可以通过此代码获取账单信息:

      Mage::getSingleton('checkout/session')->getQuote()
                                        ->getBillingAddress()
                                        ->getData();
      

      【讨论】:

        猜你喜欢
        • 2014-01-03
        • 2019-01-21
        • 2014-01-16
        • 2012-12-30
        • 2013-03-09
        • 1970-01-01
        • 2023-03-21
        • 2015-03-08
        • 1970-01-01
        相关资源
        最近更新 更多