Version Description
- 24/05/2016 =
- Dev - PRICES & CURRENCIES - Product Price by Formula - No more using
namespace
(as it required PHP 5 >
Download this release
Release Info
Developer | algoritmika |
Plugin | Booster for WooCommerce |
Version | 2.5.1 |
Comparing to | |
See all releases |
Code changes from version 2.5.0 to 2.5.1
- includes/class-wcj-product-open-pricing.php +30 -19
- includes/class-wcj-product-price-by-formula.php +3 -3
- includes/lib/PHPMathParser/Expressions.php +16 -16
- includes/lib/PHPMathParser/Math.php +13 -13
- includes/lib/PHPMathParser/Stack.php +2 -2
- includes/lib/PHPMathParser/TerminalExpression.php +12 -12
- includes/price-by-country/class-wcj-price-by-country-core.php +12 -8
- includes/shortcodes/class-wcj-order-items-shortcodes.php +5 -2
- readme.txt +7 -1
- woocommerce-jetpack.php +2 -2
includes/class-wcj-product-open-pricing.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Open Pricing class.
|
6 |
*
|
7 |
-
* @version 2.5.
|
8 |
* @since 2.4.8
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -322,42 +322,45 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
|
|
322 |
/**
|
323 |
* add_open_price_input_field_to_frontend.
|
324 |
*
|
325 |
-
* @version 2.
|
326 |
* @since 2.4.8
|
327 |
*/
|
328 |
function add_open_price_input_field_to_frontend() {
|
329 |
$the_product = wc_get_product();
|
330 |
if ( $this->is_open_price_product( $the_product ) ) {
|
|
|
331 |
$title = get_option( 'wcj_product_open_price_label_frontend', __( 'Name Your Price', 'woocommerce-jetpack' ) );
|
|
|
|
|
332 |
// $placeholder = $the_product->get_price();
|
333 |
-
$value = ( isset( $_POST['wcj_open_price'] ) ) ?
|
334 |
-
$_POST['wcj_open_price'] :
|
335 |
-
get_post_meta( $the_product->id, '_' . 'wcj_product_open_price_default_price', true );
|
336 |
$custom_attributes = '';
|
337 |
$wc_price_decimals = wc_get_price_decimals();
|
338 |
if ( $wc_price_decimals > 0 ) {
|
339 |
$custom_attributes .= sprintf( 'step="0.%0' . ( $wc_price_decimals ) . 'd" ', 1 );
|
340 |
}
|
341 |
-
|
342 |
-
|
343 |
-
. '
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
354 |
}
|
355 |
}
|
356 |
|
357 |
/**
|
358 |
* get_settings.
|
359 |
*
|
360 |
-
* @version 2.
|
361 |
* @since 2.4.8
|
362 |
*/
|
363 |
function get_settings() {
|
@@ -374,6 +377,14 @@ class WCJ_Product_Open_Pricing extends WCJ_Module {
|
|
374 |
'type' => 'text',
|
375 |
'css' => 'width:250px;',
|
376 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
array(
|
378 |
'title' => __( 'Message on Empty Price', 'woocommerce-jetpack' ),
|
379 |
'id' => 'wcj_product_open_price_messages_required',
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Open Pricing class.
|
6 |
*
|
7 |
+
* @version 2.5.1
|
8 |
* @since 2.4.8
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
322 |
/**
|
323 |
* add_open_price_input_field_to_frontend.
|
324 |
*
|
325 |
+
* @version 2.5.1
|
326 |
* @since 2.4.8
|
327 |
*/
|
328 |
function add_open_price_input_field_to_frontend() {
|
329 |
$the_product = wc_get_product();
|
330 |
if ( $this->is_open_price_product( $the_product ) ) {
|
331 |
+
// Title
|
332 |
$title = get_option( 'wcj_product_open_price_label_frontend', __( 'Name Your Price', 'woocommerce-jetpack' ) );
|
333 |
+
// Input field
|
334 |
+
$value = ( isset( $_POST['wcj_open_price'] ) ) ? $_POST['wcj_open_price'] : get_post_meta( $the_product->id, '_' . 'wcj_product_open_price_default_price', true );
|
335 |
// $placeholder = $the_product->get_price();
|
|
|
|
|
|
|
336 |
$custom_attributes = '';
|
337 |
$wc_price_decimals = wc_get_price_decimals();
|
338 |
if ( $wc_price_decimals > 0 ) {
|
339 |
$custom_attributes .= sprintf( 'step="0.%0' . ( $wc_price_decimals ) . 'd" ', 1 );
|
340 |
}
|
341 |
+
$input_field = '<input '
|
342 |
+
. 'type="number" '
|
343 |
+
. 'class="text" '
|
344 |
+
. 'style="width:75px;text-align:center;" '
|
345 |
+
. 'name="wcj_open_price" '
|
346 |
+
. 'id="wcj_open_price" '
|
347 |
+
// . 'placeholder="' . $placeholder . '" '
|
348 |
+
. 'value="' . $value . '" '
|
349 |
+
. $custom_attributes . '>';
|
350 |
+
// Currency symbol
|
351 |
+
$currency_symbol = get_woocommerce_currency_symbol();
|
352 |
+
echo str_replace(
|
353 |
+
array( '%frontend_label%', '%open_price_input%', '%currency_symbol%' ),
|
354 |
+
array( $title, $input_field, $currency_symbol ),
|
355 |
+
get_option( 'wcj_product_open_price_frontend_template', '<label for="wcj_open_price">%frontend_label%</label> %open_price_input% %currency_symbol%' )
|
356 |
+
);
|
357 |
}
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
* get_settings.
|
362 |
*
|
363 |
+
* @version 2.5.1
|
364 |
* @since 2.4.8
|
365 |
*/
|
366 |
function get_settings() {
|
377 |
'type' => 'text',
|
378 |
'css' => 'width:250px;',
|
379 |
),
|
380 |
+
array(
|
381 |
+
'title' => __( 'Frontend Template', 'woocommerce-jetpack' ),
|
382 |
+
'desc_tip' => __( 'Here you can use' ) . ': ' . '%frontend_label%, %open_price_input%, %currency_symbol%',
|
383 |
+
'id' => 'wcj_product_open_price_frontend_template',
|
384 |
+
'default' => '<label for="wcj_open_price">%frontend_label%</label> %open_price_input% %currency_symbol%',
|
385 |
+
'type' => 'textarea',
|
386 |
+
'css' => 'min-width:300px;width:50%;',
|
387 |
+
),
|
388 |
array(
|
389 |
'title' => __( 'Message on Empty Price', 'woocommerce-jetpack' ),
|
390 |
'id' => 'wcj_product_open_price_messages_required',
|
includes/class-wcj-product-price-by-formula.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Price by Formula class.
|
6 |
*
|
7 |
-
* @version 2.5.
|
8 |
* @since 2.5.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
@@ -79,7 +79,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
|
|
79 |
/**
|
80 |
* change_price_by_formula.
|
81 |
*
|
82 |
-
* @version 2.5.
|
83 |
* @since 2.5.0
|
84 |
*/
|
85 |
function change_price_by_formula( $price, $_product, $output_errors = false ) {
|
@@ -98,7 +98,7 @@ class WCJ_Product_Price_by_Formula extends WCJ_Module {
|
|
98 |
$get_price_method = 'get_price_' . get_option( 'woocommerce_tax_display_shop' ) . 'uding_tax';
|
99 |
return $_product->$get_price_method();
|
100 |
}
|
101 |
-
$math = new PHPMathParser\
|
102 |
$math->registerVariable( 'x', $price );
|
103 |
for ( $i = 1; $i <= $total_params; $i++ ) {
|
104 |
$the_param = ( $is_per_product )
|
4 |
*
|
5 |
* The WooCommerce Jetpack Product Price by Formula class.
|
6 |
*
|
7 |
+
* @version 2.5.1
|
8 |
* @since 2.5.0
|
9 |
* @author Algoritmika Ltd.
|
10 |
*/
|
79 |
/**
|
80 |
* change_price_by_formula.
|
81 |
*
|
82 |
+
* @version 2.5.1
|
83 |
* @since 2.5.0
|
84 |
*/
|
85 |
function change_price_by_formula( $price, $_product, $output_errors = false ) {
|
98 |
$get_price_method = 'get_price_' . get_option( 'woocommerce_tax_display_shop' ) . 'uding_tax';
|
99 |
return $_product->$get_price_method();
|
100 |
}
|
101 |
+
$math = new /* PHPMathParser\ */Alg_Math();
|
102 |
$math->registerVariable( 'x', $price );
|
103 |
for ( $i = 1; $i <= $total_params; $i++ ) {
|
104 |
$the_param = ( $is_per_product )
|
includes/lib/PHPMathParser/Expressions.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace PHPMathParser;
|
4 |
|
5 |
-
class
|
6 |
|
7 |
protected $precedence = 6;
|
8 |
|
9 |
-
public function operate(
|
10 |
}
|
11 |
|
12 |
public function getPrecedence() {
|
@@ -27,15 +27,15 @@ class Parenthesis extends TerminalExpression {
|
|
27 |
|
28 |
}
|
29 |
|
30 |
-
class
|
31 |
|
32 |
-
public function operate(
|
33 |
return $this->value;
|
34 |
}
|
35 |
|
36 |
}
|
37 |
|
38 |
-
abstract class
|
39 |
|
40 |
protected $precedence = 0;
|
41 |
protected $leftAssoc = true;
|
@@ -54,21 +54,21 @@ abstract class Operator extends TerminalExpression {
|
|
54 |
|
55 |
}
|
56 |
|
57 |
-
class
|
58 |
|
59 |
protected $precedence = 4;
|
60 |
|
61 |
-
public function operate(
|
62 |
return $stack->pop()->operate($stack) + $stack->pop()->operate($stack);
|
63 |
}
|
64 |
|
65 |
}
|
66 |
|
67 |
-
class
|
68 |
|
69 |
protected $precedence = 4;
|
70 |
|
71 |
-
public function operate(
|
72 |
$left = $stack->pop()->operate($stack);
|
73 |
$right = $stack->pop()->operate($stack);
|
74 |
return $right - $left;
|
@@ -76,21 +76,21 @@ class Subtraction extends Operator {
|
|
76 |
|
77 |
}
|
78 |
|
79 |
-
class
|
80 |
|
81 |
protected $precedence = 5;
|
82 |
|
83 |
-
public function operate(
|
84 |
return $stack->pop()->operate($stack) * $stack->pop()->operate($stack);
|
85 |
}
|
86 |
|
87 |
}
|
88 |
|
89 |
-
class
|
90 |
|
91 |
protected $precedence = 5;
|
92 |
|
93 |
-
public function operate(
|
94 |
$left = $stack->pop()->operate($stack);
|
95 |
$right = $stack->pop()->operate($stack);
|
96 |
return $right / $left;
|
@@ -98,11 +98,11 @@ class Division extends Operator {
|
|
98 |
|
99 |
}
|
100 |
|
101 |
-
class
|
102 |
|
103 |
protected $precedence = 5;
|
104 |
|
105 |
-
public function operate(
|
106 |
$left = $stack->pop()->operate($stack);
|
107 |
$right = $stack->pop()->operate($stack);
|
108 |
return pow($left,$right);
|
1 |
<?php
|
2 |
|
3 |
+
//namespace PHPMathParser;
|
4 |
|
5 |
+
class Alg_Parenthesis extends Alg_TerminalExpression {
|
6 |
|
7 |
protected $precedence = 6;
|
8 |
|
9 |
+
public function operate(Alg_Stack $stack) {
|
10 |
}
|
11 |
|
12 |
public function getPrecedence() {
|
27 |
|
28 |
}
|
29 |
|
30 |
+
class Alg_Number extends Alg_TerminalExpression {
|
31 |
|
32 |
+
public function operate(Alg_Stack $stack) {
|
33 |
return $this->value;
|
34 |
}
|
35 |
|
36 |
}
|
37 |
|
38 |
+
abstract class Alg_Operator extends Alg_TerminalExpression {
|
39 |
|
40 |
protected $precedence = 0;
|
41 |
protected $leftAssoc = true;
|
54 |
|
55 |
}
|
56 |
|
57 |
+
class Alg_Addition extends Alg_Operator {
|
58 |
|
59 |
protected $precedence = 4;
|
60 |
|
61 |
+
public function operate(Alg_Stack $stack) {
|
62 |
return $stack->pop()->operate($stack) + $stack->pop()->operate($stack);
|
63 |
}
|
64 |
|
65 |
}
|
66 |
|
67 |
+
class Alg_Subtraction extends Alg_Operator {
|
68 |
|
69 |
protected $precedence = 4;
|
70 |
|
71 |
+
public function operate(Alg_Stack $stack) {
|
72 |
$left = $stack->pop()->operate($stack);
|
73 |
$right = $stack->pop()->operate($stack);
|
74 |
return $right - $left;
|
76 |
|
77 |
}
|
78 |
|
79 |
+
class Alg_Multiplication extends Alg_Operator {
|
80 |
|
81 |
protected $precedence = 5;
|
82 |
|
83 |
+
public function operate(Alg_Stack $stack) {
|
84 |
return $stack->pop()->operate($stack) * $stack->pop()->operate($stack);
|
85 |
}
|
86 |
|
87 |
}
|
88 |
|
89 |
+
class Alg_Division extends Alg_Operator {
|
90 |
|
91 |
protected $precedence = 5;
|
92 |
|
93 |
+
public function operate(Alg_Stack $stack) {
|
94 |
$left = $stack->pop()->operate($stack);
|
95 |
$right = $stack->pop()->operate($stack);
|
96 |
return $right / $left;
|
98 |
|
99 |
}
|
100 |
|
101 |
+
class Alg_Power extends Alg_Operator {
|
102 |
|
103 |
protected $precedence = 5;
|
104 |
|
105 |
+
public function operate(Alg_Stack $stack) {
|
106 |
$left = $stack->pop()->operate($stack);
|
107 |
$right = $stack->pop()->operate($stack);
|
108 |
return pow($left,$right);
|
includes/lib/PHPMathParser/Math.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace PHPMathParser;
|
4 |
|
5 |
require_once 'Stack.php';
|
6 |
require_once 'TerminalExpression.php';
|
7 |
require_once 'Expressions.php';
|
8 |
|
9 |
-
class
|
10 |
|
11 |
protected $variables = array();
|
12 |
|
@@ -17,11 +17,11 @@ class Math {
|
|
17 |
|
18 |
public function parse($string) {
|
19 |
$tokens = $this->tokenize($string);
|
20 |
-
$output = new
|
21 |
-
$operators = new
|
22 |
foreach ($tokens as $token) {
|
23 |
$token = $this->extractVariables($token);
|
24 |
-
$expression =
|
25 |
if ($expression->isOperator()) {
|
26 |
$this->parseOperator($expression, $output, $operators);
|
27 |
} elseif ($expression->isParenthesis()) {
|
@@ -32,7 +32,7 @@ class Math {
|
|
32 |
}
|
33 |
while (($op = $operators->pop())) {
|
34 |
if ($op->isParenthesis()) {
|
35 |
-
throw new
|
36 |
}
|
37 |
$output->push($op);
|
38 |
}
|
@@ -43,11 +43,11 @@ class Math {
|
|
43 |
$this->variables[$name] = $value;
|
44 |
}
|
45 |
|
46 |
-
public function run(
|
47 |
while (($operator = $stack->pop()) && $operator->isOperator()) {
|
48 |
$value = $operator->operate($stack);
|
49 |
if (!is_null($value)) {
|
50 |
-
$stack->push(
|
51 |
}
|
52 |
}
|
53 |
return $operator ? $operator->render() : $this->render($stack);
|
@@ -61,7 +61,7 @@ class Math {
|
|
61 |
return $token;
|
62 |
}
|
63 |
|
64 |
-
protected function render(
|
65 |
$output = '';
|
66 |
while (($el = $stack->pop())) {
|
67 |
$output .= $el->render();
|
@@ -69,10 +69,10 @@ class Math {
|
|
69 |
if ($output) {
|
70 |
return $output;
|
71 |
}
|
72 |
-
throw new
|
73 |
}
|
74 |
|
75 |
-
protected function parseParenthesis(
|
76 |
if ($expression->isOpen()) {
|
77 |
$operators->push($expression);
|
78 |
} else {
|
@@ -86,12 +86,12 @@ class Math {
|
|
86 |
}
|
87 |
}
|
88 |
if (!$clean) {
|
89 |
-
throw new
|
90 |
}
|
91 |
}
|
92 |
}
|
93 |
|
94 |
-
protected function parseOperator(
|
95 |
$end = $operators->poke();
|
96 |
if (!$end) {
|
97 |
$operators->push($expression);
|
1 |
<?php
|
2 |
|
3 |
+
//namespace PHPMathParser;
|
4 |
|
5 |
require_once 'Stack.php';
|
6 |
require_once 'TerminalExpression.php';
|
7 |
require_once 'Expressions.php';
|
8 |
|
9 |
+
class Alg_Math {
|
10 |
|
11 |
protected $variables = array();
|
12 |
|
17 |
|
18 |
public function parse($string) {
|
19 |
$tokens = $this->tokenize($string);
|
20 |
+
$output = new Alg_Stack();
|
21 |
+
$operators = new Alg_Stack();
|
22 |
foreach ($tokens as $token) {
|
23 |
$token = $this->extractVariables($token);
|
24 |
+
$expression = Alg_TerminalExpression::factory($token);
|
25 |
if ($expression->isOperator()) {
|
26 |
$this->parseOperator($expression, $output, $operators);
|
27 |
} elseif ($expression->isParenthesis()) {
|
32 |
}
|
33 |
while (($op = $operators->pop())) {
|
34 |
if ($op->isParenthesis()) {
|
35 |
+
throw new RuntimeException('Mismatched Parenthesis');
|
36 |
}
|
37 |
$output->push($op);
|
38 |
}
|
43 |
$this->variables[$name] = $value;
|
44 |
}
|
45 |
|
46 |
+
public function run(Alg_Stack $stack) {
|
47 |
while (($operator = $stack->pop()) && $operator->isOperator()) {
|
48 |
$value = $operator->operate($stack);
|
49 |
if (!is_null($value)) {
|
50 |
+
$stack->push(Alg_TerminalExpression::factory($value));
|
51 |
}
|
52 |
}
|
53 |
return $operator ? $operator->render() : $this->render($stack);
|
61 |
return $token;
|
62 |
}
|
63 |
|
64 |
+
protected function render(Alg_Stack $stack) {
|
65 |
$output = '';
|
66 |
while (($el = $stack->pop())) {
|
67 |
$output .= $el->render();
|
69 |
if ($output) {
|
70 |
return $output;
|
71 |
}
|
72 |
+
throw new RuntimeException('Could not render output');
|
73 |
}
|
74 |
|
75 |
+
protected function parseParenthesis(Alg_TerminalExpression $expression, Alg_Stack $output, Alg_Stack $operators) {
|
76 |
if ($expression->isOpen()) {
|
77 |
$operators->push($expression);
|
78 |
} else {
|
86 |
}
|
87 |
}
|
88 |
if (!$clean) {
|
89 |
+
throw new RuntimeException('Mismatched Parenthesis');
|
90 |
}
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
protected function parseOperator(Alg_TerminalExpression $expression, Alg_Stack $output, Alg_Stack $operators) {
|
95 |
$end = $operators->poke();
|
96 |
if (!$end) {
|
97 |
$operators->push($expression);
|
includes/lib/PHPMathParser/Stack.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace PHPMathParser;
|
4 |
|
5 |
-
class
|
6 |
|
7 |
protected $data = array();
|
8 |
|
1 |
<?php
|
2 |
|
3 |
+
//namespace PHPMathParser;
|
4 |
|
5 |
+
class Alg_Stack {
|
6 |
|
7 |
protected $data = array();
|
8 |
|
includes/lib/PHPMathParser/TerminalExpression.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
namespace PHPMathParser;
|
4 |
|
5 |
-
abstract class
|
6 |
|
7 |
protected $value = '';
|
8 |
|
@@ -13,27 +13,27 @@ abstract class TerminalExpression {
|
|
13 |
public static function factory($value) {
|
14 |
|
15 |
// var_dump($value);
|
16 |
-
if (is_object($value) && $value instanceof
|
17 |
return $value;
|
18 |
} elseif (is_numeric($value)) {
|
19 |
-
return new
|
20 |
} elseif ($value == '+') {
|
21 |
-
return new
|
22 |
} elseif ($value == '-') {
|
23 |
-
return new
|
24 |
} elseif ($value == '*') {
|
25 |
-
return new
|
26 |
} elseif ($value == '/') {
|
27 |
-
return new
|
28 |
} elseif (in_array($value, array('(', ')'))) {
|
29 |
-
return new
|
30 |
} elseif ($value == '^') {
|
31 |
-
return new
|
32 |
}
|
33 |
-
throw new
|
34 |
}
|
35 |
|
36 |
-
abstract public function operate(
|
37 |
|
38 |
public function isOperator() {
|
39 |
return false;
|
1 |
<?php
|
2 |
|
3 |
+
//namespace PHPMathParser;
|
4 |
|
5 |
+
abstract class Alg_TerminalExpression {
|
6 |
|
7 |
protected $value = '';
|
8 |
|
13 |
public static function factory($value) {
|
14 |
|
15 |
// var_dump($value);
|
16 |
+
if (is_object($value) && $value instanceof Alg_TerminalExpression) {
|
17 |
return $value;
|
18 |
} elseif (is_numeric($value)) {
|
19 |
+
return new Alg_Number($value);
|
20 |
} elseif ($value == '+') {
|
21 |
+
return new Alg_Addition($value);
|
22 |
} elseif ($value == '-') {
|
23 |
+
return new Alg_Subtraction($value);
|
24 |
} elseif ($value == '*') {
|
25 |
+
return new Alg_Multiplication($value);
|
26 |
} elseif ($value == '/') {
|
27 |
+
return new Alg_Division($value);
|
28 |
} elseif (in_array($value, array('(', ')'))) {
|
29 |
+
return new Alg_Parenthesis($value);
|
30 |
} elseif ($value == '^') {
|
31 |
+
return new Alg_Power($value);
|
32 |
}
|
33 |
+
throw new Exception('Undefined Value ' . $value);
|
34 |
}
|
35 |
|
36 |
+
abstract public function operate(Alg_Stack $stack);
|
37 |
|
38 |
public function isOperator() {
|
39 |
return false;
|
includes/price-by-country/class-wcj-price-by-country-core.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Price by Country Core class.
|
6 |
*
|
7 |
-
* @version 2.5.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -97,17 +97,21 @@ class WCJ_Price_by_Country_Core {
|
|
97 |
/**
|
98 |
* get_customer_country_by_ip.
|
99 |
*
|
100 |
-
* @version 2.5.
|
101 |
* @since 2.5.0
|
102 |
*/
|
103 |
function get_customer_country_by_ip() {
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
-
return ( isset( $location['country'] ) ) ? $location['country'] : null;
|
111 |
}
|
112 |
|
113 |
/**
|
4 |
*
|
5 |
* The WooCommerce Jetpack Price by Country Core class.
|
6 |
*
|
7 |
+
* @version 2.5.1
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
97 |
/**
|
98 |
* get_customer_country_by_ip.
|
99 |
*
|
100 |
+
* @version 2.5.1
|
101 |
* @since 2.5.0
|
102 |
*/
|
103 |
function get_customer_country_by_ip() {
|
104 |
+
if ( class_exists( 'WC_Geolocation' ) ) {
|
105 |
+
// Get the country by IP
|
106 |
+
$location = WC_Geolocation::geolocate_ip();
|
107 |
+
// Base fallback
|
108 |
+
if ( empty( $location['country'] ) ) {
|
109 |
+
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
|
110 |
+
}
|
111 |
+
return ( isset( $location['country'] ) ) ? $location['country'] : null;
|
112 |
+
} else {
|
113 |
+
return null;
|
114 |
}
|
|
|
115 |
}
|
116 |
|
117 |
/**
|
includes/shortcodes/class-wcj-order-items-shortcodes.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* The WooCommerce Jetpack Order Items Shortcodes class.
|
6 |
*
|
7 |
-
* @version 2.5.
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
@@ -129,7 +129,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
|
|
129 |
/**
|
130 |
* wcj_order_items_table.
|
131 |
*
|
132 |
-
* @version 2.5.
|
133 |
*/
|
134 |
function wcj_order_items_table( $atts, $content = '' ) {
|
135 |
|
@@ -317,6 +317,9 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
|
|
317 |
$line_tax_percent = apply_filters( 'wcj_line_tax_percent', $line_tax_percent, $the_order );
|
318 |
$data[ $item_counter ][] = sprintf( $atts['tax_percent_format'], $line_tax_percent );
|
319 |
break; */
|
|
|
|
|
|
|
320 |
default:
|
321 |
$data[ $item_counter ][] = ''; //$column;
|
322 |
}
|
4 |
*
|
5 |
* The WooCommerce Jetpack Order Items Shortcodes class.
|
6 |
*
|
7 |
+
* @version 2.5.1
|
8 |
* @author Algoritmika Ltd.
|
9 |
*/
|
10 |
|
129 |
/**
|
130 |
* wcj_order_items_table.
|
131 |
*
|
132 |
+
* @version 2.5.1
|
133 |
*/
|
134 |
function wcj_order_items_table( $atts, $content = '' ) {
|
135 |
|
317 |
$line_tax_percent = apply_filters( 'wcj_line_tax_percent', $line_tax_percent, $the_order );
|
318 |
$data[ $item_counter ][] = sprintf( $atts['tax_percent_format'], $line_tax_percent );
|
319 |
break; */
|
320 |
+
case 'item_weight':
|
321 |
+
$data[ $item_counter ][] = ( true === $item['is_custom'] || ! is_object( $the_product ) ) ? '' : $the_product->get_weight();
|
322 |
+
break;
|
323 |
default:
|
324 |
$data[ $item_counter ][] = ''; //$column;
|
325 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: algoritmika,anbinder
|
|
3 |
Tags: woocommerce,booster for woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,email pdf invoice,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,vat,gateway by country,price by country,currency switcher
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 2.5.
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -121,6 +121,12 @@ To unlock all Booster for WooCommerce features, please install additional [Boost
|
|
121 |
|
122 |
== Changelog ==
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
= 2.5.0 - 23/05/2016 =
|
125 |
* Dev - Multisite support added.
|
126 |
* Dev - `is_super_admin()` replaced with `wcj_is_user_role()`.
|
3 |
Tags: woocommerce,booster for woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,email pdf invoice,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,vat,gateway by country,price by country,currency switcher
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 2.5.1
|
7 |
License: GNU General Public License v3.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 2.5.1 - 24/05/2016 =
|
125 |
+
* Dev - PRICES & CURRENCIES - Product Price by Formula - No more using `namespace` (as it required PHP 5 >= 5.3.0).
|
126 |
+
* Dev - PRICES & CURRENCIES - Product Open Pricing (Name Your Price) - "Frontend Template" option added.
|
127 |
+
* Dev - PRICES & CURRENCIES - Prices and Currencies by Country - get_customer_country_by_ip() - Check for if `WC_Geolocation` class exists added.
|
128 |
+
* Dev - Shortcodes - Orders - `[wcj_order_items_table]` - `item_weight` column added.
|
129 |
+
|
130 |
= 2.5.0 - 23/05/2016 =
|
131 |
* Dev - Multisite support added.
|
132 |
* Dev - `is_super_admin()` replaced with `wcj_is_user_role()`.
|
woocommerce-jetpack.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: http://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
-
Version: 2.5.
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Text Domain: woocommerce-jetpack
|
@@ -39,7 +39,7 @@ final class WC_Jetpack {
|
|
39 |
* @var string
|
40 |
* @since 2.4.7
|
41 |
*/
|
42 |
-
public $version = '2.5.
|
43 |
|
44 |
/**
|
45 |
* @var WC_Jetpack The single instance of the class
|
3 |
Plugin Name: Booster for WooCommerce
|
4 |
Plugin URI: http://booster.io
|
5 |
Description: Supercharge your WooCommerce site with these awesome powerful features.
|
6 |
+
Version: 2.5.1
|
7 |
Author: Algoritmika Ltd
|
8 |
Author URI: http://www.algoritmika.com
|
9 |
Text Domain: woocommerce-jetpack
|
39 |
* @var string
|
40 |
* @since 2.4.7
|
41 |
*/
|
42 |
+
public $version = '2.5.1';
|
43 |
|
44 |
/**
|
45 |
* @var WC_Jetpack The single instance of the class
|