微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 如何获取运送/开票Magento核心API之外的订单的地址ID?

我想从Magento的刚刚完成的订单中获取运费/帐单地址.

我已经尝试了以下代码,但它没有工作:

Mage::getModel(‘sales/order’)->load($array_data[“order_id”])->getShippingAddressId()

有人有什么想法吗?

以下可能有助于寻找类似解决方案的人:
// Get the id of the last order for the current user(session)
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();        

// If an order actually exists
if ($orderId) {

    //Get the order details based on the order id ($orderId)
    $order = Mage::getModel('sales/order')->load($orderId);

    // Get the id of the orders shipping address
    $shippingId = $order->getShippingAddress()->getId();

    // Get shipping address data using the id
    $address = Mage::getModel('sales/order_address')->load($shippingId);

    // display the shipping address data array on screen
    var_dump($address);

}

注意:显然,此解决方案要求用户拥有当前会话

祝你好运.

原文地址:https://www.jb51.cc/php/131159.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐