Skip to content

Commit eedb38a

Browse files
committed
Add quickview events
1 parent ebb8f6f commit eedb38a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

classes/Hook/HookDisplayBeforeBodyClosingTag.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,27 @@ private function renderProductListing()
9494
'view_item_list',
9595
$eventData
9696
);
97+
98+
// Render quickview events
99+
foreach ($items as $item) {
100+
$eventData = [
101+
'item_list_id' => $item_list_id,
102+
'item_list_name' => $item_list_name,
103+
'items' => [$item],
104+
];
105+
106+
// Keep only product ID if id_product_attribute was appended
107+
$productId = explode('-', $item['item_id']);
108+
$productId = $productId[0];
109+
110+
// Render the event wrapped in onclick
111+
$this->gaScripts .= '
112+
$(\'article[data-id-product="' . $productId . '"] a.quick-view\').on(
113+
"click",
114+
function() {' . $this->module->getTools()->renderEvent('select_item', $eventData) . '}
115+
);
116+
';
117+
}
97118
}
98119

99120
/**

0 commit comments

Comments
 (0)