Skip to content

Commit

Permalink
Merge pull request #1 from outeredge/main
Browse files Browse the repository at this point in the history
Change data to comma separator
  • Loading branch information
broopdias authored Feb 10, 2022
2 parents 92da502 + cd17247 commit 1d5aafe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions Block/Form/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ public function getNewsletterOptionsByCustomer($newsletterOption)
$customerNewsOpt = $customer->getCustomAttribute('newsletter_options')->getValue();

if (!empty($customerNewsOpt)) {
$result = json_decode($customerNewsOpt, true);

if (isset($result[$newsletterOption])) {
if ($result[$newsletterOption] == 1) {
return true;
}
if (strpos($customerNewsOpt, $newsletterOption) !== false) {
return true;
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion Observer/UpdateOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function execute(Observer $observer) : void
{
$newsOptions = $observer->getRequest()->getParam('newsletter_options', false);

$dataToSave = json_encode($newsOptions);
$dataToSave = implode(',', array_keys($newsOptions));

$storeId = (int)$this->storeManager->getStore()->getId();
$websiteId = (int)$this->storeManager->getStore($storeId)->getWebsiteId();
Expand Down

0 comments on commit 1d5aafe

Please sign in to comment.