48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KupShop\GTMBundle\Ecommerce;
|
|
|
|
use KupShop\GTMBundle\Utils\DataLoaders\Products;
|
|
use KupShop\KupShopBundle\Context\CurrencyContext;
|
|
|
|
class AddToWishList extends AbstractEcommerce
|
|
{
|
|
/**
|
|
* @var Products
|
|
*/
|
|
protected $productLoader;
|
|
|
|
protected $currencyContext;
|
|
|
|
/**
|
|
* Specific PageData.
|
|
*
|
|
* @throws \Exception
|
|
*/
|
|
public function getData(&$dataContainer)
|
|
{
|
|
$dataContainer->event = 'addToWishlist';
|
|
$products = !empty($this->pageData['addedToWishList']) ? [$this->pageData['addedToWishList']] : $this->pageData['products'];
|
|
|
|
$addedProduct = $this->productLoader->getProducts($products);
|
|
$dataContainer->products = $addedProduct;
|
|
$dataContainer->_clear = true;
|
|
}
|
|
|
|
/**
|
|
* @required
|
|
*/
|
|
public function setProductLoader(Products $productLoader): void
|
|
{
|
|
$this->productLoader = $productLoader;
|
|
}
|
|
|
|
/**
|
|
* @required
|
|
*/
|
|
public function setCurrencyContext(CurrencyContext $currencyContext): void
|
|
{
|
|
$this->currencyContext = $currencyContext;
|
|
}
|
|
}
|