Skip to content

Instantly share code, notes, and snippets.

Все данные записываются в соответствующие системные блоки.
{{ block_lists.system--account-contact-phone.blocks }}
{{ block_lists.system--account-contact-phone2.blocks }}
{{ block_lists.system--account-email.blocks }}
{{ block_lists.system--logo.blocks }}
{{ block_lists.system--icon.blocks }}
{{ block_lists.system--address.blocks }}
{{ block_lists.system--address-point.blocks }}
{{ block_lists.system--pages.blocks }}
{{ block_lists.system--messengers.blocks }}
@vorvulev
vorvulev / toworrow.liquid
Created August 17, 2022 06:18
Set date to tomorrow in liquid
{% assign wday = 'now' | date: "%a" %}
{% if wday == 'Thu' %}
{% assign days = 2 | times: 86400 %}
{% else %}
{% assign days = 1 | times: 86400 %}
{% endif %}
{% assign deliverydate = 'now' | date: "%s" | plus: days | date: "%Y-%m-%d" %}
GET IT TOMORROW! ORDER WITHIN <span id="time">{{ deliverydate }}</span>
/?post_type=product&p={id}
@vorvulev
vorvulev / Api insales extended
Created March 22, 2022 19:32
Insales API products extended
ИЗМЕНЕНИЕ ПАРАМЕТРОВ ТОВАРА
Важный момент: передавать надо все параметры, если ранее установленный параметр не будет передан в запросе, то он будет удален.
Запрос: PUT /admin/products/#{id}.xml
<?xml version="1.0" encoding="UTF-8"?>
<product>
<id type="integer">41658</id>
<properties-attributes type="array">
@vorvulev
vorvulev / bus.js
Last active February 4, 2022 23:55
Triggers the variant in product card
EventBus.subscribe('products-ready:insales:common', function(data) {
$("[data-founded]").each(function(index, el) {
var pid = parseInt($(el).attr("data-product-id")),
vid = parseInt($(el).attr("data-founded"));
$(el).removeAttr('data-founded');
Products._products[pid]._instance[0].variants.setVariant(vid);
});
});
EventBus.subscribe('change_variant:insales:product', function(data) {
@vorvulev
vorvulev / multiline_elipsis.css
Created April 23, 2020 06:50
Multiline elipsis with overflow
.block-ellipsis {
display: block;
display: -webkit-box;
max-width: 100%;
height: 43px;
margin: 0 auto;
font-size: 14px;
line-height: 1;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
$.ajaxSetup({
beforeSend: function (xhr,settings) {
var str = settings.url;
if(str.indexOf('https://insales.boxberry.ru/box/insales/get-price-courier.php') + 1) {
settings.url = str.replace(/zip/g,'zip_none');
$('#order_delivery_variant_id_1302944').on('updated:insales:delivery', function(e) {
if(e.originalEvent.detail.available == true){
$(this).parent().parent().css({'display': 'table-row', 'visibility': 'visible'})
}else{
$(this).parent().parent().css({'display': 'none', 'visibility': 'hidden'})
(function() {
window.addEventListener('scroll', function(event) {
var depth, i, layer, layers, len, movement, topDistance, translate3d;
topDistance = this.pageYOffset;
layers = document.querySelectorAll("[data-type='parallax']");
for (i = 0, len = layers.length; i < len; i++) {
layer = layers[i];
depth = layer.getAttribute('data-depth');
movement = -(topDistance * depth);
translate3d = 'translate3d(0, ' + movement + 'px, 0)';
{% assign root = product.collections | sort: 'level' %}{{ root.last.title }}
@vorvulev
vorvulev / unicode2.txt
Last active September 9, 2020 20:52
unicode decoding table
\u0430|а
\u0410|А
\u0431|б
\u0411|Б
\u0432|в
\u0412|В
\u0433|г
\u0413|Г
\u0434|д
\u0414|Д