[Added] add_to_cart to page/list/list.tpl, BasketComponent methods for trigger-behaviour add_to_cart

This commit is contained in:
2023-11-07 11:00:28 +01:00
parent 81aab10c4e
commit a88fa570a8
2 changed files with 64 additions and 28 deletions

View File

@ -2,38 +2,14 @@
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Core\Registry;
class ArticleListController_AddToCartHelpMethods extends ArticleListController_AddToCartHelpMethods_parent
{
/**
* @return mixed|null
*/
public function getAddToBasketDecision() :bool
public function render()
{
$decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger');
$render = parent::render();
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', false);
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
return (bool) $decision;
}
/**
* @return Article|null
*/
public function d3GtmRequestedArticleLoadedByAnid()
{
$sAnid = Registry::getRequest()->getRequestEscapedParameter('anid');
$oArticle = null;
if ($sAnid){
/** @var Article $oArticle */
$oArticle = oxNew(Article::class);
$oArticle->load($sAnid);
}
return $oArticle;
return $render;
}
}