如何获得所有开放magento订单的送货地址?(How can i get shipping address for all open magento orders?)

系统教程 行业动态 更新时间:2024-06-14 16:57:17
如何获得所有开放magento订单的送货地址?(How can i get shipping address for all open magento orders?)

我正在使用古老的Magento 1.3.2.4并尝试获取所有处理状态的订单的送货地址,我使用下面的代码,但它没有给我任何运输ID或任何地址数据。

<?php require_once("app/Mage.php"); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $app = Mage::app(); //Getting Processing Order IDs $orderIDs = array(); $salesCollection = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter('state', array('eq' => Mage_Sales_Model_Order::STATE_PROCESSING)); foreach($salesCollection as $order) { print_r($order); }

我也试过了

$order = Mage::getModel("sales/order")->load($id);

但没有运气

输出:

Mage_Sales_Model_Order Object ( [_eventPrefix:protected] => sales_order [_eventObject:protected] => order [_addresses:protected] => [_items:protected] => [_payments:protected] => [_statusHistory:protected] => [_invoices:protected] => [_tracks:protected] => [_shipments:protected] => [_creditmemos:protected] => [_relatedObjects:protected] => Array ( ) [_orderCurrency:protected] => [_baseCurrency:protected] => [_actionFlag:protected] => Array ( ) [_resourceName:protected] => sales/order [_resource:protected] => [_resourceCollectionName:protected] => sales/order_collection [_cacheTag:protected] => [_dataSaveAllowed:protected] => 1 [_data:protected] => Array ( [entity_id] => 9693 [entity_type_id] => 11 [attribute_set_id] => 0 [increment_id] => 200015066 [parent_id] => 0 [store_id] => 2 [created_at] => 2015-09-03 18:24:37 [updated_at] => 2015-09-03 18:24:37 [is_active] => 1 [customer_id] => [tax_amount] => 1.1600 [shipping_amount] => 0.0000 [discount_amount] => 0.0000 [subtotal] => 5.8300 [grand_total] => 6.9900 [total_paid] => 6.9900 [total_refunded] => 0.0000 [total_qty_ordered] => 0.0000 [total_canceled] => 0.0000 [total_invoiced] => 6.9900 [total_online_refunded] => 0.0000 [total_offline_refunded] => 0.0000 [base_tax_amount] => 1.1600 [base_shipping_amount] => 0.0000 [base_discount_amount] => 0.0000 [base_subtotal] => 5.8300 [base_grand_total] => 6.9900 [base_total_paid] => 6.9900 [base_total_refunded] => 0.0000 [base_total_qty_ordered] => 0.0000 [base_total_canceled] => 0.0000 [base_total_invoiced] => 6.9900 [base_total_online_refunded] => 0.0000 [base_total_offline_refunded] => 0.0000 [subtotal_refunded] => [subtotal_canceled] => [discount_refunded] => [discount_canceled] => [discount_invoiced] => 0.0000 [tax_refunded] => [tax_canceled] => [shipping_refunded] => [shipping_canceled] => [base_subtotal_refunded] => [base_subtotal_canceled] => [base_discount_refunded] => [base_discount_canceled] => [base_discount_invoiced] => 0.0000 [base_tax_refunded] => [base_tax_canceled] => [base_shipping_refunded] => [base_shipping_canceled] => [subtotal_invoiced] => 5.8300 [tax_invoiced] => 1.1600 [shipping_invoiced] => 0.0000 [base_subtotal_invoiced] => 5.8300 [base_tax_invoiced] => 1.1600 [base_shipping_invoiced] => 0.0000 [shipping_tax_amount] => 0.0000 [base_shipping_tax_amount] => 0.0000 [shipping_tax_refunded] => [base_shipping_tax_refunded] => [status] => processing ) [_origData:protected] => Array ( [entity_id] => 9693 [entity_type_id] => 11 [attribute_set_id] => 0 [increment_id] => 200015066 [parent_id] => 0 [store_id] => 2 [created_at] => 2015-09-03 18:24:37 [updated_at] => 2015-09-03 18:24:37 [is_active] => 1 [customer_id] => [tax_amount] => 1.1600 [shipping_amount] => 0.0000 [discount_amount] => 0.0000 [subtotal] => 5.8300 [grand_total] => 6.9900 [total_paid] => 6.9900 [total_refunded] => 0.0000 [total_qty_ordered] => 0.0000 [total_canceled] => 0.0000 [total_invoiced] => 6.9900 [total_online_refunded] => 0.0000 [total_offline_refunded] => 0.0000 [base_tax_amount] => 1.1600 [base_shipping_amount] => 0.0000 [base_discount_amount] => 0.0000 [base_subtotal] => 5.8300 [base_grand_total] => 6.9900 [base_total_paid] => 6.9900 [base_total_refunded] => 0.0000 [base_total_qty_ordered] => 0.0000 [base_total_canceled] => 0.0000 [base_total_invoiced] => 6.9900 [base_total_online_refunded] => 0.0000 [base_total_offline_refunded] => 0.0000 [subtotal_refunded] => [subtotal_canceled] => [discount_refunded] => [discount_canceled] => [discount_invoiced] => 0.0000 [tax_refunded] => [tax_canceled] => [shipping_refunded] => [shipping_canceled] => [base_subtotal_refunded] => [base_subtotal_canceled] => [base_discount_refunded] => [base_discount_canceled] => [base_discount_invoiced] => 0.0000 [base_tax_refunded] => [base_tax_canceled] => [base_shipping_refunded] => [base_shipping_canceled] => [subtotal_invoiced] => 5.8300 [tax_invoiced] => 1.1600 [shipping_invoiced] => 0.0000 [base_subtotal_invoiced] => 5.8300 [base_tax_invoiced] => 1.1600 [base_shipping_invoiced] => 0.0000 [shipping_tax_amount] => 0.0000 [base_shipping_tax_amount] => 0.0000 [shipping_tax_refunded] => [base_shipping_tax_refunded] => [status] => processing ) [_idFieldName:protected] => entity_id [_isDeleted:protected] => )

I am using ancient Magento 1.3.2.4 and trying to get shipping address for all the orders with processing status, I am using below code but it doesn't give me any shipping id or any address data.

<?php require_once("app/Mage.php"); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $app = Mage::app(); //Getting Processing Order IDs $orderIDs = array(); $salesCollection = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter('state', array('eq' => Mage_Sales_Model_Order::STATE_PROCESSING)); foreach($salesCollection as $order) { print_r($order); }

I have also tried

$order = Mage::getModel("sales/order")->load($id);

but no luck

Output:

Mage_Sales_Model_Order Object ( [_eventPrefix:protected] => sales_order [_eventObject:protected] => order [_addresses:protected] => [_items:protected] => [_payments:protected] => [_statusHistory:protected] => [_invoices:protected] => [_tracks:protected] => [_shipments:protected] => [_creditmemos:protected] => [_relatedObjects:protected] => Array ( ) [_orderCurrency:protected] => [_baseCurrency:protected] => [_actionFlag:protected] => Array ( ) [_resourceName:protected] => sales/order [_resource:protected] => [_resourceCollectionName:protected] => sales/order_collection [_cacheTag:protected] => [_dataSaveAllowed:protected] => 1 [_data:protected] => Array ( [entity_id] => 9693 [entity_type_id] => 11 [attribute_set_id] => 0 [increment_id] => 200015066 [parent_id] => 0 [store_id] => 2 [created_at] => 2015-09-03 18:24:37 [updated_at] => 2015-09-03 18:24:37 [is_active] => 1 [customer_id] => [tax_amount] => 1.1600 [shipping_amount] => 0.0000 [discount_amount] => 0.0000 [subtotal] => 5.8300 [grand_total] => 6.9900 [total_paid] => 6.9900 [total_refunded] => 0.0000 [total_qty_ordered] => 0.0000 [total_canceled] => 0.0000 [total_invoiced] => 6.9900 [total_online_refunded] => 0.0000 [total_offline_refunded] => 0.0000 [base_tax_amount] => 1.1600 [base_shipping_amount] => 0.0000 [base_discount_amount] => 0.0000 [base_subtotal] => 5.8300 [base_grand_total] => 6.9900 [base_total_paid] => 6.9900 [base_total_refunded] => 0.0000 [base_total_qty_ordered] => 0.0000 [base_total_canceled] => 0.0000 [base_total_invoiced] => 6.9900 [base_total_online_refunded] => 0.0000 [base_total_offline_refunded] => 0.0000 [subtotal_refunded] => [subtotal_canceled] => [discount_refunded] => [discount_canceled] => [discount_invoiced] => 0.0000 [tax_refunded] => [tax_canceled] => [shipping_refunded] => [shipping_canceled] => [base_subtotal_refunded] => [base_subtotal_canceled] => [base_discount_refunded] => [base_discount_canceled] => [base_discount_invoiced] => 0.0000 [base_tax_refunded] => [base_tax_canceled] => [base_shipping_refunded] => [base_shipping_canceled] => [subtotal_invoiced] => 5.8300 [tax_invoiced] => 1.1600 [shipping_invoiced] => 0.0000 [base_subtotal_invoiced] => 5.8300 [base_tax_invoiced] => 1.1600 [base_shipping_invoiced] => 0.0000 [shipping_tax_amount] => 0.0000 [base_shipping_tax_amount] => 0.0000 [shipping_tax_refunded] => [base_shipping_tax_refunded] => [status] => processing ) [_origData:protected] => Array ( [entity_id] => 9693 [entity_type_id] => 11 [attribute_set_id] => 0 [increment_id] => 200015066 [parent_id] => 0 [store_id] => 2 [created_at] => 2015-09-03 18:24:37 [updated_at] => 2015-09-03 18:24:37 [is_active] => 1 [customer_id] => [tax_amount] => 1.1600 [shipping_amount] => 0.0000 [discount_amount] => 0.0000 [subtotal] => 5.8300 [grand_total] => 6.9900 [total_paid] => 6.9900 [total_refunded] => 0.0000 [total_qty_ordered] => 0.0000 [total_canceled] => 0.0000 [total_invoiced] => 6.9900 [total_online_refunded] => 0.0000 [total_offline_refunded] => 0.0000 [base_tax_amount] => 1.1600 [base_shipping_amount] => 0.0000 [base_discount_amount] => 0.0000 [base_subtotal] => 5.8300 [base_grand_total] => 6.9900 [base_total_paid] => 6.9900 [base_total_refunded] => 0.0000 [base_total_qty_ordered] => 0.0000 [base_total_canceled] => 0.0000 [base_total_invoiced] => 6.9900 [base_total_online_refunded] => 0.0000 [base_total_offline_refunded] => 0.0000 [subtotal_refunded] => [subtotal_canceled] => [discount_refunded] => [discount_canceled] => [discount_invoiced] => 0.0000 [tax_refunded] => [tax_canceled] => [shipping_refunded] => [shipping_canceled] => [base_subtotal_refunded] => [base_subtotal_canceled] => [base_discount_refunded] => [base_discount_canceled] => [base_discount_invoiced] => 0.0000 [base_tax_refunded] => [base_tax_canceled] => [base_shipping_refunded] => [base_shipping_canceled] => [subtotal_invoiced] => 5.8300 [tax_invoiced] => 1.1600 [shipping_invoiced] => 0.0000 [base_subtotal_invoiced] => 5.8300 [base_tax_invoiced] => 1.1600 [base_shipping_invoiced] => 0.0000 [shipping_tax_amount] => 0.0000 [base_shipping_tax_amount] => 0.0000 [shipping_tax_refunded] => [base_shipping_tax_refunded] => [status] => processing ) [_idFieldName:protected] => entity_id [_isDeleted:protected] => )

最满意答案

require_once("app/Mage.php"); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $app = Mage::app(); //Getting Processing Order IDs $orderIDs = array(); $salesCollection = Mage::getModel("sales/order")->getCollection() ->addAttributeToFilter('status', Mage_Sales_Model_Order::STATE_PROCESSING); foreach($salesCollection as $order) { print_r($order); }

Nothing worked so I dared to look into magento's DB tables and the SQL below works

SELECT a.address_type, a.firstname, a.middlename, a.lastname, a.suffix, a.street, a.city, a.region, a.postcode, a.country_id FROM sales_flat_quote_address AS a, sales_order_varchar AS v, sales_order_int AS o WHERE v.attribute_id = 97 AND v.value = 'processing' AND o.entity_id = v.entity_id AND o.attribute_id = 109 AND o.value = a.quote_id

更多推荐

本文发布于:2023-04-12 20:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/3ce88fa7e089ff5ca78cc05beee580f0.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何获得   订单   地址   magento   orders

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!