[Added] search controller extension (add_to_cart)
This commit is contained in:
bovenliggende
229cf3695f
commit
007e83909b
@ -1,7 +1,7 @@
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{block name="d3_ga4_view_search_result_block"}]
|
||||
[{if $gtmProducts|@count}]
|
||||
[{if $gtmProducts}]
|
||||
[{capture name="d3_ga4_view_search_result"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
@ -39,4 +39,6 @@
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
[{/block}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
@ -29,6 +29,7 @@ namespace D3\GoogleAnalytics4\Modules\Application\Controller{
|
||||
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountWishlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController;
|
||||
|
||||
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
|
||||
@ -45,6 +46,8 @@ namespace D3\GoogleAnalytics4\Modules\Application\Controller{
|
||||
class d3GtmAccountWishlistController_parent extends AccountWishlistController {}
|
||||
|
||||
class d3GtmStartController_parent extends StartController {}
|
||||
|
||||
class d3GtmSearchController_parent extends SearchController {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component{
|
||||
|
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
|
||||
class d3GtmSearchController extends d3GtmSearchController_parent
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
if (false === in_array('oxcmp_basket', $this->getComponents())){
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ use D3\GoogleAnalytics4\Modules\Application\Controller\BasketController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountNoticeListController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountRecommlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountWishlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmSearchController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
||||
@ -20,6 +21,7 @@ use OxidEsales\Eshop\Application\Controller\AccountWishlistController as OEAccou
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleDetailsController as OEArticleDetailsController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController as OEArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\BasketController as OEBasketController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController as OESearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController as OEStartController;
|
||||
use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouController;
|
||||
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
||||
@ -59,7 +61,8 @@ $aModule = [
|
||||
OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class,
|
||||
OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class,
|
||||
OEAccountWishlistController::class => d3GtmAccountWishlistController::class,
|
||||
OEStartController::class => d3GtmStartController::class
|
||||
OEStartController::class => d3GtmStartController::class,
|
||||
OESearchController::class => d3GtmSearchController::class
|
||||
],
|
||||
'templates' => [
|
||||
// Event files that store the GA4 Event-Information
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user