Skip to content

Commit 6602738

Browse files
committed
rename redemption_params to avoid conflict
1 parent f2b6767 commit 6602738

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/storefront/liana/Observer/LianaObserver.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class LianaObserver
1717
{
1818
protected static $display;
19-
protected static $redemption;
19+
protected static $redemption_params;
2020
protected static $tiers;
2121

2222
/**
@@ -46,8 +46,8 @@ class LianaObserver
4646
public static function init($display)
4747
{
4848
self::$display = $display;
49-
self::$redemption = $display['redemption'];
5049
self::$tiers = $display['tiers'];
50+
self::$redemption_params = $display['redemption'];
5151
self::$redemption_cache = array();
5252

5353
add_filter('woocommerce_get_shop_coupon_data', array(__CLASS__, 'getWooCouponData'), 10, 2);
@@ -129,11 +129,8 @@ protected static function getAllowedDiscount($account, $order_value, $is_notice
129129

130130
$max_amount = $order_value;
131131

132-
if (
133-
isset(self::$redemption) && isset(self::$redemption['min_beans'])
134-
&& isset(self::$redemption['max_percentage'])
135-
) {
136-
$min_beans = self::$redemption['min_beans'];
132+
if (isset(self::$redemption_params['min_beans']) && isset(self::$redemption_params['max_percentage'])) {
133+
$min_beans = self::$redemption_params['min_beans'];
137134
if ($account_beans < $min_beans) {
138135
if ($is_notice) {
139136
$message = strtr(
@@ -149,7 +146,7 @@ protected static function getAllowedDiscount($account, $order_value, $is_notice
149146
return null;
150147
}
151148

152-
$percent_discount = self::$redemption['max_percentage'];
149+
$percent_discount = self::$redemption_params['max_percentage'];
153150
if ($percent_discount < 100) {
154151
$max_amount = (1.0 * $order_value * $percent_discount) / 100;
155152
if ($is_notice && $max_amount < $account_beans_value) {

src/storefront/liana/Observer/LianaProductObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static function init($display)
1212
{
1313
parent::init($display);
1414

15-
if (empty(self::$redemption['reward_exclusive_product_cms_ids'])) {
15+
if (empty(self::$redemption_params['exclusive_product_cms_ids'])) {
1616
return;
1717
}
1818

@@ -215,7 +215,7 @@ public static function extractProductIds()
215215
function ($value) {
216216
return (int)$value;
217217
},
218-
self::$redemption['reward_exclusive_product_cms_ids']
218+
self::$redemption_params['exclusive_product_cms_ids']
219219
);
220220
}
221221
}

0 commit comments

Comments
 (0)