Pour poser le container Tag Tradedoubleur cela ce fait e deux étapes
Aller sur le page theme.liquid et poser le code ci-dessous juste avant la fermeture de la balise body en remplacer la valeur des variables
#
{% comment %}
#####################################################
##### Container TradeDoubleur
#####################################################
{% endcomment %}
{% assign containter_tag_id_home = "xxx" %}
{% assign containter_tag_id_cart = "xxx" %}
{% assign containter_tag_id_produit = "xxx" %}
{% case template.name %}
{% when 'index' %}
<script type="text/javascript">
$async = true; // true : Asynchronous script / false : Synchronous Script
function getVar(name) {
get_string = document.location.search;
return_value = '';
do {
name_index = get_string.indexOf(name + '=');
if (name_index != -1) {
get_string = get_string.substr(name_index + name.length + 1,
get_string.length - name_index);
end_of_value = get_string.indexOf('&');
if (end_of_value != -1) {
value = get_string.substr(0, end_of_value);
} else {
value = get_string;
}
if (return_value == '' || value == '') {
return_value += value;
} else {
return_value += ', ' + value;
}
}
}
while (name_index != -1);
space = return_value.indexOf('+');
while (space != -1) {
return_value = return_value.substr(0, space) + ' ' +
return_value.substr(space + 1, return_value.length);
space = return_value.indexOf('+');
}
return (return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');
if (mytduid != '') {
setCookie('TRADEDOUBLER', mytduid, 365);
}
var TDConf = TDConf || {};
TDConf.Config = {
// L'array products_panier (les produits contenus dans le panier) peut contenir plusieurs produits avec les caracteristiques ci-dessous :
products_panier: [
{% for item in cart.items %}
{
reference: "{{ item.sku }}",
nom: "{{ item.product.title }}",
prixHT: "{{ item.price | divided_by: 1.2 | money }}",
prixTTC: "{{ item.price | money }}",
prixbarreHT: "{{ item.product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ item.product.compare_at_price | money }}",
image: "{{ item | img_url: 'medium' }}",
currency: "EUROS",
quantite: "{{ item.quantity }}"
},
{% endfor %}
],
panierTotalHT: "{{ cart.total_price | divided_by: 1.2 | money }}",
panierTotalTTC: "{{ cart.total_price | money }}",
// L'array products correspond aux produits visibles sur la page home (ce tableau doit rester vide pour les autres pages du site, hors PANIER/ CHECK-OUT)
products: [
{% for collection in collections %}
{% if collection.title == "Page d'accueil" %}
{% for product in collection.products %}
{%- assign produitTitle = product.title -%}
{% for variant in product.variants %}
{% if variant.available %}
{
reference: "{{ variant.sku }}",
nom: "{{ produitTitle }}",
prixHT: "{{ product.price | divided_by: 1.2 | money }}",
prixTTC: "{{ product.price | money }}",
prixbarreHT: "{{ product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ product.compare_at_price | money }}",
image: "{{ product.featured_image | img_url: 'medium' }}",
currency: "EUROS"
},
{% endif %}
{% endfor %}
{%- assign current_variant = product.selected_or_first_available_variant -%}
{% endfor %}
{% endif %}
{% endfor %}
],
containerTagId: "{{ containter_tag_id_home }}",
device: /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d",
protocol : document.location.protocol,
page: window.location.href,
titre_page: document.title
};
if (typeof (TDConf) != "undefined") {
TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
TDConf.host = ".tradedoubler.com/wrap";
TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://") + TDConf.sudomain + TDConf.host;
if (typeof (TDConf.Config) != "undefined") {
if ($async) {
var TDAsync = document.createElement('script');
TDAsync.src = TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId;
TDAsync.async = "yes";
TDAsync.width = 0;
TDAsync.height = 0;
TDAsync.frameBorder = 0;
document.body.appendChild(TDAsync);
} else {
document.write(unescape("%3Cscript src='" + TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId + " ' type='text/javascript'%3E%3C/script%3E"));
}
}
}
</script>
{% when 'product' %}
<script type="text/javascript">
$async = true; // true : Asynchronous script / false : Synchronous Script
function getVar(name) {
get_string = document.location.search;
return_value = '';
do {
name_index = get_string.indexOf(name + '=');
if (name_index != -1) {
get_string = get_string.substr(name_index + name.length + 1,
get_string.length - name_index);
end_of_value = get_string.indexOf('&');
if (end_of_value != -1) {
value = get_string.substr(0, end_of_value);
} else {
value = get_string;
}
if (return_value == '' || value == '') {
return_value += value;
} else {
return_value += ', ' + value;
}
}
}
while (name_index != -1);
space = return_value.indexOf('+');
while (space != -1) {
return_value = return_value.substr(0, space) + ' ' +
return_value.substr(space + 1, return_value.length);
space = return_value.indexOf('+');
}
return (return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');
if (mytduid != '') {
setCookie('TRADEDOUBLER', mytduid, 365);
}
var TDConf = TDConf || {};
TDConf.Config = {
// L'array products_panier (les produits contenus dans le panier) peut contenir plusieurs produits avec les caracteristiques ci-dessous :
products_panier: [
{% for item in cart.items %}
{
reference: "{{ item.sku }}",
nom: "{{ item.product.title }}",
prixHT: "{{ item.price | divided_by: 1.2 | money }}",
prixTTC: "{{ item.price | money }}",
prixbarreHT: "{{ item.product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ item.product.compare_at_price | money }}",
image: "{{ item | img_url: 'medium' }}",
currency: "EUROS",
quantite: "{{ item.quantity }}"
},
{% endfor %}
],
panierTotalHT: "{{ cart.total_price | divided_by: 1.2 | money }}",
panierTotalTTC: "{{ cart.total_price | money }}",
// L'array products correspond aux produits visibles sur la page home (ce tableau doit rester vide pour les autres pages du site, hors PANIER/ CHECK-OUT)
products: [
{% for collection in collections %}
{% if collection.title == "Page d'accueil" %}
{% for product in collection.products %}
{%- assign produitTitle = product.title -%}
{% for variant in product.variants %}
{% if variant.available %}
{
reference: "{{ variant.sku }}",
nom: "{{ produitTitle }}",
prixHT: "{{ product.price | divided_by: 1.2 | money }}",
prixTTC: "{{ product.price | money }}",
prixbarreHT: "{{ product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ product.compare_at_price | money }}",
image: "{{ product.featured_image | img_url: 'medium' }}",
currency: "EUROS"
},
{% endif %}
{% endfor %}
{%- assign current_variant = product.selected_or_first_available_variant -%}
{% endfor %}
{% endif %}
{% endfor %}
],
containerTagId: "{{ containter_tag_id_product }}",
device: /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d",
protocol : document.location.protocol,
page: window.location.href,
titre_page: document.title
};
if (typeof (TDConf) != "undefined") {
TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
TDConf.host = ".tradedoubler.com/wrap";
TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://") + TDConf.sudomain + TDConf.host;
if (typeof (TDConf.Config) != "undefined") {
if ($async) {
var TDAsync = document.createElement('script');
TDAsync.src = TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId;
TDAsync.async = "yes";
TDAsync.width = 0;
TDAsync.height = 0;
TDAsync.frameBorder = 0;
document.body.appendChild(TDAsync);
} else {
document.write(unescape("%3Cscript src='" + TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId + " ' type='text/javascript'%3E%3C/script%3E"));
}
}
}
</script>
{% when 'cart' %}
<script type="text/javascript">
$async = true; // true : Asynchronous script / false : Synchronous Script
function getVar(name) {
get_string = document.location.search;
return_value = '';
do {
name_index = get_string.indexOf(name + '=');
if (name_index != -1) {
get_string = get_string.substr(name_index + name.length + 1,
get_string.length - name_index);
end_of_value = get_string.indexOf('&');
if (end_of_value != -1) {
value = get_string.substr(0, end_of_value);
} else {
value = get_string;
}
if (return_value == '' || value == '') {
return_value += value;
} else {
return_value += ', ' + value;
}
}
}
while (name_index != -1);
space = return_value.indexOf('+');
while (space != -1) {
return_value = return_value.substr(0, space) + ' ' +
return_value.substr(space + 1, return_value.length);
space = return_value.indexOf('+');
}
return (return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');
if (mytduid != '') {
setCookie('TRADEDOUBLER', mytduid, 365);
}
/*
let discount = $("#shopify-section-cart-template > form > div:nth-child(2) > div > div.grid-item.large--five-twelfths.medium--two-thirds.push--medium--one-third > div > div.grid-item.one-third.medium-down--one-third.medium-down--text-left.text-right > span > s").html()
discount = discount.replace("€", "")
console.log(" => " + discount)
*/
var TDConf = TDConf || {};
TDConf.Config = {
// L'array products_panier (les produits contenus dans le panier) peut contenir plusieurs produits avec les caracteristiques ci-dessous :
products_panier: [
{% for item in cart.items %}
{
reference: "{{ item.sku }}",
nom: "{{ item.product.title }}",
prixHT: "{{ item.price | divided_by: 1.2 | money }}",
prixTTC: "{{ item.price | money }}",
prixbarreHT: "{{ item.product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ item.product.compare_at_price | money }}",
image: "{{ item | img_url: 'medium' }}",
currency: "EUROS",
quantite: "{{ item.quantity }}"
},
{% endfor %}
],
panierTotalHT: "{{ cart.total_price | divided_by: 1.2 | money }}",
panierTotalTTC: "{{ cart.total_price | money }}",
codepromo: "" + $('input[name="discount"]').val() + "",
instructions: "{{ cart.note }}",
containerTagId: "{{ containter_tag_id_cart }}",
device: /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d",
protocol : document.location.protocol,
page: window.location.href,
titre_page: document.title
};
if (typeof (TDConf) != "undefined") {
TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
TDConf.host = ".tradedoubler.com/wrap";
TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://") + TDConf.sudomain + TDConf.host;
if (typeof (TDConf.Config) != "undefined") {
if ($async) {
var TDAsync = document.createElement('script');
TDAsync.src = TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId;
TDAsync.async = "yes";
TDAsync.width = 0;
TDAsync.height = 0;
TDAsync.frameBorder = 0;
document.body.appendChild(TDAsync);
} else {
document.write(unescape("%3Cscript src='" + TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId + " ' type='text/javascript'%3E%3C/script%3E"));
}
}
}
</script>
{% else %}
{% endcase %}
{% comment %}
#####################################################
##### Fin Container TradeDoubleur
#####################################################
{% endcomment %}
Ensuite aller sur la page « Passage à la caisse » dans le menu « Paramètre » et poser le script ci-dessous en remplaçant la variable containter_tag_id_checkout par celle du containerID souhaoté
{% comment %}
#####################################################
##### Container TradeDoubleur
#####################################################
{% endcomment %}
{% assign containter_tag_id_checkout = "XXX" %}
<script type="text/javascript">
$async = true; // true : Asynchronous script / false : Synchronous Script
function getVar(name) {
get_string = document.location.search;
return_value = '';
do {
name_index = get_string.indexOf(name + '=');
if (name_index != -1) {
get_string = get_string.substr(name_index + name.length + 1,
get_string.length - name_index);
end_of_value = get_string.indexOf('&');
if (end_of_value != -1) {
value = get_string.substr(0, end_of_value);
} else {
value = get_string;
}
if (return_value == '' || value == '') {
return_value += value;
} else {
return_value += ', ' + value;
}
}
}
while (name_index != -1);
space = return_value.indexOf('+');
while (space != -1) {
return_value = return_value.substr(0, space) + ' ' +
return_value.substr(space + 1, return_value.length);
space = return_value.indexOf('+');
}
return (return_value);
}
function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
var mytduid = getVar('tduid');
if (mytduid != '') {
setCookie('TRADEDOUBLER', mytduid, 365);
}
var TDConf = TDConf || {};
TDConf.Config = {
// L'array products_panier (les produits contenus dans le panier) peut contenir plusieurs produits avec les caracteristiques ci-dessous :
products_checkout: [{% for line_item in order.line_items %}
{
reference: "{{ line_item.sku }}",
nom: "{{ line_item.title }}",
prixHT: "{{ line_item.product.price | divided_by: 1.2 | money }}",
prixTTC: "{{ line_item.product.price | money }}",
prixbarreHT: "{{ line_item.product.compare_at_price| divided_by: 1.2 | money }}",
prixbarreTTC: "{{ line_item.product.compare_at_price | money }}",
image: "{{ line_item.image | img_url: ‘medium’ }}",
currency: "EUROS",
quantite: "{{ line_item.quantity }}"
},
{% endfor %}
],
commandeTotalHT: "{{ order.total_price | divided_by: 1.2 | money }}",
commandeTotalTTC: "{{ order.total_price | money }}",
commandeId: "{{ order.order_number }}",
{%- assign codePromo = "" -%}
{% for discount_application in order.discount_applications %}
{%- assign codePromo = discount_application.title -%}
{% endfor %}
codepromo: "{{ codePromo }}",
instructions: "",
containerTagId: "{{ containter_tag_id_checkout }}",
device: /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d",
protocol : document.location.protocol,
page: window.location.href,
titre_page: document.title
};
if (typeof (TDConf) != "undefined") {
TDConf.sudomain = ("https:" == document.location.protocol) ? "swrap" : "wrap";
TDConf.host = ".tradedoubler.com/wrap";
TDConf.containerTagURL = (("https:" == document.location.protocol) ? "https://" : "http://") + TDConf.sudomain + TDConf.host;
if (typeof (TDConf.Config) != "undefined") {
if ($async) {
var TDAsync = document.createElement('script');
TDAsync.src = TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId;
TDAsync.async = "yes";
TDAsync.width = 0;
TDAsync.height = 0;
TDAsync.frameBorder = 0;
document.body.appendChild(TDAsync);
} else {
document.write(unescape("%3Cscript src='" + TDConf.containerTagURL + "?id=" + TDConf.Config.containerTagId + " ' type='text/javascript'%3E%3C/script%3E"));
}
}
}
</script>
{% comment %}
#####################################################
##### Fin Container TradeDoubleur
#####################################################
{% endcomment %}