Skip to content
Snippets Groups Projects
Commit 016f92ea authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V1.1.2: Fix UK postcodes in the advanced version

parent 20c552b5
Branches
Tags V1.1.2
No related merge requests found
BASE=shipping-by-rules
PLATTFORM=woocommerce
VENDOR=opentools
VERSION=1.1.1
VERSION=1.1.2
DIR = $(shell pwd)
SVNDIR=wordpress-plugin-svn
......
......@@ -29,6 +29,7 @@ class RulesShippingFrameworkWooCommerceAdvanced extends RulesShippingFrameworkWo
}
protected function getOrderAddress ($cart, $method) {
$data = parent::getOrderAddress($cart, $method);
$address = $cart['destination'];
$zip = isset($address['postcode'])?trim($address['postcode']):'';
if (isset($zip) && $zip!='') {
$data = array_merge($data, $this->getAddressZIP($zip));
......
......@@ -287,6 +287,14 @@ class RulesShippingFramework {
return array();
}
protected function getDebugVariables ($cart, $products, $method) {
return array(
'debug_cart'=> print_r($cart,1),
'debug_products' => print_r($products, 1),
);
}
/**
* Extract information about non-numerical zip codes (UK and Canada) from the postal code
*/
......@@ -349,7 +357,8 @@ class RulesShippingFramework {
$this->getOrderAddress ($cart, $method),
// Add Total/Min/Max weight and dimension variables:
$this->getOrderWeights ($cart, $products, $method),
$this->getOrderDimensions ($cart, $products, $method)
$this->getOrderDimensions ($cart, $products, $method),
$this->getDebugVariables ($cart, $products, $method)
);
// Let child classes update the $cartvals array, or add new variables
$this->addCustomCartValues($cart, $products, $method, $cartvals);
......@@ -906,8 +915,11 @@ class ShippingRule {
return $varname;
} elseif ($varname=='values') {
return $vals;
} elseif ($varname=='values_debug') {
return print_r($vals,1);
} elseif ($varname=='values_debug' || $varname='debug_values') {
$tmpvals = $vals;
unset($tmpvals['debug_cart']);
unset($tmpvals['debug_products']);
return print_r($tmpvals,1);
} else {
$this->framework->warning('OTSHIPMENT_RULES_EVALUATE_UNKNOWN_VALUE', $expr, $this->rulestring);
return null;
......
File added
File added
......@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Advanced Shipping By Rules
* Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
* Description: Define Shipping cost by very general and flexible (text-based) rules. The advanced version also provides mathematical expressions and functions
* Version: 1.1.1
* Version: 1.1.2
* Author: Open Tools, Reinhold Kainhofer
* Author URI: http://open-tools.net
* Text Domain: woocommerce-advanced-shipping-by-rules
......@@ -66,7 +66,7 @@ function otsr_addAccessCheckArg($downloadurl) {
* Main Shipping by Rules class, add filters and handling all other files.
*
* @class WooCommerce_Shipping_By_Rules_Advanced
* @version 1.1.1
* @version 1.1.2
* @author Reinhold Kainhofer
*/
class WooCommerce_Shipping_By_Rules_Advanced {
......@@ -76,7 +76,7 @@ class WooCommerce_Shipping_By_Rules_Advanced {
* @since 1.0.0
* @var string $version Plugin version number.
*/
public $version = '1.1.1';
public $version = '1.1.2';
/**
......
......@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Shipping By Rules
* Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
* Description: Define Shipping cost by very general and flexible (text-based) rules.
* Version: 1.1.1
* Version: 1.1.2
* Author: Open Tools, Reinhold Kainhofer
* Author URI: http://open-tools.net
* Text Domain: woocommerce-shipping-by-rules
......@@ -39,7 +39,7 @@
* Main Shipping by Rules class, add filters and handling all other files.
*
* @class WooCommerce_Shipping_By_Rules
* @version 1.1.1
* @version 1.1.2
* @author Reinhold Kainhofer
*/
class WooCommerce_Shipping_By_Rules {
......@@ -49,7 +49,7 @@ class WooCommerce_Shipping_By_Rules {
* @since 1.0.0
* @var string $version Plugin version number.
*/
public $version = '1.1.1';
public $version = '1.1.2';
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment