MAP Url method
This commit is contained in:
parent
de4129f9b2
commit
5404006b29
|
@ -995,6 +995,24 @@ abstract class WC_Abstract_Order {
|
|||
return $this->formatted_shipping_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a formatted shipping address for the order.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_shipping_address_map_url() {
|
||||
$address = apply_filters( 'woocommerce_shipping_address_map_url_parts', array(
|
||||
'address_1' => $this->shipping_address_1,
|
||||
'address_2' => $this->shipping_address_2,
|
||||
'city' => $this->shipping_city,
|
||||
'state' => $this->shipping_state,
|
||||
'postcode' => $this->shipping_postcode,
|
||||
'country' => $this->shipping_country
|
||||
), $this );
|
||||
|
||||
return apply_filters( 'woocommerce_shipping_address_map_url', 'http://maps.google.com/maps?&q=' . urlencode( implode( ', ', $address ) ) . '&z=16', $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the billing address in an array.
|
||||
* @deprecated 2.3
|
||||
|
|
|
@ -528,8 +528,8 @@ class WC_Admin_Post_Types {
|
|||
break;
|
||||
case 'shipping_address' :
|
||||
|
||||
if ( $the_order->get_formatted_shipping_address() ) {
|
||||
echo '<a target="_blank" href="' . esc_url( 'http://maps.google.com/maps?&q=' . urlencode( $the_order->get_shipping_address() ) . '&z=16' ) . '">'. esc_html( preg_replace( '#<br\s*/?>#i', ', ', $the_order->get_formatted_shipping_address() ) ) .'</a>';
|
||||
if ( $address = $the_order->get_formatted_shipping_address() ) {
|
||||
echo '<a target="_blank" href="' . esc_url( $the_order->get_shipping_address_map_url() ) . '">'. esc_html( preg_replace( '#<br\s*/?>#i', ', ', $address ) ) .'</a>';
|
||||
} else {
|
||||
echo '–';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue