Fix for shipping/payment method to include titles

This commit is contained in:
Mike Jolley 2011-12-05 18:16:13 +00:00
parent 123a887af1
commit bce591b75f
6 changed files with 13 additions and 15 deletions

View File

@ -80,8 +80,8 @@ function woocommerce_custom_order_columns($column) {
echo '</strong><br/>';
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.co.uk/maps?&q='.urlencode($order->formatted_billing_address).'&z=16' ) . '">'.esc_html( $order->formatted_billing_address ).'</a>';
if ($order->payment_method) :
echo '<small class="meta">' . __('Paid via', 'woothemes') . ' ' . esc_html( $order->payment_method ) . '</small>';
if ($order->payment_method_title) :
echo '<small class="meta">' . __('Paid via', 'woothemes') . ' ' . esc_html( $order->payment_method_title ) . '</small>';
endif;
break;
@ -95,8 +95,8 @@ function woocommerce_custom_order_columns($column) {
echo '&ndash;';
endif;
if ($order->shipping_method) :
echo '<small class="meta">' . __('Shipped via', 'woothemes') . ' ' . esc_html( $order->shipping_method ) . '</small>';
if ($order->shipping_method_title) :
echo '<small class="meta">' . __('Shipped via', 'woothemes') . ' ' . esc_html( $order->shipping_method_title ) . '</small>';
endif;
break;
case "total_cost" :

View File

@ -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, '.', ''));

View File

@ -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(

View File

@ -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(__(' <small>%svia %s</small>', 'woothemes'), $tax_text, ucwords($this->shipping_method));
$shipping .= sprintf(__(' <small>%svia %s</small>', 'woothemes'), $tax_text, ucwords($this->shipping_method_title));
else :
$shipping = __('Free!', 'woothemes');

View File

@ -111,9 +111,7 @@ function woocommerce_pay() {
<li class="method">
<?php _e('Payment method:', 'woothemes'); ?>
<strong><?php
$gateways = $woocommerce->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;
?></strong>
</li>
</ul>

View File

@ -74,9 +74,7 @@ function woocommerce_thankyou( $atts ) {
<li class="method">
<?php _e('Payment method:', 'woothemes'); ?>
<strong><?php
$gateways = $woocommerce->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;
?></strong>
</li>
</ul>