Country defaults to store base. State field defaults to 'please select state' - not alabama for US. Closes #200.

This commit is contained in:
Mike Jolley 2011-11-16 15:25:45 +00:00
parent 9731f950ff
commit ac3ddba858
5 changed files with 607 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -90,8 +90,6 @@ class woocommerce_cart {
* Sets the php session data for the cart and coupons
*/
function set_session() {
$cart = array();
// Set cart and coupon session data
$_SESSION['cart'] = $this->cart_contents;
$_SESSION['coupons'] = $this->applied_coupons;

View File

@ -828,6 +828,8 @@ class woocommerce_checkout {
/** Gets the value either from the posted data, or from the users meta data */
function get_value( $input ) {
global $woocommerce;
if (isset( $this->posted[$input] ) && !empty($this->posted[$input])) :
return $this->posted[$input];
elseif (is_user_logged_in()) :
@ -842,6 +844,16 @@ class woocommerce_checkout {
break;
endswitch;
else :
switch ( $input ) :
case "billing_country" :
return $woocommerce->countries->get_base_country();
break;
endswitch;
endif;
}
}

View File

@ -99,12 +99,16 @@ class woocommerce_order {
// Formatted Addresses
$formatted_address = array();
$country = ($this->billing_country && isset($woocommerce->countries->countries[$this->billing_country])) ? $woocommerce->countries->countries[$this->billing_country] : $this->billing_country;
$state = ($this->billing_country && $this->billing_state && isset($woocommerce->countries->states[$this->billing_country][$this->billing_state])) ? $woocommerce->countries->states[$this->billing_country][$this->billing_state] : $this->billing_state;
$address = array_map('trim', array(
$this->billing_address_1,
$this->billing_address_2,
$this->billing_city,
$this->billing_state,
$state,
$this->billing_postcode,
$country
));
@ -113,12 +117,16 @@ class woocommerce_order {
if ($this->shipping_address_1) :
$formatted_address = array();
$country = ($this->shipping_country && isset($woocommerce->countries->countries[$this->shipping_country])) ? $woocommerce->countries->countries[$this->shipping_country] : $this->shipping_country;
$state = ($this->shipping_country && $this->shipping_state && isset($woocommerce->countries->states[$this->shipping_country][$this->shipping_state])) ? $woocommerce->countries->states[$this->shipping_country][$this->shipping_state] : $this->shipping_state;
$address = array_map('trim', array(
$this->shipping_address_1,
$this->shipping_address_2,
$this->shipping_city,
$this->shipping_state,
$state,
$this->shipping_postcode,
$country
));

View File

@ -104,6 +104,9 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* PayPal standard stores payer email address
* Added handling for paypal reversal and refunded statuses
* Downloads check order status is completed before allowing access - to do this we've added a new column to the permissions table (order id). Existing rows will be updated upon activation.
* Formatted address shows full state name
* State field shows 'select a state by default'
* Country defaults to base country on checkout
= 1.2.1 - 10/11/2011 =
* Reworked downloadable and virtual products - now variations can be downloadable/virtual too making it more flexible