How do I get the tracking number associated with each order? I have created a script to output the data. I have tried many forms, yet they all return empty / blank.
Currently, it outputs
103236290 United States Postal Service - First-class mail parcel March 23, 2013 10:12:59 PM < / Pre> Note that the output tab is delimited, so there are two tabs between the order ID and the shipment method.
& lt; ? Php // External Script - Required_Answer of Load Magneto Framework ($ _ server ['DOCUMENT_ROOT']. "/store/app/Mage.php"); Dana :: Application ('default'); $ MyOrder = Dana :: getModel ('Sales / Order'); $ Ship = Dana :: MillModel ('Sales / Order_power'); $ Order = Dana :: getModel ('sale / mysql4_order_collection'); $ Trackings = Dana :: getResourceModel ('Sales / order_shipment_track_collection') - & gt; AddAttributeToSelect ('*') - & gt; AddAttributeToFilter ('PARENT_ID', $ ship & gt; getId ()); $ Tracking- & gt; Receive () - & gt; Order ('Entity_Id Dis') - & gt; Border (1); $ Trackdata = $ tracking-> getdata (); $ TrackID = $ trackdata [0] ['unit_id']; = "$ 2013-03-24 00:00:00" from $; // date from date $ "2013-06-20 00:00:00"; // Date of order / optional filters you want to use - More available in Variation_Data_Collection_Db in Method _getConditionSql $ ORDERS- & gt; AddFieldToFilter ('total_paid', array ('gt' = & gt; 0)); // amount plus amount greater than $ 0-> AddFieldToFilter ('position', array ('eq' = & gt; "full")); // status: "complete", "processing", "cancel" etc. $ Order- & gt; AddAttributeToFilter ('created_at', array ('from' '$', 'to', and ';' from $ =,)); $ AllIds = $ orders- & gt; GetAllIds (); Forex Currency ($ allIds to $ thisId) {$ myOrder- & gt; Reset () - & gt; Load ($ thisId); Echo "& lt; east & gt;"; // print_r ($ myOrder); To print // field counter $ myOrder- & gt; GetRealOrderId () ""; Resonate $ TrackID ""; Echo $ myOrder- & gt; GetShippingDescription () ""; Echo $ myOrder- & gt; GetCreatedAtDate () ""; Echo "\ r \ n"; Echo "& lt; / pre & gt;"; }? & Gt;
Here's the work script we thought: -)
& lt ;? Php // External Script - Load Magnestrain Framework Required_ense ($ _ server ['DOCUMENT_ROOT']. "/store/app/Mage.php"); Dana :: Application ('default'); $ MyOrder = Dana :: getModel ('Sales / Order'); $ Ship = Dana :: MillModel ('Sales / Order_power'); $ Order = Dana :: getModel ('sale / mysql4_order_collection'); $ Trackings = Dana :: getResourceModel ('Sales / order_shipment_track_collection') - & gt; AddAttributeToSelect ('*') - & gt; AddAttributeToFilter ('PARENT_ID', $ ship & gt; getId ()); $ Tracking- & gt; Receive () - & gt; Order ('Entity_Id Dis') - & gt; Border (1); $ Carrier Instance = Dana :: Millennintlton ('shipping / config') - & gt; Millail Ceariers (); $ Carrier ['custom'] = Dana :: helper ('sale') - & gt; __ ('custom value'); Foreign Currency ($ carrier institute as $ code = & gt; $ carrier) {if ($ carrier-> hatchacking is available) {$ carrier $ code] = $ carrier- & gt; Milestone data ('title'); }} $ = "2013-03-24 00:00:00"; // Order from $ date = "2013-06-21 00:00:00"; // Date of order / optional filters you want to use - More available in Variation_Data_Collection_Db in Method _getConditionSql $ ORDERS- & gt; AddFieldToFilter ('total_paid', array ('gt' = & gt; 0)); // amount plus amount greater than $ 0-> AddFieldToFilter ('position', array ('eq' = & gt; "full")); // status: "complete", "processing", "cancel" etc. $ Order- & gt; AddAttributeToFilter ('created_at', array ('from' '$', 'to', and ';' from $ =,)); $ AllIds = $ orders- & gt; GetAllIds (); Forex Currency ($ allIds to $ thisId) {$ myOrder- & gt; Reset () - & gt; Load ($ thisId); Echo "& lt; east & gt;"; // print_r ($ myOrder); // Some random fields $ myOrder- & gt; GetRealOrderId () ""; $ Trackings = Dana :: getResourceModel ('sales / order_smment_track_kalan') - & gt; Set Order Filters ($ myOrder) - & gt; GetData (); Forex Currency ($ tracking $ as tracking) {echo $ tracking ['track_number'] ""; } Echo $ carrier [$ tracking ['carrier_code']] ""; Echo $ myOrder- & gt; GetCreatedAtDate () ""; // resonance "'" $ MyOrder- & gt; GetStatus () "','; // resonance "'" $ MyOrder- & gt; GetBillingAddress () - & gt; Named name () "','; // resonance "'" $ MyOrder- & gt; GetTotal_paid () "',"; // resonance "'" $ MyOrder- & gt; GetShippingAddress () - & gt; GetTelephone () "',"; // resonance "'" $ MyOrder- & gt; GetPayment () - & gt; GetCc_type () "',"; // bad code echo "\ r \ n"; Echo "& lt; / pre & gt;"; }? & Gt;
No comments:
Post a Comment