Skip to content

Commit

Permalink
support connections from different Magento instances (#47)
Browse files Browse the repository at this point in the history
* fixed Allowed memory size issue and compatibility with php 7.4

* DEFECT-12960

* support connections from different magento instances

Co-authored-by: Jor Ven <jorven@MacBook-Pro-de-Jor-2.local>
  • Loading branch information
jorgeeurekalabs and Jor Ven authored Nov 30, 2022
1 parent 2cd367a commit fbbe121
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Core/Controller/Adminhtml/System/Config/Connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function execute()
$this->saveConfig(
\ActiveCampaign\Core\Helper\Data::ACTIVE_CAMPAIGN_GENERAL_CONNECTION_ID,
$connectionId,
$request['store']
(int)$request['store']
);
} else {
$return['success'] = false;
Expand All @@ -161,7 +161,7 @@ public function execute()
$this->saveConfig(
\ActiveCampaign\Core\Helper\Data::ACTIVE_CAMPAIGN_GENERAL_CONNECTION_ID,
$connectionId,
$store->getId()
(int)$store->getId()
);
} else {
$return['errorMessage'] = $result['message'];
Expand Down
6 changes: 5 additions & 1 deletion Core/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ public function checkConnections(array $allConnections): bool
$activeConnectionIds = [];

foreach ($allConnections['data']['connections'] as $connection) {
$store = $this->storeRepository->get($connection['externalid']);
try{
$store = $this->storeRepository->get($connection['externalid']);
}catch (\Exception $e){
continue;
}
$connectionId = $this->getConnectionId($store->getId());
$activeConnectionIds[] = $connection['id'];

Expand Down
2 changes: 1 addition & 1 deletion Order/Model/OrderData/OrderDataSend.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private function createEcomCustomer($customerId, $quote)
try {
$contactResult = $this->curl->createContacts(self::METHOD, self::CONTACT_ENDPOINT, $contactData);
$contactId = isset($contactResult['data']['contact']['id']) ? $contactResult['data']['contact']['id'] : null;
$connectionid = $this->coreHelper->getConnectionId($customer->getStoreId());
$connectionid = $this->coreHelper->getConnectionId($quote->getStoreId());

if (isset($contactResult['data']['contact']['id'])) {
if (!$customer->getAcCustomerId()) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "ActiveCampaign extension for Magento 2.3 and 2.4",
"type": "magento2-component",
"license": "OSL-3.0",
"version": "2.1.0",
"version": "2.0.5",
"repositories": [
{
"type": "composer",
Expand Down

0 comments on commit fbbe121

Please sign in to comment.