Skip to content

Commit

Permalink
added additional gate to customer email
Browse files Browse the repository at this point in the history
  • Loading branch information
FoulBachelor committed Nov 11, 2022
1 parent c04257c commit 529bb57
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions code/controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ public function customerAction()
}
}
}

$_customers = mage::getModel('customer/customer')->getCollection()
->addAttributeToSelect('firstname')
->addAttributeToSelect('lastname')
Expand All @@ -638,6 +638,8 @@ public function customerAction()
->setPageSize($limit)
->setCurPage($page);

$collect_emails = Mage::getStoreConfigFlag('clerk/general/collect_emails');

if($collect_subscribers){
foreach ($_customers as $_customer) {
$customer = $_customer->getData();
Expand All @@ -659,11 +661,17 @@ public function customerAction()
} else {
foreach ($_customers as $_customer) {
$customer = $_customer->getData();


if($collect_emails){
$customer_email = $customer['email'];
} else {
$customer_email = '';
}

$customers[] = [
'id' => $customer['entity_id'],
'name' => $customer['firstname'] . ' ' . $customer['lastname'],
'email' => $customer['email'],
'email' => $customer_email,
];
}
}
Expand Down

0 comments on commit 529bb57

Please sign in to comment.