From bce591b75fb75d4dc19e4808824fe690428a34ff Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 5 Dec 2011 18:16:13 +0000 Subject: [PATCH] Fix for shipping/payment method to include titles --- admin/post-types/shop_order.php | 8 ++++---- classes/checkout.class.php | 6 ++++-- classes/gateways/gateway-paypal.php | 2 -- classes/order.class.php | 4 +++- shortcodes/shortcode-pay.php | 4 +--- shortcodes/shortcode-thankyou.php | 4 +--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php index 48d8f522457..e34efa68eec 100644 --- a/admin/post-types/shop_order.php +++ b/admin/post-types/shop_order.php @@ -80,8 +80,8 @@ function woocommerce_custom_order_columns($column) { echo '
'; echo ''.esc_html( $order->formatted_billing_address ).''; - if ($order->payment_method) : - echo '' . __('Paid via', 'woothemes') . ' ' . esc_html( $order->payment_method ) . ''; + if ($order->payment_method_title) : + echo '' . __('Paid via', 'woothemes') . ' ' . esc_html( $order->payment_method_title ) . ''; endif; break; @@ -95,8 +95,8 @@ function woocommerce_custom_order_columns($column) { echo '–'; endif; - if ($order->shipping_method) : - echo '' . __('Shipped via', 'woothemes') . ' ' . esc_html( $order->shipping_method ) . ''; + if ($order->shipping_method_title) : + echo '' . __('Shipped via', 'woothemes') . ' ' . esc_html( $order->shipping_method_title ) . ''; endif; break; case "total_cost" : diff --git a/classes/checkout.class.php b/classes/checkout.class.php index df837f69859..d5734bd9bdb 100644 --- a/classes/checkout.class.php +++ b/classes/checkout.class.php @@ -765,8 +765,10 @@ class woocommerce_checkout { update_post_meta( $order_id, '_shipping_postcode', $shipping_postcode); update_post_meta( $order_id, '_shipping_country', $shipping_country); update_post_meta( $order_id, '_shipping_state', $shipping_state); - update_post_meta( $order_id, '_shipping_method', $shipping_method); - update_post_meta( $order_id, '_payment_method', $payment_method); + update_post_meta( $order_id, '_shipping_method', $this->posted['shipping_method']); + update_post_meta( $order_id, '_payment_method', $this->posted['payment_method']); + update_post_meta( $order_id, '_shipping_method_title', $shipping_method); + update_post_meta( $order_id, '_payment_method_title', $payment_method); update_post_meta( $order_id, '_order_subtotal', number_format($woocommerce->cart->subtotal_ex_tax, 2, '.', '')); update_post_meta( $order_id, '_order_shipping', number_format($woocommerce->cart->shipping_total, 2, '.', '')); update_post_meta( $order_id, '_order_discount', number_format($woocommerce->cart->get_order_discount_total(), 2, '.', '')); diff --git a/classes/gateways/gateway-paypal.php b/classes/gateways/gateway-paypal.php index f4e6d01405e..dcbc5e686a1 100644 --- a/classes/gateways/gateway-paypal.php +++ b/classes/gateways/gateway-paypal.php @@ -157,8 +157,6 @@ class woocommerce_paypal extends woocommerce_payment_gateway { if ($this->debug=='yes') $woocommerce->log->add( 'paypal', 'Generating payment form for order #' . $order_id . '. Notify URL: ' . trailingslashit(home_url()).'?paypalListener=paypal_standard_IPN'); - $shipping_name = explode(' ', $order->shipping_method); - if (in_array($order->billing_country, array('US','CA'))) : $order->billing_phone = str_replace(array('(', '-', ' ', ')'), '', $order->billing_phone); $phone_args = array( diff --git a/classes/order.class.php b/classes/order.class.php index 49c30ea8c02..dd1c0364fce 100644 --- a/classes/order.class.php +++ b/classes/order.class.php @@ -83,7 +83,9 @@ class woocommerce_order { 'shipping_country' => '', 'shipping_state' => '', 'shipping_method' => '', + 'shipping_method_title' => '', 'payment_method' => '', + 'payment_method_title' => '', 'order_subtotal' => '', 'order_discount' => '', 'cart_discount' => '', @@ -269,7 +271,7 @@ class woocommerce_order { endif; - $shipping .= sprintf(__(' %svia %s', 'woothemes'), $tax_text, ucwords($this->shipping_method)); + $shipping .= sprintf(__(' %svia %s', 'woothemes'), $tax_text, ucwords($this->shipping_method_title)); else : $shipping = __('Free!', 'woothemes'); diff --git a/shortcodes/shortcode-pay.php b/shortcodes/shortcode-pay.php index d61bd280d95..8ca80e7b482 100644 --- a/shortcodes/shortcode-pay.php +++ b/shortcodes/shortcode-pay.php @@ -111,9 +111,7 @@ function woocommerce_pay() {
  • payment_gateways->payment_gateways(); - if (isset($gateways[$order->payment_method])) echo $gateways[$order->payment_method]->title; - else echo $order->payment_method; + echo $order->payment_method_title; ?>
  • diff --git a/shortcodes/shortcode-thankyou.php b/shortcodes/shortcode-thankyou.php index d52acdb3689..8a674fcfe66 100644 --- a/shortcodes/shortcode-thankyou.php +++ b/shortcodes/shortcode-thankyou.php @@ -74,9 +74,7 @@ function woocommerce_thankyou( $atts ) {
  • payment_gateways->payment_gateways(); - if (isset($gateways[$order->payment_method])) echo $gateways[$order->payment_method]->title; - else echo $order->payment_method; + echo $order->payment_method_title; ?>