Forum

Thread tagged as: Question, Shop

Order History - Order Address Detail

Hi Drew,

I'm trying to create an order history for customers.

I'd like to essentially recreate my order confirm page so that they can view all of the historical order details.

I've been able to pull in the static cart from the order, as well as the shipping method. I've done this by pasting those respective templates into a new template called `order_details.html', then:

<?php perch_shop_order(perch_get('orderID'), ['template' => 'shop/orders/order_details.html',]); ?>

However, I'm not able to pull in the billing and shipping addresses used for the order. Are there template tags or page functions that can accomplish this?

Thank you!

Olympia Kyriakides

Olympia Kyriakides 1 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You can get the order, then get the addresses. I then just add that to a variable and output it in my template. So something like:

$order =    perch_shop_order($order_id, [
  'skip-template' => true,
]);

$formattedAddress = perch_shop_customer_address($order[0]['orderBillingAddress'], [
  'template' => 'addresses/formatted-address.html',
],true);

PerchSystem::set_var('formattedAddress', $formattedAddress);

$order =    perch_shop_order_items($order_id, [
  'template' => 'shop/orders/account-invoice.html',
]);

Thank you Rachel!!

I've been playing around with it and I've gotten the proper addresses to show up, but with an "array to string conversion" error that I can't seem to get rid of.

$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);

perch_shop_customer_address($order[0]['orderBillingAddress'], [
'template' => 'addresses/address.html',
],true);

perch_shop_customer_address($order[0]['orderShippingAddress'], [
'template' => 'addresses/address.html',
],true);

I don't have much experience passing variables into templates, so I'm not sure how I would use 'formattedAddress' in the address template. If PerchSystem::set_var()is the best way to do this, I regret that I'll need a little more coaching.

Also with your above, $order_id is not set and when I try something like this, noting is returned:

$order_id = perch_shop_successful_order_id();

$order =    perch_shop_order($order_id), ['skip-template' => true,]);

perch_shop_customer_address($order[0]['orderBillingAddress'], [
'template' => 'addresses/address.html',
],true);

perch_shop_customer_address($order[0]['orderShippingAddress'], [
'template' => 'addresses/address.html',
],true);
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you want your original perch_get('orderID') to read the order ID from the URL.

Which line is throwing the array conversion error?

Hi Drew, it's this line:

$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the value of orderID on the URL?

It's just the number, like "50."

Page arguments:
Array
(
    [0] => /account/order-details/50
    [orderID] => 50
    [1] => 50
)

and

<?php perch_get('orderID'); ?>

returns "50"

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's the only part on that line that could be returning an array, and it's not.

Can you show me the exact error message you're getting?

Yes indeed! ---

Array
(
    [type] => 8
    [message] => Array to string conversion
    [file] => /Applications/MAMP/htdocs/om-nyc/perch/templates/pages/account/order_details.php
    [line] => 81
)

It's also printing "Array" right above the templated address output

Drew McLellan

Drew McLellan 2638 points
Perch Support

And 81 is this line?

$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);

So with lots of distracting code removed I realised that I was actually echoing:

$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);

eek!

Now with the echo in there, I was getting the "Array" issue but I was also getting the proper address. When I took the echo out I got nothing.

When I did this below, I got just the proper addresses (yay)...is doing this okay??

<?php 

         $order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);

          echo '   
        ',perch_shop_customer_address($order[0]['orderBillingAddress'], [
            'template' => 'addresses/address.html',
            ],true),'
        '; 
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

That shouldn't be necessary - perch_shop_customer_address() should echo itself:

perch_shop_customer_address($order[0]['orderBillingAddress'], [
            'template' => 'addresses/address.html',
            ]);

It was the true I had in there.

perch_shop_customer_address($order[0]['orderShippingAddress'], [
'template' => 'addresses/address.html',],true);

All good. cheers Drew!

Hi Drew, I just updated to Perch Shop 1.0.6 and this address function broke...

<?php 
$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);

perch_shop_customer_address($order[0]['orderBillingAddress'], [
 'template' => 'addresses/address.html',
]);
?>

From the debug, orderID is NULL...just here, my other order details are coming through fine.

Page arguments:
Array
(
    [0] => /account/order-details/52
    [orderID] => 52
    [1] => 52
)


0.4931  0.003   [1] SELECT * FROM perch2_shop_customers WHERE memberID=69
0.5119  0.0188  [nil] SELECT main.* FROM perch2_shop_addresses main WHERE 1=1 AND (customerID=56 AND addressID=211) AND addressDeleted IS NULL AND orderID IS NULL ORDER BY addressTitle ASC
0.5124  0.0005  Using template: /templates/shop/addresses/address.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you PerchUtil::debug($order) what do you get?

Array
(
[0] => Array
(
[_gift_message] => Yes, this is a message
[_gift_invoice] => true
[_status] => paid
[orderID] => 51
[orderStatus] => paid
[orderInvoiceNumber] => Invoice50
[orderGateway] => stripe
[orderTotal] => 9261.13
[orderItemsSubtotal] => 8550.00
[orderItemsTotal] => 9234
[orderShippingSubtotal] => 25.00
[orderShippingDiscounts] => 0.00
[orderItemsTax] => 684.00
[orderTaxTotal] => 686.13
[orderShippingTotal] => 27.13
[orderDiscountsTotal] => 0.00
[orderTaxDiscountsTotal] => 0.00
[orderSubtotal] => 8575
[orderShippingTax] => 2.13
[orderShippingTaxDiscounts] => 0.00
[orderItemsRefunded] => 0
[orderTaxRefunded] => 0
[orderShippingRefunded] => 0
[orderTotalRefunded] => 0
[orderShippingWeight] => 30.00
[orderTaxID] => 
[currencyID] => 142
[orderExchangeRate] => 1.00000
[customerID] => 46
[shippingID] => 2
[orderShippingTaxRate] => 8.50
[orderShippingAddress] => 209
[orderBillingAddress] => 208
[orderGatewayRef] => ch_18eUmmDElVA6hGfYEboVZj28
[orderPricing] => standard
[orderDynamicFields] => {"gift_message":"Yes, this is a message","gift_invoice":"true","status":"paid"}
[orderCreated] => 2016-08-03 19:12:11
[orderUpdated] => 2016-08-03 15:12:14
[orderDeleted] => 
[perch__gift_message] => Yes, this is a message
[perch__gift_invoice] => true
[perch__status] => paid
[statusID] => 3
[statusKey] => paid
[statusTitle] => Paid
[statusEditable] => 0
[statusIndex] => 100
[statusDynamicFields] => []
[statusCreated] => 0000-00-00 00:00:00
[statusUpdated] => 2016-07-29 13:41:52
[statusDeleted] => 
[statusActive] => 1
[items] => Array
(
[0] => Array
(
[_variant_opts] => Black Widow (20 in stock)|52,Monarch (20 in stock)|49,Custom Calligraphy - Large (20 in stock)|50,Custom Calligraphy - Small (20 in stock)|51
[about] => Array
(
[_flang] => markdown
[raw] => The signature Highline bag embodies the streamlined, architectural beauty of city life.  
Inside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.
[processed] => 
The signature Highline bag embodies the streamlined, architectural beauty of city life.

Inside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.


)

[bagDrop] => 5
[bagHeight] => 10
[bagLength] => 13
[bagWidth] => 5
[brand] => 2
[catalog_only] => 0
[category] => Array
(
[0] => 1
[1] => 19
)

[details] => Array
(
[_flang] => markdown
[raw] => Smooth black Italian full-grain leather  
Distinctive "OM" rolled handles  
Hidden-hook removable shoulder strap  
Solid brass hardware in silver-tone finish  
Smooth 2-way palladium zipper closure at top  
5 studs at bottom  

Made in New York City
[processed] => 
Smooth black Italian full-grain leather

Distinctive “OM” rolled handles

Hidden-hook removable shoulder strap

Solid brass hardware in silver-tone finish

Smooth 2-way palladium zipper closure at top

5 studs at bottom  


Made in New York City


)

[discount] => 0.00
[has_variants] => 1
[identifier] => 104
[image] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[image_thumb] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[image_zoom] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[img1] => 
[img1_thumb] => 
[img1_zoom] => 
[img2] => 
[img2_thumb] => 
[img2_zoom] => 
[img3] => 
[img3_thumb] => 
[img3_zoom] => 
[img4] => 
[img4_thumb] => 
[img4_zoom] => 
[img5] => 
[img5_thumb] => 
[img5_zoom] => 
[itemDiscount] => 0.00
[itemDynamicFields] => 
[itemID] => 104
[itemPrice] => 2850.00
[itemQty] => 3
[itemTax] => 228.00
[itemTaxDiscount] => 0.00
[itemTaxRate] => 8.00
[itemTotal] => 3078.00
[itemType] => product
[lining] => Array
(
[_flang] => markdown
[raw] => Fully lined in mother-of-pearl metallic lambskin  
Integrated wallet  
Bill pocket  
8 card slots  
Pen slot  
Mobile phone pocket  
Fully lined snap-in/out zip-top pouch in matching lambskin
[processed] => 
Fully lined in mother-of-pearl metallic lambskin

Integrated wallet

Bill pocket

8 card slots

Pen slot

Mobile phone pocket

Fully lined snap-in/out zip-top pouch in matching lambskin


)

[on_sale] => 
[options] => Array
(
[0] => Array
(
[title] => Embossing
[precendence] => 1
[optionID] => 4
[optionTitle] => Embossing
[optionPrecendence] => 1
[optionDynamicFields] => {"title":"Embossing","precendence":"1"}
[optionCreated] => 2016-03-30 15:37:17
[optionUpdated] => 2016-03-30 12:25:56
[optionDeleted] => 
[perch_title] => Embossing
[perch_precendence] => 1
[options] => Array
(
[0] => Array
(
[id] => 11
[title] => Black Widow
[skucode] => BLW
)

[1] => Array
(
[id] => 14
[title] => Monarch
[skucode] => MON
)

[2] => Array
(
[id] => 15
[title] => Custom Calligraphy - Large
[skucode] => CCL
)

[3] => Array
(
[id] => 16
[title] => Custom Calligraphy - Small
[skucode] => CCS
)

)

[productvalues] => Array
(
[0] => Array
(
[prodoptID] => 48
[optionID] => 4
[valueID] => 11
[optionTitle] => Embossing
[valueTitle] => Black Widow
[valueSKUCode] => BLW
[valueOrder] => 1
[valueDynamicFields] => {}
[valueCreated] => 2016-03-30 15:37:17
[valueUpdated] => 2016-03-30 12:25:56
[valueDeleted] => 
)

[1] => Array
(
[prodoptID] => 49
[optionID] => 4
[valueID] => 14
[optionTitle] => Embossing
[valueTitle] => Monarch
[valueSKUCode] => MON
[valueOrder] => 2
[valueDynamicFields] => {}
[valueCreated] => 2016-03-30 16:21:38
[valueUpdated] => 2016-03-30 12:25:56
[valueDeleted] => 
)

[2] => Array
(
[prodoptID] => 50
[optionID] => 4
[valueID] => 15
[optionTitle] => Embossing
[valueTitle] => Custom Calligraphy - Large
[valueSKUCode] => CCL
[valueOrder] => 3
[valueDynamicFields] => {}
[valueCreated] => 2016-03-30 16:21:38
[valueUpdated] => 2016-03-30 12:25:56
[valueDeleted] => 
)

[3] => Array
(
[prodoptID] => 51
[optionID] => 4
[valueID] => 16
[optionTitle] => Embossing
[valueTitle] => Custom Calligraphy - Small
[valueSKUCode] => CCS
[valueOrder] => 4
[valueDynamicFields] => {}
[valueCreated] => 2016-03-30 16:21:38
[valueUpdated] => 2016-03-30 12:25:56
[valueDeleted] => 
)

)

)

)

[orderID] => 51
[parentID] => 
[perch_about] => Array
(
[_flang] => markdown
[raw] => The signature Highline bag embodies the streamlined, architectural beauty of city life.  
Inside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.
[processed] => 
The signature Highline bag embodies the streamlined, architectural beauty of city life.

Inside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.


)

[perch_bagDrop] => 5
[perch_bagHeight] => 10
[perch_bagLength] => 13
[perch_bagWidth] => 5
[perch_brand] => 2
[perch_catalog_only] => 0
[perch_category] => Array
(
[0] => 1
[1] => 19
)

[perch_details] => Array
(
[_flang] => markdown
[raw] => Smooth black Italian full-grain leather  
Distinctive "OM" rolled handles  
Hidden-hook removable shoulder strap  
Solid brass hardware in silver-tone finish  
Smooth 2-way palladium zipper closure at top  
5 studs at bottom  

Made in New York City
[processed] => 
Smooth black Italian full-grain leather

Distinctive “OM” rolled handles

Hidden-hook removable shoulder strap

Solid brass hardware in silver-tone finish

Smooth 2-way palladium zipper closure at top

5 studs at bottom  


Made in New York City


)

[perch_image] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[perch_image_thumb] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[perch_image_zoom] => Array
(
[assetID] => 43
[title] => Satchel Sample 001
[_default] => /perch/resources/satchel-sample-001-1.jpg
[bucket] => default
[path] => satchel-sample-001-1.jpg
[size] => 593254
[w] => 1508
[h] => 1148
[mime] => image/jpeg
[sizes] => Array
(
[thumb] => Array
(
[w] => 150
[h] => 114
[target_w] => 150
[target_h] => 150
[density] => 2
[path] => satchel-sample-001-1-thumb@2x.jpg
[size] => 8005
[mime] => 
[assetID] => 44
)

)

)

[perch_img1] => 
[perch_img1_thumb] => 
[perch_img1_zoom] => 
[perch_img2] => 
[perch_img2_thumb] => 
[perch_img2_zoom] => 
[perch_img3] => 
[perch_img3_thumb] => 
[perch_img3_zoom] => 
[perch_img4] => 
[perch_img4_thumb] => 
[perch_img4_zoom] => 
[perch_img5] => 
[perch_img5_thumb] => 
[perch_img5_zoom] => 
[perch_lining] => Array
(
[_flang] => markdown
[raw] => Fully lined in mother-of-pearl metallic lambskin  
Integrated wallet  
Bill pocket  
8 card slots  
Pen slot  
Mobile phone pocket  
Fully lined snap-in/out zip-top pouch in matching lambskin
[processed] => 
Fully lined in mother-of-pearl metallic lambskin

Integrated wallet

Bill pocket

8 card slots

Pen slot

Mobile phone pocket

Fully lined snap-in/out zip-top pouch in matching lambskin


)

[perch_on_sale] => 
[perch_pouchHeight] => 6
[perch_pouchLength] => 9
[perch_price] => Array
(
[142] => 2850
)

[perch_requires_shipping] => 1
[perch_sale_price] => Array
(
[142] => 
)

[perch_shippingDepth] => 6
[perch_shippingHeight] => 18
[perch_shippingWidth] => 20
[perch_slug] => highline-130-bernard-maisner-edition
[perch_status] => 1
[perch_stock_location] => 0
[perch_stock_status] => 1
[perch_strapLength] => 35
[perch_tax_group] => 1
[perch_title2] => Bernard Maisner Edition
[perch_trade_price] => Array
(
[142] => 
)

[perch_variantTitle] => Black Widow
[perch_weight] => 10
[pouchHeight] => 6
[pouchLength] => 9
[price] => Array
(
[142] => 2850
)

[price_with_tax] => 3078.00
[price_with_tax_formatted] => $3,078.00
[price_without_tax] => 2850.00
[price_without_tax_formatted] => $2,850.00
[productCreated] => 2016-03-30 15:32:39
[productDeleted] => 
[productDynamicFields] => {"slug":"highline-130-bernard-maisner-edition","title2":"Bernard Maisner Edition","about":{"_flang":"markdown","raw":"The signature Highline bag embodies the streamlined, architectural beauty of city life.  \r\nInside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.","processed":"
The signature Highline bag embodies the streamlined, architectural beauty of city life.
\nInside you will find a complete wallet integrated into rich lambskin lining, as well as a removable pouch to hold essential items.<\/p>"},"details":{"_flang":"markdown","raw":"Smooth black Italian full-grain leather  \r\nDistinctive \"OM\" rolled handles  \r\nHidden-hook removable shoulder strap  \r\nSolid brass hardware in silver-tone finish  \r\nSmooth 2-way palladium zipper closure at top  \r\n5 studs at bottom  \r\n\r\nMade in New York City","processed":"

Smooth black Italian full-grain leather
\nDistinctive \u201cOM\u201d rolled handles
\nHidden-hook removable shoulder strap
\nSolid brass hardware in silver-tone finish
\nSmooth 2-way palladium zipper closure at top
\n5 studs at bottom  <\/p>\n

Made in New York City<\/p>"},"lining":{"_flang":"markdown","raw":"Fully lined in mother-of-pearl metallic lambskin  \r\nIntegrated wallet  \r\nBill pocket  \r\n8 card slots  \r\nPen slot  \r\nMobile phone pocket  \r\nFully lined snap-in\/out zip-top pouch in matching lambskin","processed":"

Fully lined in mother-of-pearl metallic lambskin
\nIntegrated wallet
\nBill pocket
\n8 card slots
\nPen slot
\nMobile phone pocket
\nFully lined snap-in\/out zip-top pouch in matching lambskin<\/p>"},"variantTitle":"Black Widow","bagLength":"13","bagHeight":"10","bagWidth":"5","bagDrop":"5","strapLength":"35","pouchLength":"9","pouchHeight":"6","image":{"assetID":"43","title":"Satchel Sample 001","_default":"\/perch\/resources\/satchel-sample-001-1.jpg","bucket":"default","path":"satchel-sample-001-1.jpg","size":593254,"w":1508,"h":1148,"mime":"image\/jpeg","sizes":{"thumb":{"w":"150","h":"114","target_w":150,"target_h":150,"density":2,"path":"satchel-sample-001-1-thumb@2x.jpg","size":8005,"mime":"","assetID":"44"}}},"image_thumb":{"assetID":"43","title":"Satchel Sample 001","_default":"\/perch\/resources\/satchel-sample-001-1.jpg","bucket":"default","path":"satchel-sample-001-1.jpg","size":593254,"w":1508,"h":1148,"mime":"image\/jpeg","sizes":{"thumb":{"w":"150","h":"114","target_w":150,"target_h":150,"density":2,"path":"satchel-sample-001-1-thumb@2x.jpg","size":8005,"mime":"","assetID":"44"}}},"image_zoom":{"assetID":"43","title":"Satchel Sample 001","_default":"\/perch\/resources\/satchel-sample-001-1.jpg","bucket":"default","path":"satchel-sample-001-1.jpg","size":593254,"w":1508,"h":1148,"mime":"image\/jpeg","sizes":{"thumb":{"w":"150","h":"114","target_w":150,"target_h":150,"density":2,"path":"satchel-sample-001-1-thumb@2x.jpg","size":8005,"mime":"","assetID":"44"}}},"img1":null,"img1_thumb":null,"img1_zoom":null,"img2":null,"img2_thumb":null,"img2_zoom":null,"img3":null,"img3_thumb":null,"img3_zoom":null,"img4":null,"img4_thumb":null,"img4_zoom":null,"img5":null,"img5_thumb":null,"img5_zoom":null,"price":{"142":"2850"},"status":"1","brand":"2","category":["1","19"],"catalog_only":"0","sale_price":{"142":""},"trade_price":{"142":""},"on_sale":null,"tax_group":"1","stock_status":"1","stock_location":"0","requires_shipping":"1","weight":"10","shippingWidth":"20","shippingHeight":"18","shippingDepth":"6"}
[productHasVariants] => 1
[productID] => 40
[productOrder] => 1
[productSlug] => highline-130-bernard-maisner-edition
[productStockOnParent] => 0
[productTemplate] => product.html
[productUpdated] => 2016-08-03 15:26:29
[productVariantDesc] => 
[quantity] => 3
[requires_shipping] => 1
[sale_price] => Array
(
[142] => 
)

[shippingDepth] => 6
[shippingHeight] => 18
[shippingID] => 
[shippingWidth] => 20
[sku] => HL-130-BM-101
[slug] => highline-130-bernard-maisner-edition
[status] => 1
[stock_level] => 44
[stock_location] => 0
[stock_status] => 1
[strapLength] => 35
[tax] => 228.00
[tax_discount] => 0.00
[tax_formatted] => $228.00
[tax_group] => 1
[tax_rate] => 8.00
[title] => Highline 130
[title2] => Bernard Maisner Edition
[total_tax] => 684.00
[total_tax_formatted] => $684.00
[total_with_tax] => 9234.00
[total_with_tax_formatted] => $9,234.00
[total_without_tax] => 8550.00
[total_without_tax_formatted] => $8,550.00
[trade_price] => Array
(
[142] => 
)

[variantTitle] => Black Widow
[weight] => 10
)

)

[shipping_method] => Express (2 business days)
[shipping] => 1
[shipping_without_tax] => 25.00
[shipping_without_tax_formatted] => $25.00
[shipping_tax] => 2.13
[shipping_tax_formatted] => $2.13
[shipping_tax_rate] => 8.50
[shipping_with_tax] => 27.13
[shipping_with_tax_formatted] => $27.13
[shipping_id] => 2
[total_items] => 8550.00
[total_items_formatted] => $8,550.00
[total_items_tax] => 684.00
[total_items_tax_formatted] => $684.00
[total_shipping] => 25.00
[total_shipping_formatted] => $25.00
[total_shipping_tax] => 2.13
[total_shipping_tax_formatted] => $2.13
[total_items_with_shipping] => 8575.00
[total_items_with_shipping_formatted] => $8,575.00
[total_tax] => 686.13
[total_tax_formatted] => $686.13
[total_items_discount] => 0.00
[total_items_discount_formatted] => $0.00
[total_items_tax_discount] => 0.00
[total_items_tax_discount_formatted] => $0.00
[total_items_discounted] => 8550.00
[total_items_discounted_formatted] => $8,550.00
[total_items_discounted_with_tax] => 9234.00
[total_items_discounted_with_tax_formatted] => $9,234.00
[total_shipping_discount] => 0.00
[total_shipping_discount_formatted] => $0.00
[total_shipping_tax_discount] => 0.00
[total_shipping_tax_discount_formatted] => $0.00
[total_tax_discount] => 0.00
[total_tax_discount_formatted] => $0.00
[total_discounts] => 0.00
[total_discounts_formatted] => $0.00
[total_discounts_with_tax] => 0.00
[total_discounts_with_tax_formatted] => $0.00
[grand_total] => 9261.13
[grand_total_formatted] => $9,261.13
[shipping_weight] => 0.00
[tax_rate_totals] => Array
(
[0] => Array
(
[exchange_rate] => 1.00000
[tax_rate] => 8.00
[tax_rate_formatted] => 8 %
[total_tax] => 684.00
[total_tax_formatted] => $684.00
[total_value] => 8550.00
[total_value_formatted] => $8,550.00
[reporting_tax] => 684.00
[reporting_tax_formatted] => $684.00
[reporting_value] => 8550.00
[reporting_value_formatted] => $8,550.00
)

[1] => Array
(
[exchange_rate] => 1.00000
[tax_rate] => 8.50
[tax_rate_formatted] => 8.5 %
[total_tax] => 2.13
[total_tax_formatted] => $2.13
[total_value] => 25.00
[total_value_formatted] => $25.00
[reporting_tax] => 2.13
[reporting_tax_formatted] => $2.13
[reporting_value] => 25.00
[reporting_value_formatted] => $25.00
)

)

[currencyCode] => USD
[currencyNumber] => 840
[currencyTitle] => United States dollar
[currencySymbol] => $
[currencySymbolPosition] => before
[currencyDecimals] => 2
[currencyRate] => 1.0000
[currencyActive] => 1
[currencyIsCommon] => 1
[currencyDynamicFields] => []
[invoice_number] => Invoice50
[exchange_rate] => 1.00000
)

)
Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm, I think the issue here is that we exclude addresses that are already assigned to an order. When an order is placed, the address is copied and frozen, so that the records aren't invalidated by later edits.

These functions were designed with address book management in mind - i.e. pre-order. Therefore looking up an address that is assigned to an order doesn't currently work.

Thank you for taking such a thorough look at it Drew; I really appreciate it.

I haven't set up the order confirm emails yet, but I see that they contain addresses and other cart details--are they then generated before the the cart is destroyed, and informed by the cart rather then the order?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, it's really just a filter on the query. All the data is there - but we don't use those runtime functions internally.

It's going to need a bug fix in the next update, which I'm afraid won't be until I'm back in the UK at the beginning of next week.

Ah, I see, that's good news. Thank you Drew!!

Hi Drew, Not sure if this made it into 1.0.8?

Recap: trying to get the order addresses to display on a historical order page via:

<?php 
$order =    perch_shop_order(perch_get('orderID'), ['skip-template' => true,]);
 perch_shop_customer_address($order[0]['orderBillingAddress'], [
                              'template' => 'addresses/address.html',
                            ]);
?>