document.addEventListener('DOMContentLoaded', function () { if (typeof PI_VENDOR_COUNTRIES === 'undefined') return; const select = document.getElementById('pi-country-select'); if (!select) return; // Populate select PI_VENDOR_COUNTRIES.forEach(c => { const opt = document.createElement('option'); opt.value = c.code; opt.innerHTML = `🏳️‍🇺‍🇸 ${c.name}`; opt.textContent = c.name; select.appendChild(opt); }); // Change handler → trigger Filter Everything select.addEventListener('change', function () { const code = this.value; // Reset all vendor_country filters first document .querySelectorAll('[data-taxonomy="vendor_country"] input[type="checkbox"]') .forEach(cb => cb.checked = false); if (code) { const target = document.querySelector( `[data-taxonomy="vendor_country"] input[value="${code}"]` ); if (target) { target.checked = true; } } // Trigger Filter Everything update document.dispatchEvent(new Event('fe:update')); }); }); //продолжение // document.addEventListener('DOMContentLoaded', function () { const el = document.getElementById('pi-country-select'); if (!el || typeof TomSelect === 'undefined' || typeof PI_VENDOR_COUNTRIES === 'undefined') return; const ts = new TomSelect(el, { valueField: 'value', labelField: 'label', searchField: ['label'], options: PI_VENDOR_COUNTRIES, allowEmptyOption: true, placeholder: 'All countries', closeAfterSelect: true, render: { option: function (item, escape) { return `
${escape(item.label)}
`; }, item: function (item, escape) { return `
${escape(item.label)}
`; } }, onChange: function (value) { // reset all vendor_country checkboxes document .querySelectorAll('[data-taxonomy="vendor_country"] input[type="checkbox"]') .forEach(cb => cb.checked = false); if (value) { const target = document.querySelector( `[data-taxonomy="vendor_country"] input[value="${value}"]` ); if (target) target.checked = true; } // trigger Filter Everything refresh document.dispatchEvent(new Event('fe:update')); } }); }); //продолжение document.addEventListener('DOMContentLoaded', function () { const countrySelect = document.getElementById('pi-country-select'); if (!countrySelect) return; function applyCountryFilter(countryCode) { // Filter Everything items const filterItems = document.querySelectorAll( '[data-term-slug], input[data-slug]' ); let found = false; filterItems.forEach(item => { const slug = item.dataset.termSlug || item.dataset.slug || item.value; if (!slug) return; if (slug.toLowerCase() === countryCode.toLowerCase()) { found = true; // radio / checkbox if (item.tagName === 'INPUT') { if (!item.checked) { item.click(); } } else { item.click(); } } }); // Если страна выбрана, но товаров нет if (!found && countryCode !== '') { console.warn('No products for selected country:', countryCode); } } function resetCountryFilter() { const checked = document.querySelectorAll( '[data-term-slug].checked, input[data-slug]:checked' ); checked.forEach(item => { if (item.checked) { item.click(); } }); } countrySelect.addEventListener('change', function () { const value = this.value; if (!value) { resetCountryFilter(); } else { applyCountryFilter(value); } }); }); document.addEventListener('DOMContentLoaded', function () { if (!window.PI_VENDOR_COUNTRIES) return; const select = document.getElementById('pi-country-select'); if (!select) return; window.PI_VENDOR_COUNTRIES.forEach(country => { const option = document.createElement('option'); option.value = country.code; option.textContent = country.name; option.dataset.flag = country.flag; select.appendChild(option); }); }); document.addEventListener('change', function (e) { if (e.target.id !== 'pi-country-select') return; const country = e.target.value; const url = new URL(window.location.href); if (country) { url.searchParams.set('vendor_country', country); } else { url.searchParams.delete('vendor_country'); } window.location.href = url.toString(); });
 
✳️ Trova ricambi, servizi ed esperti per la stampa

CONSULENZE | ASSISTENZA | LIBERI PROFESSIONISTI | ATTREZZATURE | AGGIORNAMENTI✳️ B2B Marketplace for Printers

Utilizza i filtri o i pulsanti delle categorie per restringere rapidamente la ricerca.