70 lines
2.4 KiB
PHP
70 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* 2022 ECSoft
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://opensource.org/licenses/afl-3.0.php
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to dev.ecsoft@gmail.com so we can send you a copy immediately.
|
|
*
|
|
* @author ECSoft <dev.ecsoft@gmail.com>
|
|
* @copyright 2022 ECSoft
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
* International Registered Trademark & Property of ECSoft
|
|
*/
|
|
|
|
require_once dirname(__FILE__) . '/../ua/EcsGtmProDataLayerProduct.php';
|
|
|
|
class EcsGtmProDataLayerItem
|
|
{
|
|
public $item_name;
|
|
public $item_id;
|
|
public $price;
|
|
public $price_tax_exc;
|
|
public $item_brand;
|
|
public $item_category;
|
|
public $item_category2;
|
|
public $item_category3;
|
|
public $item_category4;
|
|
public $item_variant;
|
|
public $item_list_name;
|
|
public $item_list_id;
|
|
public $index;
|
|
public $quantity;
|
|
|
|
/**
|
|
*
|
|
* @param EcsGtmPro $module
|
|
* @param ProductCore $product
|
|
* @param array|null $list
|
|
*/
|
|
public function __construct($module, $product, $list = null)
|
|
{
|
|
$datalayerProduct = new EcsGtmProDataLayerProduct($module, $product, $list);
|
|
$this->item_name = $datalayerProduct->name;
|
|
$this->item_id = $datalayerProduct->id;
|
|
$this->price = $datalayerProduct->price;
|
|
$this->price_tax_exc = $datalayerProduct->price_tax_exc;
|
|
$this->item_brand = $datalayerProduct->brand;
|
|
$this->item_category = $datalayerProduct->item_category;
|
|
$this->item_category2 = $datalayerProduct->item_category2;
|
|
$this->item_category3 = $datalayerProduct->item_category3;
|
|
$this->item_category4 = $datalayerProduct->item_category4;
|
|
$this->item_variant = $datalayerProduct->variant;
|
|
$this->item_list_name = !empty($list['name']) ? $list['name'] : null;
|
|
$this->item_list_id = !empty($list['id']) ? $list['id'] : null;
|
|
$this->index = !empty($list['index']) ? $list['index'] : null;
|
|
$this->quantity = !empty($datalayerProduct->quantity) ? $datalayerProduct->quantity : 1;
|
|
}
|
|
|
|
public function removeNull()
|
|
{
|
|
EcsGtmProTools::removeNull($this);
|
|
}
|
|
}
|