403Webshell
Server IP : 85.158.181.41  /  Your IP : 216.73.217.12
Web Server : Apache
System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64
User : moncbefd ( 1024)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/moncbefd/www.moneta.at/GXModules/Gambio/GoogleECommerce/Shop/Html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/moncbefd/www.moneta.at/GXModules/Gambio/GoogleECommerce/Shop/Html/add_to_cart_hook.html
{*
	Google Analytics add to cart hook

	This template has to be included in the desired page
	to perform the Google Analytics hit while
	adding a product to the cart
*}

{block name="google_analytics_partials_add_to_cart_hook"}
	<script>
		(function() {
			document.addEventListener('JSENGINE_INIT_FINISHED', function() {
				const endpointUrl = `${ jse.core.config.get('appUrl') }/shop.php?do=GoogleAnalyticsShop/addToCart`
				const hooks = {
					add: jse.libs.hooks.add,
					key: jse.libs.hooks.keys.shop.cart.add,
					callback: function(data) {
						return new Promise(handlePromise.bind(undefined, data));
					},
				};

				function handlePromise(data, resolve) {
					const parameters = {
						quantity: data.products_qty,
						id: data.products_id,
						attributes: [],
						properties: [],
					};

					function onSuccess(response) {
						if (!response.enabled) {
							resolve();
							return;
						}

						gtag('event', 'add_to_cart', {
							"items": [JSON.parse(response.item)]
						});

						resolve();
					}

					function onFail() {
						resolve();
					}

					if (data.properties_values_ids) {
						Object
							.entries(data.properties_values_ids)
							.forEach(function(entry) {
								parameters.properties.push({
									optionId: entry[0],
									valueId: entry[1],
								});
							});
					}

					if (data.id) {
						Object
							.entries(data.id)
							.forEach(function(entry) {
								parameters.attributes.push({
									optionId: entry[0],
									valueId: entry[1],
								});
							});
					}

					jse.libs.xhr.post({
						url: endpointUrl,
						data: parameters,
					})
						.then(onSuccess)
						.fail(onFail)
				}

				hooks.add(hooks.key, hooks.callback);
			})
		})();
	</script>
{/block}

Youez - 2016 - github.com/yon3zu
LinuXploit