/* * 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 * @copyright 2022 ECSoft * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of ECSoft */ window.addEventListener('load', function(){ $('#order').on('click', 'button[name=processCarrier]', function(e, ecsGtmTriggered) { let $submitBtn = $(this); let $selectedShipping = $submitBtn.closest('form[name=carrier_area]').find('.delivery_options input[type=radio]:checked').closest('.delivery_option'); let shippingName = $selectedShipping.find('td:not(.delivery_option_radio):not(.delivery_option_logo):not(.delivery_option_price)').find('strong').text(); ecsGtmPro.handleValidateShippingStep($submitBtn, e, ecsGtmTriggered, shippingName); }); $('#order').on('click', '#HOOK_PAYMENT .payment_module a', function(e, ecsGtmTriggered) { let $submitBtn = $(this); e.preventDefault(); try { dataLayer = dataLayer || []; let cloneDL = JSON.parse(JSON.stringify(ecsGtmProDatalayer)); cloneDL.event = 'add_payment_info'; cloneDL.ecommerce.payment_type = $submitBtn.attr('title'); dataLayer.push(cloneDL); } catch (e) { console.error(e); } setTimeout(function() { window.location.assign($submitBtn.attr("href")); }, 500); }); $('.ajax_block_product').find('a.product-name,a.product_img_link,a.lnk_view,a.quick-view-mobile').on('click', function(e) { let $productInfos = $(this).closest('.ajax_block_product').find('.ecsgtmpro_product'); let idProduct = $productInfos.data('id-product'); let idProductAttribute = $productInfos.data('id-product-attribute') | 0; ecsGtmPro.productClick(idProduct, idProductAttribute); }); });