<script type="text/javascript">
$(window).load(function () {
var i = setInterval(function () {
if (mgr_api != {}) {
clearInterval(i);
const order = {
order_id: {{ order.id }},
order_price: {{ order.total_price }},
products: [
{% for item in order.items %}
{
id: {{ item.product.id }},
price: {{ item.total_price.with_margin }},
amount: {{ item.quantity }}
}
{% endfor %}
]
};
mgr_api.track('purchase', order);
}
}, 100);
});
</script>
<script type="text/javascript">
const mg_track_product = {
id: '{{ product.id }}',
name: '{{ product.title }}',
price: {{ product.price }},
categories: ['3304487'],
image: '{{ product.first_image.compact_url }}',
url: '{{ account.url }}{{ product.canonical_url }}'
};
$(window).load(function () {
var i = setInterval(function () {
if (mgr_api != {}) {
clearInterval(i);
mgr_api.track("view", mg_track_product);
$('.buybutton').on('click', function () {
mgr_api.track("add_cart", mg_track_product);
});
}
}, 100);
});
</script>
<script type="text/javascript">
$(window).load(function () {
var i = setInterval(function () {
if (mgr_api != {}) {
clearInterval(i);
$('.minicartdel').on('click', function () {
mgr_api.track("remove_cart", $(this).attr('iid').split('_')[1]);
});
}
}, 100);
});
</script>
{% if client %}
$.getJSON('/client_account/contacts.json', function(contacts) {
var mg_email = contacts.client.email;
var mgr_api = {};
console.debug('MG track client email:', contacts.client.email);
(function () {
var script = document.createElement('script');
var b = '';
if (typeof this.href != "undefined") {
b = this.href.toString().toLowerCase()
} else {
b = document.location.toString().toLowerCase()
}
;
script.src = "https://mailganer.com/jsapi/r/ХХХ?ref=" + document.referrer + "&url=" + b + "&nc=" + Math.random();
script.async = true;
script.onload = function () {
mgr_api = new MGApi();
mgr_api.auth(mg_email);
};
document.getElementsByTagName('head')[0].appendChild(script);
})();
});
{% else %}
var mg_email = '';
var mgr_api = {};
(function () {
var script = document.createElement('script');
var b = '';
if (typeof this.href != "undefined") {
b = this.href.toString().toLowerCase()
} else {
b = document.location.toString().toLowerCase()
}
;
script.src = "https://mailganer.com/jsapi/r/XXX?ref=" + document.referrer + "&url=" + b + "&nc=" + Math.random();
script.async = true;
script.onload = function () {
mgr_api = new MGApi();
mgr_api.auth(mg_email);
};
document.getElementsByTagName('head')[0].appendChild(script);
})();
{% endif %}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE yml_catalog SYSTEM "shops.dtd">
<yml_catalog date="{{'now' | date: '%Y-%m-%d %H:%M'}}">
<shop>
<name>{{marketplace.shop_name}}</name>
<company>{{marketplace.company}}</company>
<url>{{marketplace.url}}</url>
<platform>InSales</platform>
<currencies>
{% for currency in currencies %}
<currency id="{{currency.id}}" rate="{{currency.rate}}" {% if currency.plus %}plus="{{currency.plus}}" {% endif %} />
{% endfor %}
</currencies>
<categories>
{% for collection in collections %}
<category id="{{collection.id}}" {% if collection.parent_id %}parentId="{{collection.parent_id}}"{% endif %} url="{{marketplace.url}}/collection/{{collection.handle}}">{{collection.title}}</category>
{% endfor %}
</categories>
{% if delivery_options != empty %}
<delivery-options>
{% for option in delivery_options %}
<option cost="{{option.cost}}" days="{{option.days}}" {% if option.order-before %}order-before="{{option.order-before}}" {% endif %} />
{% endfor %}
</delivery-options>
{% endif %}
<offers>
{{content_for_layout}}
</offers>
<promos>
{% for promo in promos %}
<promo id="{{promo.id}}" type="promo code">
{% if promo.start_date %}
<start-date>{{promo.start_date}}</start-date>
{% endif %}
{% if promo.end_date %}
<end-date>{{promo.end_date}}</end-date>
{% endif %}
{% if promo.description %}
<description>{{promo.description}}</description>
{% endif %}
{% if promo.url %}
<url>{{promo.url}}</url>
{% endif %}
<promo-code>{{promo.code}}</promo-code>
<discount {% if promo.percent? %}unit="percent"{% else %}unit="currency" currency="{{currency}}"{% endif %}>
{{promo.discount}}
</discount>
<purchase>
{% for offer_id in promo.matching_offers_ids %}
<product offer-id="{{offer_id}}" />
{% endfor %}
</purchase>
</promo>
{% endfor %}
</promos>
</shop>
</yml_catalog>
<offer type="vendor.model" available="{% if product.available %}true{% else %}false{% endif %}" id="{{product.id}}" >
<url>{{account.url}}/product_by_id/{{product.id}}</url>
<price>{{product.price}}</price>
<oldprice>{{product.old_price}}</oldprice>
<currencyId>{{product.currency_id}}</currencyId>
<categoryId>{{collection.id}}</categoryId>
{%for image in product.images limit: 1 %}
<picture>{{image.url}}</picture>
{% endfor %}
<vendor>{{product.properties.vendor}}</vendor>
<model>{{product.title}}</model>
<description>{{product.description}}</description>
</offer>