From 5575b92a5025bcf7ecca3338cf555b219f9ffff9 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 31 Oct 2011 00:47:41 +0000 Subject: [PATCH] Added order details to thanks page. Closes #121. Added hooks for thanks page + view order page so that order tables can use the same code. This also means you can unhook the order table if you don't wan't it on the thanks page. --- readme.txt | 1 + shortcodes/shortcode-my_account.php | 160 +++++----------------------- shortcodes/shortcode-thankyou.php | 4 +- woocommerce_template_actions.php | 4 + woocommerce_template_functions.php | 122 +++++++++++++++++++++ 5 files changed, 153 insertions(+), 138 deletions(-) diff --git a/readme.txt b/readme.txt index 801ad37157e..f5aef78e465 100644 --- a/readme.txt +++ b/readme.txt @@ -89,6 +89,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo * Download urls use site_url instead of home_url so installs in subdirectories are handled correctly * Option to add logout link to my account menu * Ability to preview email templates +* Added order details to thankyou page = 1.1.3 - 27/10/2011 = * Improved Force SSL Setting - now forces https urls for enqueued scripts and styles diff --git a/shortcodes/shortcode-my_account.php b/shortcodes/shortcode-my_account.php index dc87e69565e..2e0b5a2e982 100644 --- a/shortcodes/shortcode-my_account.php +++ b/shortcodes/shortcode-my_account.php @@ -471,143 +471,31 @@ function woocommerce_view_order() { echo sprintf( __('. Order status: %s', 'woothemes'), $status->name ); echo '.

'; - ?> + + $notes = $order->get_customer_order_notes(); + if ($notes) : + ?> +

+
    + +
  1. +
    +
    +

    comment_date)); ?>

    +
    + comment_content)); ?> +
    +
    +
    +
    +
    +
  2. + +
+ get_customer_order_notes(); - if ($notes) : - ?> -

-
    - -
  1. -
    -
    -

    comment_date)); ?>

    -
    - comment_content)); ?> -
    -
    -
    -
    -
    -
  2. - -
- - -

- - - - - - - - - - - - - - order_shipping>0) : ?> - - - - get_total_tax()>0) : ?> - - - - order_discount>0) : ?> - - - - - - - - customer_note) : ?> - - - - - - - - items)>0) : - - foreach($order->items as $item) : - - if (isset($item['variation_id']) && $item['variation_id'] > 0) : - $_product = &new woocommerce_product_variation( $item['variation_id'] ); - else : - $_product = &new woocommerce_product( $item['id'] ); - endif; - - echo ' - - - - - '; - endforeach; - endif; - ?> - -
get_subtotal_to_display(); ?>
get_shipping_to_display(); ?>
get_total_tax()); ?>
-order_discount); ?>
order_total); ?>
customer_note)); ?>
'.$item['name']; - - if (isset($item['item_meta'])) : - echo woocommerce_get_formatted_variation( $item['item_meta'] ); - endif; - - echo ' '.$item['qty'].''.woocommerce_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1) ).'
- -
-

-
-
- billing_email) echo '
'.__('Email:', 'woothemes').'
'.$order->billing_email.'
'; - if ($order->billing_phone) echo '
'.__('Telephone:', 'woothemes').'
'.$order->billing_phone.'
'; - ?> -
- -
- -
- -
-

-
-

- formatted_shipping_address) _e('N/A', 'woothemes'); else echo $order->formatted_shipping_address; - ?> -

- -
- -
- -
-

-
-

- formatted_billing_address) _e('N/A', 'woothemes'); else echo $order->formatted_billing_address; - ?> -

- -
- -
- -
- - '.__('My Account', 'woothemes').''; endif; - + else : echo '

' . __('Thank you. Your order has been received.', 'woothemes') . '

'; @@ -85,8 +85,8 @@ function woocommerce_thankyou( $atts ) { endif; - do_action( 'woocommerce_thankyou', $order_id ); do_action( 'woocommerce_thankyou_' . $order->payment_method, $order_id ); + do_action( 'woocommerce_thankyou', $order_id ); endif; diff --git a/woocommerce_template_actions.php b/woocommerce_template_actions.php index 7fe600a3888..57607be2270 100644 --- a/woocommerce_template_actions.php +++ b/woocommerce_template_actions.php @@ -92,3 +92,7 @@ add_action('woocommerce_cart_collaterals', 'woocommerce_cross_sell_display'); /* Footer */ add_action( 'wp_footer', 'woocommerce_demo_store' ); + +/* Order details */ +add_action( 'woocommerce_view_order', 'woocommerce_order_details_table', 10 ); +add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 ); diff --git a/woocommerce_template_functions.php b/woocommerce_template_functions.php index d5f5b47550b..dcb82fbc0f0 100644 --- a/woocommerce_template_functions.php +++ b/woocommerce_template_functions.php @@ -1156,6 +1156,9 @@ function woocommerce_product_subcategories() { } +/** + * Show subcategory thumbnail + **/ function woocommerce_subcategory_thumbnail( $category ) { global $woocommerce; @@ -1175,3 +1178,122 @@ function woocommerce_subcategory_thumbnail( $category ) { echo ''.$category->slug.''; } +/** + * Display an orders details in a table + **/ +function woocommerce_order_details_table( $order_id ) { + + if (!$order_id) return; + + $order = &new woocommerce_order( $order_id ); + ?> +

+ + + + + + + + + + + + + + order_shipping>0) : ?> + + + + get_total_tax()>0) : ?> + + + + order_discount>0) : ?> + + + + + + + + customer_note) : ?> + + + + + + + + items)>0) : + + foreach($order->items as $item) : + + if (isset($item['variation_id']) && $item['variation_id'] > 0) : + $_product = &new woocommerce_product_variation( $item['variation_id'] ); + else : + $_product = &new woocommerce_product( $item['id'] ); + endif; + + echo ' + + + + + '; + endforeach; + endif; + ?> + +
get_subtotal_to_display(); ?>
get_shipping_to_display(); ?>
get_total_tax()); ?>
-order_discount); ?>
order_total); ?>
customer_note)); ?>
'.$item['name']; + + if (isset($item['item_meta'])) : + echo woocommerce_get_formatted_variation( $item['item_meta'] ); + endif; + + echo ' '.$item['qty'].''.woocommerce_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1) ).'
+ +
+

+
+
+ billing_email) echo '
'.__('Email:', 'woothemes').'
'.$order->billing_email.'
'; + if ($order->billing_phone) echo '
'.__('Telephone:', 'woothemes').'
'.$order->billing_phone.'
'; + ?> +
+ +
+ +
+ +
+

+
+

+ formatted_shipping_address) _e('N/A', 'woothemes'); else echo $order->formatted_shipping_address; + ?> +

+ +
+ +
+ +
+

+
+

+ formatted_billing_address) _e('N/A', 'woothemes'); else echo $order->formatted_billing_address; + ?> +

+ +
+ +
+ +
+