<script src="https://app.salesbeat.pro/static/widget/js/widget.js" charset="UTF-8"></script>
<div id="salesbeat-deliveries-1" class="salesbeat-deliveries"></div>
<script>
SB.init({
token: 'your API token',
price_to_pay: 5000,
price_insurance: 5000,
weight: 200,
x: 20,
y: 10,
z: 3,
quantity: 2,
city_by: 'ip',
params_by: 'params',
main_div_id: 'salesbeat-deliveries-1',
callback: function(){
console.log('Salesbeat is ready!');
}
});
</script>
<ul class="quantity" data-sb-quantity data-sb-widget-id="salesbeat-deliveries-1">
<li class="quantity__btn" data-sb-quantity-control>-</li>
<li><input type="text" value="1" class="quantity__input" data-sb-quantity-input></li>
<li class="quantity__btn" data-sb-quantity-control>+</li>
</ul>
<!-- BEGIN SALESBEAT CART-WIDGET -->
<script src="https://app.salesbeat.pro/static/widget/js/widget.js"></script>
<script src="https://app.salesbeat.pro/static/widget/js/cart_widget.js"></script>
<div id="sb-cart-widget"></div>
<script>
SB.init_cart({
token: 'your API token',
city_by: 'city_code',
city_code: '8f9faad4-ff93-471d-b0c0-c8e5c0162dee',
products: [{price_to_pay: 1400, price_insurance: 1400, weight: 200, quantity: 1},
{price_to_pay: 3440, price_insurance: 3440, weight: 500, quantity: 2}],
callback: function(data) {
console.log('Клиент выбрал доставку:', data)
}
})
</script>
<!-- END SALESBEAT CART-WIDGET -->
<!-- BEGIN SALESBEAT CART-WIDGET -->
<script src="https://app.salesbeat.pro/static/widget/js/widget.js"></script>
<script src="https://app.salesbeat.pro/static/widget/js/cart_widget.js"></script>
<div id="sb-cart-widget"></div>
<script>
SB.init_cart({
token: 'your API token',
city_by: 'city_code',
city_code: '8f9faad4-ff93-471d-b0c0-c8e5c0162dee',
products: [{price_to_pay: 1400, price_insurance: 1400, weight: 200, quantity: 1},
{price_to_pay: 3440, price_insurance: 3440, weight: 500, quantity: 2}],
callback: function(data) {
console.log('Клиент выбрал доставку:', data)
}
},{
pvz_id: '76111', // идентификатор ПВЗ
delivery_method_id: 'boxberry_pvz' // идентификатор способа доставки
})
</script>
<!-- END SALESBEAT CART-WIDGET -->
<!-- BEGIN SALESBEAT CART-WIDGET -->
<script src="https://app.salesbeat.pro/static/widget/js/widget.js"></script>
<script src="https://app.salesbeat.pro/static/widget/js/cart_widget.js"></script>
<div id="sb-cart-widget"></div>
<script>
SB.init_cart({
token: 'your API token',
city_by: 'city_code',
city_code: '8f9faad4-ff93-471d-b0c0-c8e5c0162dee',
products: [{price_to_pay: 1400, price_insurance: 1400, weight: 200, quantity: 1},
{price_to_pay: 3440, price_insurance: 3440, weight: 500, quantity: 2}],
callback: function(data) {
console.log('Клиент выбрал доставку:', data)
}
},{
delivery_method_id: 'boxberry_pvz', // идентификатор способа доставки
street: "проспект Строителей", // улица
house: "182", // дом
house_block: "", // корпус
flat: "", // квартира
index: "", // почтовый индекс
comment: 'Привезите побыстрей!' // комментарий
})
</script>
<!-- END SALESBEAT CART-WIDGET -->
<!-- BEGIN SALESBEAT CART-PVZ-MAP -->
<script src="https://app.salesbeat.pro/static/widget/js/widget.js"></script>
<script src="https://app.salesbeat.pro/static/widget/js/cart_widget.js"></script>
<div id="sb-cart-pvz-map" class="sb-fullscreen-map"></div>
<script>
SB.show_pvz_map({
token: 'your API token',
city_by: 'city_code',
city_code: '8f9faad4-ff93-471d-b0c0-c8e5c0162dee',
pvz_map_id: 'sb-cart-pvz-map',
products: [{price_to_pay: 1400, price_insurance: 1400, weight: 200, quantity: 1},
{price_to_pay: 3440, price_insurance: 3440, weight: 500, quantity: 2}],
callback: function(data) {
console.log('Клиент выбрал доставку:', data)
}
})
</script>
<!-- END SALESBEAT CART-PVZ-MAP -->
<!-- BEGIN SALESBEAT CITY-CHOICE-WIDGET -->
<div id="sb-header-city-choice-widget"></div>
<script>
SB.init_city_choice({
token: 'your API token',
city_choice_element_id: 'sb-header-city-choice-widget',
short_name_showed: true
})
</script>
<!-- END SALESBEAT CITY-CHOICE-WIDGET-->
// Пример использования:
document.addEventListener('sbCartWidgetRendered', function(event) {
console.log('Данные о доставке по умолчанию тут:', event.detail)
})
// С jQuery:
$(document).on('sbCityChanged', function(event) {
console.log('Данные о новом городе тут:', event.originalEvent.detail)
})