Skip to content

Commit 5cf3cdc

Browse files
committed
bug fix
bug fix bug fix
1 parent 93f6bb9 commit 5cf3cdc

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

Helper/Config.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,19 @@ public function isRewardDropDownEnable()
495495
*/
496496
public function isModuleEnabled()
497497
{
498-
return $this->getConfig(self::XML_PATH_LOYALTY_REWARDS_ACTIVE) ? true : false;
498+
if($this->getConfig(self::XML_PATH_LOYALTY_REWARDS_ACTIVE)) {
499+
if(!$this->isAutoEnrollmentEnabled()) {
500+
$customerId = $this->customerSession->create()->getCustomerId();
501+
if ($customerId) {
502+
$zinreloOptedIn = $this->getOptInCustomAttributeValue($customerId);
503+
if (!$zinreloOptedIn) {
504+
return false;
505+
}
506+
}
507+
}
508+
return true;
509+
}
510+
return false;
499511
}
500512

501513
/**
@@ -700,7 +712,7 @@ public function getRedeemRules()
700712
"reward_id" => $rule["reward_id"],
701713
"id" => '',
702714
"reward_name" => $rule["reward_name"],
703-
"reward_value" => $rule["reward_value"],
715+
"reward_value" => !empty($rule["reward_value"]) ? $rule["reward_value"] : "",
704716
"maximum_redemption_limit" => !empty($rule["extra_parameters"]["maximum_redemption_limit"])
705717
? $rule["extra_parameters"]["maximum_redemption_limit"] : "",
706718
"minimum_redemption_limit" => !empty($rule["extra_parameters"]["minimum_redemption_limit"])
@@ -727,6 +739,23 @@ public function getCustomerEmailBySession()
727739
return $this->customerSession->create()->getCustomer()->getEmail() ?? '';
728740
}
729741

742+
/**
743+
* Get Customer Custom Attribute Value
744+
*
745+
* @return mixed
746+
*/
747+
public function getOptInCustomAttributeValue($customerId)
748+
{
749+
$customerData = $this->customerRepository->getById($customerId);
750+
$opt_in_attribute = $this->getOptInAttributeCode();
751+
$zinreloOptedIn = $customerData->getCustomAttribute($opt_in_attribute);
752+
if ($zinreloOptedIn) {
753+
return $zinreloOptedIn->getValue();
754+
}
755+
return null;
756+
}
757+
758+
730759
/**
731760
* Get Free Product
732761
*

Helper/Reward.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public function getCollectRewardValueData($orderId, $flag, $actionData)
2222
$rewardData = $this->getRewardRulesData($quote, $redeemReward);
2323
if (isset($rewardData['rule'])
2424
&& ($rewardData['rule'] == 'fixed_amount_discount'
25-
|| $rewardData['rule'] == 'percentage_discount')) {
25+
|| $rewardData['rule'] == 'percentage_discount'
26+
|| $rewardData['rule'] == 'flexible_points_reward')) {
2627

2728
$totalAmount = $order->getSubtotal();
2829
if ($rewardData['rule'] == 'fixed_amount_discount') {

view/frontend/web/js/view/checkout/cart/item-mixin.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)