178 lines
6.4 KiB
Smarty
178 lines
6.4 KiB
Smarty
{*
|
|
* 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
|
|
*}
|
|
{if !empty($dataLayer)}
|
|
<script>
|
|
var ecsGtmOpcLastStep = 1;
|
|
var ecsGtmOpc = {
|
|
pushCheckoutStep : function(step, option) {
|
|
console.log("[call] step: " + step + " : " + option);
|
|
if(step > ecsGtmOpcLastStep) {
|
|
var dataLayerOpc = {$dataLayer nofilter};
|
|
dataLayerOpc.event = "checkout_opc";
|
|
dataLayerOpc.ecommerce.checkout.actionField.step = step;
|
|
dataLayerOpc.ecommerce.checkout.actionField.option = option;
|
|
dataLayer.push(dataLayerOpc);
|
|
console.log("[sent] step: " + step + " : " + option);
|
|
ecsGtmOpcLastStep = step;
|
|
}
|
|
},
|
|
address: function(){
|
|
ecsGtmOpc.pushCheckoutStep(2, "address");
|
|
},
|
|
delivery: function(){
|
|
var delay = 0;
|
|
if(ecsGtmOpcLastStep < 2) {
|
|
ecsGtmOpc.address();
|
|
delay = 100;
|
|
}
|
|
setTimeout(function() {
|
|
ecsGtmOpc.pushCheckoutStep(3, "delivery");
|
|
}, delay);
|
|
},
|
|
payment: function(){
|
|
var delay = 0;
|
|
if(ecsGtmOpcLastStep < 3) {
|
|
ecsGtmOpc.delivery();
|
|
delay = 100;
|
|
}
|
|
setTimeout(function() {
|
|
ecsGtmOpc.pushCheckoutStep(4, "payment");
|
|
}, delay);
|
|
}
|
|
};
|
|
|
|
if($("#velsof_supercheckout_form").length) {
|
|
console.log("[ECSGTMPRO] supercheckout - Knowband");
|
|
$("#checkoutShippingAddress").on("click", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.address();
|
|
}
|
|
});
|
|
$("#velsof_supercheckout_form").on("click", "#shipping-method", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$("#velsof_supercheckout_form").on("click", "#payment-method", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else if($("#onepagecheckoutps").length) {
|
|
console.log("[ECSGTMPRO] onepagecheckoutps - PresTeamShop");
|
|
$("#onepagecheckoutps").on("click", "#onepagecheckoutps_step_one", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.address();
|
|
}
|
|
});
|
|
$("#onepagecheckoutps").on("click", "#onepagecheckoutps_step_two", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$("#onepagecheckoutps").on("click", "#onepagecheckoutps_step_three", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else if($("#3column_opc").length || $("#bigcart_opc").length) { // bestkit_opc - best-kit - One Step Checkout / One Page Checkout v1.6.7
|
|
var $opc_wrapper = null;
|
|
if($("#3column_opc").length) {
|
|
$opc_wrapper = $("#3column_opc");
|
|
} else {
|
|
$opc_wrapper = $("#bigcart_opc");
|
|
}
|
|
console.log("[ECSGTMPRO] bestkit_opc - best-kit - style: " + $opc_wrapper.prop('id'));
|
|
$opc_wrapper.on("click", "#opc_account", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.address();
|
|
}
|
|
});
|
|
$opc_wrapper.on("click", "#opc_delivery_methods", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$opc_wrapper.on("click", "#opc_payments", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else if($(".kco-main").length) { // klarnaofficial - Prestaworks AB - Klarna v1.8.42
|
|
console.log("[ECSGTMPRO] klarnaofficial - Prestaworks AB");
|
|
$(".kco-main").on("click", "#klarnacarrier", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$(".kco-main").on("click", "#klarna-checkout-container", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else if($("#module-collectorcheckout-checkout").length) { // collectorcheckout
|
|
console.log("[ECSGTMPRO] collectorcheckout");
|
|
$("#module-collectorcheckout-checkout").on("click", ".delivery-option-label", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$("#module-collectorcheckout-checkout").on("click", ".payment-methods .AccordionRowComponent", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else if($(".steco_container").length) { // steasycheckout
|
|
let $opc_wrapper = $(".steco_container");
|
|
console.log("[ECSGTMPRO] steasycheckout");
|
|
$opc_wrapper.on("click", ".steco_addresses", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.address();
|
|
}
|
|
});
|
|
$opc_wrapper.on("click", ".steco_delivery", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$opc_wrapper.on("click", ".steco_payment, .steco-custom-input", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
} else {
|
|
$("#order-opc").on("click", "#opc_account", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.address();
|
|
}
|
|
});
|
|
$("#order-opc").on("click", "#carrier_area", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.delivery();
|
|
}
|
|
});
|
|
$("#order-opc").on("click", "#opc_payment_methods", function(e) {
|
|
if(!e.isTrigger) {
|
|
ecsGtmOpc.payment();
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{/if} |