* @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); } }