From feb9afd30bd70c3d584dbfea4aad0d44536e46e8 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 15 Dec 2011 01:14:47 +0000 Subject: [PATCH] Started work on locale options for ticket #316. Plan is to combine locale options with the checkout array so fields can be overridden. --- assets/js/woocommerce.js | 38 +++++++++++++++-------- assets/js/woocommerce.min.js | 2 +- classes/checkout.class.php | 33 +++++++++++++------- classes/countries.class.php | 4 +-- classes/localisation.class.php | 55 ++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 27 deletions(-) create mode 100644 classes/localisation.class.php diff --git a/assets/js/woocommerce.js b/assets/js/woocommerce.js index 6c9d43961a4..437ab3c7f6a 100755 --- a/assets/js/woocommerce.js +++ b/assets/js/woocommerce.js @@ -151,21 +151,33 @@ jQuery(document).ready(function($) { var value = $(state_box).val(); if (states[country]) { - var options = ''; - var state = states[country]; - for(var index in state) { - options = options + ''; - } - if ($(state_box).is('input')) { - // Change for select - $(state_box).replaceWith(''); - state_box = $('#' + $(this).attr('rel')); - } - $(state_box).html( '' + options); + if (states[country].length == 0) { + + // Empty array means state field is not used + $(state_box).parent().hide(); + $(state_box).replaceWith(''); + + } else { - $(state_box).val(value); + var options = ''; + var state = states[country]; + for(var index in state) { + options = options + ''; + } + if ($(state_box).is('input')) { + // Change for select + $(state_box).replaceWith(''); + state_box = $('#' + $(this).attr('rel')); + } + $(state_box).html( '' + options); + + $(state_box).val(value); + $(state_box).parent().show(); + + } } else { - if ($(state_box).is('select')) { + if ($(state_box).is('select, .hidden')) { + $(state_box).parent().show(); $(state_box).replaceWith(''); } } diff --git a/assets/js/woocommerce.min.js b/assets/js/woocommerce.min.js index dd01648fd30..03f5d9562a5 100644 --- a/assets/js/woocommerce.min.js +++ b/assets/js/woocommerce.min.js @@ -1 +1 @@ -jQuery(document).ready(function(e){if(woocommerce_params.option_ajax_add_to_cart=="yes"){e(".add_to_cart_button").live("click",function(){var l=e(this);if(l.is(".product_type_simple, .product_type_downloadable, .product_type_virtual")){if(!e(l).attr("data-product_id")){return true}e(l).addClass("loading");var m={action:"woocommerce_add_to_cart",product_id:e(l).attr("data-product_id"),security:woocommerce_params.add_to_cart_nonce};e("body").trigger("adding_to_cart");e.post(woocommerce_params.ajax_url,m,function(n){e(l).removeClass("loading");m=e.parseJSON(n);if(m.error){alert(m.error);return}fragments=m;if(fragments){e.each(fragments,function(o,p){e(o).addClass("updating")})}e(".widget_shopping_cart, .shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});e(l).addClass("added");if(e(".widget_shopping_cart").size()>0){e(".widget_shopping_cart:eq(0)").load(window.location+" .widget_shopping_cart:eq(0) > *",function(){if(fragments){e.each(fragments,function(o,p){e(o).replaceWith(p)})}e(".widget_shopping_cart, .updating").css("opacity","1").unblock()})}else{if(fragments){e.each(fragments,function(o,p){e(o).replaceWith(p)})}e(".widget_shopping_cart, .updating").css("opacity","1").unblock()}e(".shop_table.cart").load(window.location+" .shop_table.cart:eq(0) > *",function(){e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');e(".shop_table.cart").css("opacity","1").unblock()});e(".cart_totals").load(window.location+" .cart_totals:eq(0) > *",function(){e(".cart_totals").css("opacity","1").unblock()});e("body").trigger("added_to_cart")});return false}else{return true}})}e("select.orderby").change(function(){e(this).closest("form").submit()});e("#rating").hide().before('

12345

');e("p.stars a").click(function(){var l=e(this);e("#rating").val(l.text());e("p.stars a").removeClass("active");l.addClass("active");return false});e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');e(".plus").live("click",function(){var l=parseInt(e(this).prev(".qty").val());if(!l||l==""||l=="NaN"){l=0}e(this).prev(".qty").val(l+1)});e(".minus").live("click",function(){var l=parseInt(e(this).next(".qty").val());if(!l||l==""||l=="NaN"){l=1}if(l>0){e(this).next(".qty").val(l-1)}});var b=woocommerce_params.countries.replace(/"/g,'"');var i=e.parseJSON(b);e("select.country_to_state").change(function(){var r=e(this).val();var o=e("#"+e(this).attr("rel"));var s=e(o).attr("name");var n=e(o).attr("id");var q=e(o).val();if(i[r]){var m="";var p=i[r];for(var l in p){m=m+'"}if(e(o).is("input")){e(o).replaceWith('');o=e("#"+e(this).attr("rel"))}e(o).html('"+m);e(o).val(q)}else{if(e(o).is("select")){e(o).replaceWith('')}}}).change();e("div.woocommerce_tabs .panel").hide();e("div.woocommerce_tabs ul.tabs li a").click(function(){var m=e(this);var l=m.closest("div.woocommerce_tabs");e("ul.tabs li",l).removeClass("active");e("div.panel",l).hide();e("div"+m.attr("href")).show();m.parent().addClass("active");return false});e("div.woocommerce_tabs").each(function(){var l=window.location.hash;if(l.toLowerCase().indexOf("comment-")>=0){e("ul.tabs li.reviews_tab a",e(this)).click()}else{e("ul.tabs li:first a",e(this)).click()}});e(".shipping-calculator-form").hide();e(".shipping-calculator-button").click(function(){e(".shipping-calculator-form").slideToggle("slow");return false});function a(p,o){var l=true;for(name in p){var n=p[name];var m=o[name];if(n.length!=0&&m.length!=0&&n!=m){l=false}}return l}function k(n){var p=[];for(var m=0;m").html(n).text();n=n.replace(/'/g,"\\'");n=n.replace(/"/g,'\\"');current_attr_select.find('option[value="'+n+'"]').removeAttr("disabled")}else{current_attr_select.find("option").removeAttr("disabled")}}}}})}function f(n){var l=e("div.images img:eq(0)");var r=e("div.images a.zoom:eq(0)");var q=e(l).attr("original-src");var p=e(r).attr("original-href");var o=n.image_src;var m=n.image_link;e(".variations_button").show();e(".single_variation").html(n.price_html+n.availability_html);if(!q){e(l).attr("original-src",e(l).attr("src"))}if(!p){e(r).attr("original-href",e(r).attr("href"))}if(o&&o.length>1){e(l).attr("src",o);e(r).attr("href",m)}else{e(l).attr("src",q);e(r).attr("href",p)}e(".single_variation_wrap").slideDown("200").trigger("variationWrapShown")}function c(m){var l=true;var o={};e(".variations select").each(function(){if(m&&e(this).attr("name")==m){l=false;o[e(this).attr("name")]=""}else{if(e(this).val().length==0){l=false}value=e(this).val().replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">");o[e(this).attr("name")]=value}});var p=k(o);if(l){var n=p.pop();if(n){e("form input[name=variation_id]").val(n.variation_id);f(n)}else{e(".variations select").val("")}}else{g(p)}}e(".variations select").change(function(){e("form input[name=variation_id]").val("");e(".single_variation_wrap").hide();e(".single_variation").text("");c();e(this).blur();if(e().uniform&&e.isFunction(e.uniform.update)){e.uniform.update()}}).focus(function(){c(e(this).attr("name"))}).change();if(woocommerce_params.is_cart==1){e("select#shipping_method").live("change",function(){var m=e("#shipping_method").val();e("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});var l={action:"woocommerce_update_shipping_method",security:woocommerce_params.update_shipping_method_nonce,shipping_method:m};e.post(woocommerce_params.ajax_url,l,function(n){e("div.cart_totals").replaceWith(n)})})}if(woocommerce_params.is_checkout==1||woocommerce_params.is_pay_page==1){var j;var h;function d(){if(h){h.abort()}var s=e("#shipping_method").val();var r=e("#billing_country").val();var p=e("#billing_state").val();var l=e("input#billing_postcode").val();if(e("#shiptobilling input").is(":checked")||e("#shiptobilling input").size()==0){var m=e("#billing_country").val();var o=e("#billing_state").val();var q=e("input#billing_postcode").val()}else{var m=e("#shipping_country").val();var o=e("#shipping_state").val();var q=e("input#shipping_postcode").val()}e("#order_methods, #order_review").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});var n={action:"woocommerce_update_order_review",security:woocommerce_params.update_order_review_nonce,shipping_method:s,country:r,state:p,postcode:l,s_country:m,s_state:o,s_postcode:q,post_data:e("form.checkout").serialize()};h=e.ajax({type:"POST",url:woocommerce_params.ajax_url,data:n,success:function(t){e("#order_methods, #order_review").remove();e("#order_review_heading").after(t);e("#order_review input[name=payment_method]:checked").click()}})}e("p.password, form.login, div.shipping_address").hide();e("input.show_password").change(function(){e("p.password").slideToggle()});e("a.showlogin").click(function(){e("form.login").slideToggle();return false});e("#shiptobilling input").change(function(){e("div.shipping_address").hide();if(!e(this).is(":checked")){e("div.shipping_address").slideDown()}}).change();if(woocommerce_params.option_guest_checkout=="yes"){e("div.create-account").hide();e("input#createaccount").change(function(){e("div.create-account").hide();if(e(this).is(":checked")){e("div.create-account").slideDown()}}).change()}e(".payment_methods input.input-radio").live("click",function(){e("div.payment_box").hide();if(e(this).is(":checked")){e("div.payment_box."+e(this).attr("ID")).slideDown()}});e("#order_review input[name=payment_method]:checked").click();e("#shipping_method").live("change",function(){clearTimeout(j);d()});e("input#billing_country, input#billing_state, #billing_postcode, input#shipping_country, input#shipping_state, #shipping_postcode").live("keydown",function(){clearTimeout(j);j=setTimeout("update_checkout()","1000")});e("select#billing_country, select#billing_state, select#shipping_country, select#shipping_state, #shiptobilling input, .update_totals_on_change").live("change",function(){clearTimeout(j);d()});if(woocommerce_params.is_checkout==1){d()}e("form.checkout").submit(function(){var l=e(this);if(l.is(".processing")){return false}l.addClass("processing").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});e.ajax({type:"POST",url:woocommerce_params.checkout_url,data:l.serialize(),success:function(n){e(".woocommerce_error, .woocommerce_message").remove();try{success=e.parseJSON(n);window.location=decodeURI(success.redirect)}catch(m){l.prepend(n);l.removeClass("processing").unblock();e("html, body").animate({scrollTop:(e("form.checkout").offset().top-100)},1000)}},dataType:"html"});return false})}}); \ No newline at end of file +jQuery(document).ready(function(e){if(woocommerce_params.option_ajax_add_to_cart=="yes"){e(".add_to_cart_button").live("click",function(){var l=e(this);if(l.is(".product_type_simple, .product_type_downloadable, .product_type_virtual")){if(!e(l).attr("data-product_id")){return true}e(l).addClass("loading");var m={action:"woocommerce_add_to_cart",product_id:e(l).attr("data-product_id"),security:woocommerce_params.add_to_cart_nonce};e("body").trigger("adding_to_cart");e.post(woocommerce_params.ajax_url,m,function(n){e(l).removeClass("loading");m=e.parseJSON(n);if(m.error){alert(m.error);return}fragments=m;if(fragments){e.each(fragments,function(o,p){e(o).addClass("updating")})}e(".widget_shopping_cart, .shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{background:"transparent url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});e(l).addClass("added");if(e(".widget_shopping_cart").size()>0){e(".widget_shopping_cart:eq(0)").load(window.location+" .widget_shopping_cart:eq(0) > *",function(){if(fragments){e.each(fragments,function(o,p){e(o).replaceWith(p)})}e(".widget_shopping_cart, .updating").css("opacity","1").unblock()})}else{if(fragments){e.each(fragments,function(o,p){e(o).replaceWith(p)})}e(".widget_shopping_cart, .updating").css("opacity","1").unblock()}e(".shop_table.cart").load(window.location+" .shop_table.cart:eq(0) > *",function(){e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');e(".shop_table.cart").css("opacity","1").unblock()});e(".cart_totals").load(window.location+" .cart_totals:eq(0) > *",function(){e(".cart_totals").css("opacity","1").unblock()});e("body").trigger("added_to_cart")});return false}else{return true}})}e("select.orderby").change(function(){e(this).closest("form").submit()});e("#rating").hide().before('

12345

');e("p.stars a").click(function(){var l=e(this);e("#rating").val(l.text());e("p.stars a").removeClass("active");l.addClass("active");return false});e("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('').prepend('');e(".plus").live("click",function(){var l=parseInt(e(this).prev(".qty").val());if(!l||l==""||l=="NaN"){l=0}e(this).prev(".qty").val(l+1)});e(".minus").live("click",function(){var l=parseInt(e(this).next(".qty").val());if(!l||l==""||l=="NaN"){l=1}if(l>0){e(this).next(".qty").val(l-1)}});var b=woocommerce_params.countries.replace(/"/g,'"');var i=e.parseJSON(b);e("select.country_to_state").change(function(){var r=e(this).val();var o=e("#"+e(this).attr("rel"));var s=e(o).attr("name");var n=e(o).attr("id");var q=e(o).val();if(i[r]){if(i[r].length==0){e(o).parent().hide();e(o).replaceWith('')}else{var m="";var p=i[r];for(var l in p){m=m+'"}if(e(o).is("input")){e(o).replaceWith('');o=e("#"+e(this).attr("rel"))}e(o).html('"+m);e(o).val(q);e(o).parent().show()}}else{if(e(o).is("select, .hidden")){e(o).parent().show();e(o).replaceWith('')}}}).change();e("div.woocommerce_tabs .panel").hide();e("div.woocommerce_tabs ul.tabs li a").click(function(){var m=e(this);var l=m.closest("div.woocommerce_tabs");e("ul.tabs li",l).removeClass("active");e("div.panel",l).hide();e("div"+m.attr("href")).show();m.parent().addClass("active");return false});e("div.woocommerce_tabs").each(function(){var l=window.location.hash;if(l.toLowerCase().indexOf("comment-")>=0){e("ul.tabs li.reviews_tab a",e(this)).click()}else{e("ul.tabs li:first a",e(this)).click()}});e(".shipping-calculator-form").hide();e(".shipping-calculator-button").click(function(){e(".shipping-calculator-form").slideToggle("slow");return false});function a(p,o){var l=true;for(name in p){var n=p[name];var m=o[name];if(n.length!=0&&m.length!=0&&n!=m){l=false}}return l}function k(n){var p=[];for(var m=0;m").html(n).text();n=n.replace(/'/g,"\\'");n=n.replace(/"/g,'\\"');current_attr_select.find('option[value="'+n+'"]').removeAttr("disabled")}else{current_attr_select.find("option").removeAttr("disabled")}}}}})}function f(n){var l=e("div.images img:eq(0)");var r=e("div.images a.zoom:eq(0)");var q=e(l).attr("original-src");var p=e(r).attr("original-href");var o=n.image_src;var m=n.image_link;e(".variations_button").show();e(".single_variation").html(n.price_html+n.availability_html);if(!q){e(l).attr("original-src",e(l).attr("src"))}if(!p){e(r).attr("original-href",e(r).attr("href"))}if(o&&o.length>1){e(l).attr("src",o);e(r).attr("href",m)}else{e(l).attr("src",q);e(r).attr("href",p)}e(".single_variation_wrap").slideDown("200").trigger("variationWrapShown")}function c(m){var l=true;var o={};e(".variations select").each(function(){if(m&&e(this).attr("name")==m){l=false;o[e(this).attr("name")]=""}else{if(e(this).val().length==0){l=false}value=e(this).val().replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">");o[e(this).attr("name")]=value}});var p=k(o);if(l){var n=p.pop();if(n){e("form input[name=variation_id]").val(n.variation_id);f(n)}else{e(".variations select").val("")}}else{g(p)}}e(".variations select").change(function(){e("form input[name=variation_id]").val("");e(".single_variation_wrap").hide();e(".single_variation").text("");c();e(this).blur();if(e().uniform&&e.isFunction(e.uniform.update)){e.uniform.update()}}).focus(function(){c(e(this).attr("name"))}).change();if(woocommerce_params.is_cart==1){e("select#shipping_method").live("change",function(){var m=e("#shipping_method").val();e("div.cart_totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});var l={action:"woocommerce_update_shipping_method",security:woocommerce_params.update_shipping_method_nonce,shipping_method:m};e.post(woocommerce_params.ajax_url,l,function(n){e("div.cart_totals").replaceWith(n)})})}if(woocommerce_params.is_checkout==1||woocommerce_params.is_pay_page==1){var j;var h;function d(){if(h){h.abort()}var s=e("#shipping_method").val();var r=e("#billing_country").val();var p=e("#billing_state").val();var l=e("input#billing_postcode").val();if(e("#shiptobilling input").is(":checked")||e("#shiptobilling input").size()==0){var m=e("#billing_country").val();var o=e("#billing_state").val();var q=e("input#billing_postcode").val()}else{var m=e("#shipping_country").val();var o=e("#shipping_state").val();var q=e("input#shipping_postcode").val()}e("#order_methods, #order_review").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});var n={action:"woocommerce_update_order_review",security:woocommerce_params.update_order_review_nonce,shipping_method:s,country:r,state:p,postcode:l,s_country:m,s_state:o,s_postcode:q,post_data:e("form.checkout").serialize()};h=e.ajax({type:"POST",url:woocommerce_params.ajax_url,data:n,success:function(t){e("#order_methods, #order_review").remove();e("#order_review_heading").after(t);e("#order_review input[name=payment_method]:checked").click()}})}e("p.password, form.login, div.shipping_address").hide();e("input.show_password").change(function(){e("p.password").slideToggle()});e("a.showlogin").click(function(){e("form.login").slideToggle();return false});e("#shiptobilling input").change(function(){e("div.shipping_address").hide();if(!e(this).is(":checked")){e("div.shipping_address").slideDown()}}).change();if(woocommerce_params.option_guest_checkout=="yes"){e("div.create-account").hide();e("input#createaccount").change(function(){e("div.create-account").hide();if(e(this).is(":checked")){e("div.create-account").slideDown()}}).change()}e(".payment_methods input.input-radio").live("click",function(){e("div.payment_box").hide();if(e(this).is(":checked")){e("div.payment_box."+e(this).attr("ID")).slideDown()}});e("#order_review input[name=payment_method]:checked").click();e("#shipping_method").live("change",function(){clearTimeout(j);d()});e("input#billing_country, input#billing_state, #billing_postcode, input#shipping_country, input#shipping_state, #shipping_postcode").live("keydown",function(){clearTimeout(j);j=setTimeout("update_checkout()","1000")});e("select#billing_country, select#billing_state, select#shipping_country, select#shipping_state, #shiptobilling input, .update_totals_on_change").live("change",function(){clearTimeout(j);d()});if(woocommerce_params.is_checkout==1){d()}e("form.checkout").submit(function(){var l=e(this);if(l.is(".processing")){return false}l.addClass("processing").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:0.6}});e.ajax({type:"POST",url:woocommerce_params.checkout_url,data:l.serialize(),success:function(n){e(".woocommerce_error, .woocommerce_message").remove();try{success=e.parseJSON(n);window.location=decodeURI(success.redirect)}catch(m){l.prepend(n);l.removeClass("processing").unblock();e("html, body").animate({scrollTop:(e("form.checkout").offset().top-100)},1000)}},dataType:"html"});return false})}}); \ No newline at end of file diff --git a/classes/checkout.class.php b/classes/checkout.class.php index 5213e559c0a..26a2b9a9160 100644 --- a/classes/checkout.class.php +++ b/classes/checkout.class.php @@ -34,48 +34,56 @@ class woocommerce_checkout { 'label' => __('First Name', 'woothemes'), 'placeholder' => __('First Name', 'woothemes'), 'required' => true, - 'class' => array('form-row-first') + 'class' => array('form-row-first'), + 'position' => 1, ), 'billing_last_name' => array( 'label' => __('Last Name', 'woothemes'), 'placeholder' => __('Last Name', 'woothemes'), 'required' => true, - 'class' => array('form-row-last') + 'class' => array('form-row-last'), + 'position' => 2, ), 'billing_company' => array( 'label' => __('Company', 'woothemes'), - 'placeholder' => __('Company', 'woothemes') + 'placeholder' => __('Company', 'woothemes'), + 'position' => 3, ), 'billing_address_1' => array( 'label' => __('Address', 'woothemes'), 'placeholder' => __('Address 1', 'woothemes'), 'required' => true, - 'class' => array('form-row-first') + 'class' => array('form-row-first'), + 'position' => 4, ), 'billing_address_2' => array( 'label' => __('Address 2', 'woothemes'), 'placeholder' => __('Address 2', 'woothemes'), 'class' => array('form-row-last'), - 'label_class' => array('hidden') + 'label_class' => array('hidden'), + 'position' => 5, ), 'billing_city' => array( 'label' => __('City', 'woothemes'), 'placeholder' => __('City', 'woothemes'), 'required' => true, - 'class' => array('form-row-first') + 'class' => array('form-row-first'), + 'position' => 6, ), 'billing_postcode' => array( 'label' => __('Postcode', 'woothemes'), 'placeholder' => __('Postcode', 'woothemes'), 'required' => true, - 'class' => array('form-row-last update_totals_on_change') + 'class' => array('form-row-last update_totals_on_change'), + 'position' => 7, ), 'billing_country' => array( 'type' => 'country', 'label' => __('Country', 'woothemes'), 'required' => true, 'class' => array('form-row-first update_totals_on_change'), - 'rel' => 'billing_state' + 'rel' => 'billing_state', + 'position' => 8, ), 'billing_state' => array( 'type' => 'state', @@ -83,19 +91,22 @@ class woocommerce_checkout { 'label' => __('State/County', 'woothemes'), 'required' => true, 'class' => array('form-row-last update_totals_on_change'), - 'rel' => 'billing_country' + 'rel' => 'billing_country', + 'position' => 9, ), 'billing_email' => array( 'label' => __('Email Address', 'woothemes'), 'placeholder' => __('you@yourdomain.com', 'woothemes'), 'required' => true, - 'class' => array('form-row-first') + 'class' => array('form-row-first'), + 'position' => 10, ), 'billing_phone' => array( 'label' => __('Phone', 'woothemes'), 'placeholder' => __('Phone number', 'woothemes'), 'required' => true, - 'class' => array('form-row-last') + 'class' => array('form-row-last'), + 'position' => 11, ) )); diff --git a/classes/countries.class.php b/classes/countries.class.php index ef49e9c1786..475adf4ac07 100644 --- a/classes/countries.class.php +++ b/classes/countries.class.php @@ -35,7 +35,7 @@ class woocommerce_countries { 'AT' => __('Austria', 'woothemes'), 'AU' => __('Australia', 'woothemes'), 'AW' => __('Aruba', 'woothemes'), - 'AX' => __('Aland Islands', 'woothemes'), + 'AX' => __('Aaland Islands', 'woothemes'), 'AZ' => __('Azerbaijan', 'woothemes'), 'BA' => __('Bosnia and Herzegovina', 'woothemes'), 'BB' => __('Barbados', 'woothemes'), @@ -114,7 +114,6 @@ class woocommerce_countries { 'GW' => __('Guinea-Bissau', 'woothemes'), 'GY' => __('Guyana', 'woothemes'), 'HK' => __('Hong Kong S.A.R., China', 'woothemes'), - //'HM' => __('Heard Island and McDonald Islands', 'woothemes'), // Uninhabitted :) 'HN' => __('Honduras', 'woothemes'), 'HR' => __('Croatia', 'woothemes'), 'HT' => __('Haiti', 'woothemes'), @@ -325,6 +324,7 @@ class woocommerce_countries { 'SK' => __('Saskatchewan', 'woothemes') , 'YT' => __('Yukon Territory', 'woothemes') ), + 'DE' => array(), 'US' => array( 'AL' => __('Alabama', 'woothemes') , 'AK' => __('Alaska', 'woothemes') , diff --git a/classes/localisation.class.php b/classes/localisation.class.php new file mode 100644 index 00000000000..3f67fb7ab4e --- /dev/null +++ b/classes/localisation.class.php @@ -0,0 +1,55 @@ +locales => array( + + 'DE' => array( + 'billing_fields'=> array( + 'billing_city' => array( + 'class' => array('form-row-last'), + 'position' => 7, + ), + 'billing_postcode' => array( + 'class' => array('form-row-first update_totals_on_change'), + 'position' => 6 + ), + 'billing_state' => array( + 'required' => false + ), + ) + ), + 'shipping_fields'=> array( + 'shipping_city' => array( + 'class' => array('form-row-last'), + 'position' => 7, + ), + 'shipping_postcode' => array( + 'class' => array('form-row-first update_totals_on_change'), + 'position' => 6 + ), + 'shipping_state' => array( + 'required' => false + ), + ) + ) + ); + } + +} \ No newline at end of file