Skip to content

Commit 27d7aaf

Browse files
Merge pull request #74 from jorgeeurekalabs/main
v2.1.20
2 parents 44ec9f1 + e67ef40 commit 27d7aaf

File tree

11 files changed

+26
-20
lines changed

11 files changed

+26
-20
lines changed

AbandonedCart/Model/AbandonedCartSendData.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function sendAbandonedCartData($quoteId = null): array
249249

250250
$quote = $this->quoteRepository->get($abandonedCart->getEntityId());
251251
$AcCustomer = NULL;
252-
if ($this->isGuest($quote) || ($abandonedCart->getCustomerId() && !$this->getCustomer($abandonedCart->getCustomerId())->getCustomerId())) {
252+
if ($this->isGuest($quote) || ($abandonedCart->getCustomerId() && !$this->getCustomer($abandonedCart->getCustomerId())->getId())) {
253253
$customerEmail = $quote->getBillingAddress()->getEmail();
254254
if (!$customerEmail) {
255255
$result['error'] = __('Customer Email does not exist.');
@@ -270,6 +270,10 @@ public function sendAbandonedCartData($quoteId = null): array
270270
$abandonedCart->collectTotals();
271271
$quoteItemsData = $this->getQuoteItemsData($abandonedCart->getEntityId(), $abandonedCart->getStoreId());
272272
$abandonedCartRepository = $this->quoteRepository->get($abandonedCart->getId());
273+
$abandonedUpdateDate = $abandonedCartRepository->getUpdatedAt();
274+
if(is_null($abandonedUpdateDate)){
275+
$abandonedUpdateDate = $abandonedCartRepository->getCreatedAt();
276+
}
273277
$timezone = $this->dateTime->getConfigTimezone(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $abandonedCart->getStoreId());
274278
$abandonedCartData = [
275279
"ecomOrder" => [
@@ -281,9 +285,9 @@ public function sendAbandonedCartData($quoteId = null): array
281285
"discountAmount" => $this->coreHelper->priceToCents($abandonedCart->getDiscountAmount())
282286
],
283287
"orderUrl" => $this->urlBuilder->getDirectUrl('checkout/cart'),
284-
"abandonedDate" => $this->dateTime->date(strtotime($abandonedCartRepository->getUpdatedAt()),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
288+
"abandonedDate" => $this->dateTime->date(strtotime($abandonedUpdateDate),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
285289
"externalCreatedDate" => $this->dateTime->date(strtotime($abandonedCartRepository->getCreatedAt()),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
286-
"externalUpdatedDate" => $this->dateTime->date(strtotime($abandonedCartRepository->getUpdatedAt()),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
290+
"externalUpdatedDate" => $this->dateTime->date(strtotime($abandonedUpdateDate),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
287291
"shippingMethod" => $abandonedCart->getShippingAddress()->getShippingMethod(),
288292
"totalPrice" => $this->coreHelper->priceToCents($abandonedCart->getGrandTotal()),
289293
"shippingAmount" => $this->coreHelper->priceToCents($abandonedCart->getShippingAmount()),

AbandonedCart/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": {
1010
"sort-packages": true
1111
},
12-
"version": "2.1.8",
12+
"version": "2.1.9",
1313
"require": {
1414
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2",
1515
"activecampaign/core": "2.1.*"

AbandonedCart/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="ActiveCampaign_AbandonedCart" setup_version="2.1.8">
9+
<module name="ActiveCampaign_AbandonedCart" setup_version="2.1.9">
1010
<sequence>
1111
<module name="Magento_Product"/>
1212
<module name="Magento_Sales"/>

Customer/Model/Customer.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function getEcomCustomerData($customer)
169169
$ecomCustomer['connectionid'] = $this->coreHelper->getConnectionId($customer->getStoreId());
170170
$ecomCustomer['externalid'] = $customer->getId();
171171
$ecomCustomer['email'] = $customer->getEmail();
172-
$ecomCustomerData['acceptsMarketing'] = (int)$this->subscriberFactory->create()->loadByCustomer($customer->getId(),$customer->getWebsiteId())->isSubscribed();
172+
$ecomCustomer['acceptsMarketing'] = (int)$this->subscriberFactory->create()->loadBySubscriberEmail($customer->getEmail(), $customer->getWebsiteId())->isSubscribed();
173173
$ecomCustomerData['ecomCustomer'] = $ecomCustomer;
174174

175175
return $ecomCustomerData;
@@ -178,13 +178,16 @@ public function getEcomCustomerData($customer)
178178
/**
179179
* @param null $billingId
180180
* @return string|null
181-
* @throws \Magento\Framework\Exception\LocalizedException
182181
*/
183182
private function getTelephone($billingId = null)
184183
{
185184
if ($billingId) {
186-
$address = $this->addressRepository->getById($billingId);
187-
return $address->getTelephone();
185+
try{
186+
$address = $this->addressRepository->getById($billingId);
187+
return $address->getTelephone();
188+
}catch (\Exception $exception){
189+
190+
}
188191
}
189192
return null;
190193
}

Customer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": {
1010
"sort-packages": true
1111
},
12-
"version": "2.1.8",
12+
"version": "2.1.9",
1313
"require": {
1414
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2",
1515
"activecampaign/core": "2.1.*"

Customer/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="ActiveCampaign_Customer" setup_version="2.1.8">
3+
<module name="ActiveCampaign_Customer" setup_version="2.1.9">
44
<sequence>
55
<module name="ActiveCampaign_Core"/>
66
</sequence>

Order/Model/OrderData/OrderDataSend.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,19 @@ public function orderDataSend($order): array
224224
}
225225
$timezone = $this->dateTime->getConfigTimezone(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $order->getStoreId());
226226
foreach ($order->getAllVisibleItems() as $item) {
227-
$product = $this->_productRepositoryFactory->create()
228-
->get($item->getSku());
227+
229228
$imageUrl = $this->imageHelperFactory->create()
230-
->init($product, 'product_thumbnail_image')->getUrl();
229+
->init($item->getProduct(), 'product_thumbnail_image')->getUrl();
231230
$items[] = [
232231
"externalid" => $item->getProductId(),
233232
"name" => $item->getName(),
234233
"price" => $this->activeCampaignHelper->priceToCents($item->getPrice()),
235234
"quantity" => $item->getQtyOrdered(),
236-
"category" => implode(', ', $product->getCategoryIds()),
235+
"category" => implode(', ', $item->getProduct()->getCategoryIds()),
237236
"sku" => $item->getSku(),
238237
"description" => $item->getDescription(),
239238
"imageUrl" => $imageUrl,
240-
"productUrl" => $product->getProductUrl()
239+
"productUrl" => $item->getProduct()->getProductUrl()
241240
];
242241
}
243242
$data = [

Order/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": {
1010
"sort-packages": true
1111
},
12-
"version": "2.1.4",
12+
"version": "2.1.5",
1313
"require": {
1414
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2",
1515
"activecampaign/core": "2.1.*"

Order/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="ActiveCampaign_Order" setup_version="2.1.4">
3+
<module name="ActiveCampaign_Order" setup_version="2.1.5">
44
<sequence>
55
<module name="ActiveCampaign_Core" />
66
<module name="ActiveCampaign_Customer"/>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "activecampaign/module-integration",
33
"description": "ActiveCampaign extension for Magento 2.3 and 2.4",
44
"type": "magento2-component",
5-
"version": "2.0.17",
5+
"version": "2.1.20",
66
"license": "OSL-3.0",
77
"require": {
88
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2"

0 commit comments

Comments
 (0)