Skip to content

Commit 2dfbf6b

Browse files
authored
Merge pull request #15 from landofcoder/fix-issues-on-magento-246
Fix issues on magento 246
2 parents cc2de31 + 1afbaaa commit 2dfbf6b

File tree

9 files changed

+56
-11
lines changed

9 files changed

+56
-11
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Version 1.0.3 - 06/12/2023
2+
- Fix issues 13, 14
3+
- Compatible magento 2.4.6, PHP 8.1

Controller/Adminhtml/Configurable.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ abstract class Configurable extends \Magento\Backend\App\Action
4545
public function __construct(
4646
\Magento\Backend\App\Action\Context $context,
4747
\Magento\Framework\Registry $coreRegistry
48-
)
49-
{
48+
) {
5049
$this->_coreRegistry = $coreRegistry;
5150
parent::__construct($context);
5251
}

Controller/Adminhtml/Configurable/Authorize.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Authorize extends \Lof\Mautic\Controller\Adminhtml\Configurable
5151
protected $resultPageFactory;
5252

5353
/**
54-
* @param \Magento\Framework\App\Action\Context $context
54+
* @param \Magento\Backend\App\Action\Context $context
5555
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
5656
* @param \Lof\Mautic\Helper\Data $helper
5757
* @param \Lof\Mautic\Model\Mautic $webhookSetup
@@ -60,15 +60,14 @@ class Authorize extends \Lof\Mautic\Controller\Adminhtml\Configurable
6060
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
6161
*/
6262
public function __construct(
63-
\Magento\Framework\App\Action\Context $context,
63+
\Magento\Backend\App\Action\Context $context,
6464
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
6565
\Lof\Mautic\Helper\Data $helper,
6666
\Lof\Mautic\Model\Mautic $webhookSetup,
6767
\Magento\Framework\DB\Transaction $dbTransaction,
6868
\Magento\Framework\Registry $coreRegistry,
6969
\Magento\Framework\View\Result\PageFactory $resultPageFactory
70-
)
71-
{
70+
) {
7271

7372
parent::__construct($context, $coreRegistry);
7473

@@ -79,6 +78,9 @@ public function __construct(
7978
$this->resultPageFactory = $resultPageFactory;
8079
}
8180

81+
/**
82+
* @inheritdoc
83+
*/
8284
public function execute()
8385
{
8486
$version = $this->getRequest()->getParam('version');

Controller/Webhook/Index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function execute() {
111111
//$this->logger->info($rawData);
112112
if ($flag) {
113113
// @todo Process the $requestData as needed
114-
$requestData = json_decode($rawData);
114+
$requestData = json_decode($rawData, true);
115115
$changedData = isset($requestData["mautic.lead_channel_subscription_changed"]) ? $requestData["mautic.lead_channel_subscription_changed"] : [];
116116
//$oldStatus = isset($changedData['old_status']) ? $changedData['old_status']: "";//unsubscribed, contactable
117117
$newStatus = isset($changedData['new_status']) ? $changedData['new_status']: "";//contactable, unsubscribed

Lib/Api.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* @copyright 2014 Mautic, NP. All rights reserved.
4+
* @author Mautic
5+
*
6+
* @see http://mautic.org
7+
*
8+
* @license MIT http://opensource.org/licenses/MIT
9+
*/
10+
11+
namespace Lof\Mautic\Lib;
12+
13+
/**
14+
* Base API class.
15+
*/
16+
class Api extends \Mautic\Api\Api
17+
{
18+
/**
19+
* Set the base URL for API endpoints.
20+
*
21+
* @param string $url
22+
*
23+
* @return $this
24+
*/
25+
public function setBaseUrl($url)
26+
{
27+
$url = $url ? $url : "";
28+
if ('/' != @substr($url, -1)) {
29+
$url .= '/';
30+
}
31+
32+
if ('api/' != @substr($url, -4, 4)) {
33+
$url .= 'api/';
34+
}
35+
36+
$this->baseUrl = $url;
37+
38+
return $this;
39+
}
40+
}

Ui/Component/Listing/Column/StageName.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function prepareDataSource(array $dataSource)
7878
$fieldName = $this->getData('name');
7979
foreach ($dataSource['data']['items'] as &$item) {
8080
if (isset($item['stage'])) {
81-
$stage = $item['stage'] ? json_decode($item['stage']): [];
81+
$stage = $item['stage'] ? json_decode($item['stage'], true): [];
8282
$item[$fieldName."_html"] = $stage ? "<strong>".$stage["name"].'</strong><br/><span class="small-text">'. __("(weight: %1)", $stage["weight"]).'</span>' : "";
8383
}
8484
}

Ui/Component/Listing/Column/TagsName.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function prepareDataSource(array $dataSource)
7878
$fieldName = $this->getData('name');
7979
foreach ($dataSource['data']['items'] as &$item) {
8080
if (isset($item['tags'])) {
81-
$tags = $item['tags'] ? json_decode($item['tags']): [];
81+
$tags = $item['tags'] ? json_decode($item['tags'], true): [];
8282
$newTags = [];
8383
foreach ($tags as $_tag) {
8484
$newTags[] = $_tag->tag;

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"landofcoder/module-all" : "1.*"
77
},
88
"type": "magento2-module",
9-
"version": "1.0.2",
9+
"version": "1.0.3",
1010
"keywords": [
1111
"landofcoder",
1212
"magento 2 mautic",

etc/di.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<preference for="Lof\Mautic\Api\ContactRepositoryInterface" type="Lof\Mautic\Model\ContactRepository"/>
44
<preference for="Lof\Mautic\Api\Data\ContactInterface" type="Lof\Mautic\Model\Contact"/>
55
<preference for="Lof\Mautic\Api\Data\ContactSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
6+
<preference for="Mautic\Api\Api" type="Lof\Mautic\Lib\Api"/>
67
<virtualType name="Lof\Mautic\Model\ResourceModel\Contact\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
78
<arguments>
89
<argument name="mainTable" xsi:type="string">lof_mautic_contact</argument>
@@ -53,7 +54,7 @@
5354
</argument>
5455
</arguments>
5556
</type>
56-
57+
5758
<type name="Magento\Customer\Model\AccountManagement">
5859
<plugin name="mautic-abandoned-checkout-save-quote" type="Lof\Mautic\Model\Plugin\AccountManagement" sortOrder="10"/>
5960
</type>

0 commit comments

Comments
 (0)