-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
205cf4f
commit 83f0a7f
Showing
15 changed files
with
131 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace ActiveCampaign\AbandonedCart\Plugin\Checkout\Controller\Cart; | ||
|
||
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; | ||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Framework\App\Helper\Context; | ||
|
||
class Index extends AbstractHelper | ||
{ | ||
/** | ||
* @var \Magento\Framework\View\Result\PageFactory | ||
*/ | ||
protected $cart; | ||
|
||
/** | ||
* @var Session | ||
*/ | ||
private $customerSession; | ||
/** | ||
* @var UrlInterface | ||
*/ | ||
private $urlInterface; | ||
|
||
/** | ||
* Index constructor. | ||
* @param Context $context | ||
* @param \Magento\Checkout\Model\Cart $cart | ||
* @param \Magento\Customer\Model\Session $customerSession | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
\Magento\Checkout\Model\Cart $cart, | ||
\Magento\Customer\Model\Session $customerSession | ||
) { | ||
parent::__construct($context); | ||
$this->urlInterface = $context->getUrlBuilder(); | ||
$this->customerSession = $customerSession; | ||
$this->cart = $cart; | ||
} | ||
|
||
/** | ||
* Shopping cart display action | ||
* | ||
* @return \Magento\Framework\View\Result\Page | ||
*/ | ||
public function aroundExecute($subject, callable $proceed) | ||
{ | ||
if((empty($this->cart->getItems()) || $this->cart->getItems()->count() == 0) && !$this->customerSession->isLoggedIn()){ | ||
$this->customerSession->setAfterAuthUrl($this->urlInterface->getCurrentUrl()); | ||
$this->customerSession->authenticate(); | ||
}else{ | ||
$resultPage = $proceed(); | ||
return $resultPage; | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="ActiveCampaign_Core" setup_version="2.1.2"/> | ||
<module name="ActiveCampaign_Core" setup_version="2.1.3"/> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace ActiveCampaign\SyncLog\Helper; | ||
|
||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Framework\App\Helper\Context; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Data extends AbstractHelper | ||
{ | ||
const ACTIVE_CAMPAIGN_SYNCLOG_MODE = "active_campaign/synclog/synclog_mode"; | ||
|
||
|
||
/** | ||
* @var \Magento\Framework\App\State * | ||
*/ | ||
private $state; | ||
|
||
/** | ||
* Data constructor. | ||
* @param Context $context | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
\Magento\Framework\App\State $state | ||
) | ||
{ | ||
parent::__construct($context); | ||
$this->state = $state; | ||
} | ||
|
||
/** | ||
* @param null $scopeCode | ||
* @return bool | ||
*/ | ||
public function isLogError($scopeCode = null) | ||
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::ACTIVE_CAMPAIGN_SYNCLOG_MODE, | ||
ScopeInterface::SCOPE_STORES, | ||
$scopeCode | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="ActiveCampaign_SyncLog" setup_version="2.1.0" /> | ||
<module name="ActiveCampaign_SyncLog" setup_version="2.1.1" /> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters