E-Ticaret Panel
Mağazalar
Mağaza Düzenle
Mağaza Adı
XML Linki
Shopify Store Name
.myshopify.com
Access Token
API Version
2025-07 (En Güncel - Önerilen)
2025-04
2025-01
2024-10
2024-07
2024-04 (Legacy)
2024-01 (Legacy)
Mevcut: 2025-07
Kontrol Süresi
Saniye
Dakika
Saat
Gün
Product Path (Opsiyonel)
XML'de ürünlerin bulunduğu path
🏷️ Vendor (Marka) Filtreleme
📦 Tüm markalar işleniyor
← Ana sayfadan "Filtre Ekle" butonuyla vendor seçimi yapabilirsiniz
Converter Kodunuz
/** * PureScarfs XML -> Shopify CSV Converter * XML: https://purescarfs.com.tr/xml/?AltUrun=1&TamLink=1&Dislink=1&Seo=1&Imgs=1&start=0&limit=99999&pass=1234&R=350&K=b502¤cy=TRY * * XML Yapisi: * <products> * <product> * code, ws_code, barcode, name, product_link * cat1name, cat1code, category_path * stock, price_list, price_list_vat_included * price_special, price_special_vat_included * brand, model, weight, desi * detail, seo_title, seo_description * images -> img_item (array) * </product> * </products> */ module.exports = function convertPureScarfs(item, utils = {}) { // ============ HELPER FUNCTIONS ============ const trim = v => (v == null ? '' : String(v).trim()); const isUrl = u => /^https?:\/\//i.test(String(u || '')); const toNum = v => { if (v == null || v === '') return null; const str = String(v).replace(/\s/g, '').replace(',', '.'); const n = Number(str); return Number.isFinite(n) ? n : null; }; const money = v => { const n = toNum(v); return n == null || n <= 0 ? '0.00' : n.toFixed(2); }; const toInt = v => { const n = parseInt(String(v || '0').replace(/[^\d]/g, ''), 10); return Number.isFinite(n) && n >= 0 ? n : 0; }; const uniq = arr => Array.from(new Set((arr || []).filter(Boolean))); // Turkce karakter donusumu const turkishToLatin = s => String(s) .replace(/\u011f/g, 'g').replace(/\u011e/g, 'g') .replace(/\u00fc/g, 'u').replace(/\u00dc/g, 'u') .replace(/\u015f/g, 's').replace(/\u015e/g, 's') .replace(/\u0131/g, 'i').replace(/\u0130/g, 'i') .replace(/\u00f6/g, 'o').replace(/\u00d6/g, 'o') .replace(/\u00e7/g, 'c').replace(/\u00c7/g, 'c'); const slugify = (s = '') => { if (utils.slugify) return utils.slugify(s); return turkishToLatin(String(s)) .toLowerCase() .normalize('NFKD') .replace(/[\u0300-\u036f]/g, '') .replace(/[^a-z0-9]+/g, '-') .replace(/(^-|-$)/g, ''); }; const cleanHTML = (s = '') => String(s) .replace(/<script[\s\S]*?<\/script>/gi, '') .replace(/<style[\s\S]*?<\/style>/gi, '') .replace(/•/gi, '•') .replace(/ö/gi, 'o') .replace(/ü/gi, 'u') .replace(/Ö/gi, 'O') .replace(/Ü/gi, 'U') .replace(/ /gi, ' ') .replace(/\s+/g, ' ') .trim(); // xml2js array unwrapper const val = v => { if (Array.isArray(v)) return val(v[0]); if (v && typeof v === 'object' && '_' in v) return val(v._); return v; }; const toArray = v => { if (v == null) return []; return Array.isArray(v) ? v : [v]; }; // ============ XML WRAPPER UNWRAP ============ // Root wrapper kontrolu - products > product if (item.products) { const products = toArray(item.products.product || item.products); return products.flatMap(p => convertPureScarfs(p, utils)); } // Alternatif wrapper - product array if (item.product && !item.code && !item.name) { const products = toArray(item.product); return products.flatMap(p => convertPureScarfs(p, utils)); } // ============ SINGLE PRODUCT CONVERSION ============ // Temel alanlar const productId = trim(val(item.code)) || ''; const stockCode = trim(val(item.ws_code)) || trim(val(item.barcode)) || ''; const barcode = trim(val(item.barcode)) || ''; const brand = trim(val(item.brand)) || 'Pure Scarfs'; const title = trim(val(item.name)) || 'Isimsiz Urun'; const model = trim(val(item.model)) || ''; const productLink = trim(val(item.product_link)) || ''; // Kategori const categoryPath = trim(val(item.category_path)) || trim(val(item.cat1name)) || ''; const categoryParts = categoryPath.split(/[\/>,]/).map(s => s.trim()).filter(Boolean); const productType = categoryParts[categoryParts.length - 1] || categoryPath; // Stok const stock = toInt(val(item.stock)); // Fiyatlandirma - KDV dahil fiyatlari kullan const listPrice = toNum(val(item.price_list_vat_included)) || toNum(val(item.price_list)) || 0; const campaignPrice = toNum(val(item.price_list_campaign)) || 0; const specialPrice = toNum(val(item.price_special_vat_included)) || toNum(val(item.price_special)) || 0; // En dusuk gecerli fiyati bul let finalPrice = listPrice; let compareAtPrice = ''; // Kampanya fiyati kontrolu (oncelikli) if (campaignPrice > 0 && campaignPrice < listPrice) { finalPrice = campaignPrice; compareAtPrice = money(listPrice); } // Ozel fiyat kontrolu - sadece mantikli bir indirim ise kullan (liste fiyatinin %10'undan fazla olmali) else if (specialPrice > 0 && specialPrice < listPrice && specialPrice > (listPrice * 0.1)) { finalPrice = specialPrice; compareAtPrice = money(listPrice); } const variantPrice = money(finalPrice); // Agirlik const weight = toInt(val(item.weight)) || toInt(val(item.desi)) || 200; // Aciklama const description = cleanHTML(val(item.detail) || ''); // SEO const seoTitle = trim(val(item.seo_title)) || title; const seoDescription = trim(val(item.seo_description)) || description.replace(/<[^>]*>/g, ' ').substring(0, 160).trim(); // Gorseller const images = []; // images.img_item kontrolu let imgItems = item.images; if (Array.isArray(imgItems)) { imgItems = imgItems[0]; } if (imgItems && imgItems.img_item) { const imgArray = toArray(imgItems.img_item); imgArray.forEach(img => { const imgUrl = trim(val(img)); if (isUrl(imgUrl) && !images.includes(imgUrl)) { images.push(imgUrl); } }); } // Tek resim alanlari for (let i = 1; i <= 10; i++) { const imgUrl = trim(val(item['image' + i]) || val(item['resim' + i])); if (isUrl(imgUrl) && !images.includes(imgUrl)) { images.push(imgUrl); } } // Tags const tags = uniq([ brand, ...categoryParts, model ]).filter(Boolean).join(', '); // Handle olustur const handle = utils.toHandle ? utils.toHandle(productId + '-' + title) : slugify(productId + '-' + title); const PRODUCT_KEY = productId || handle; // Durum - stok varsa active const productStatus = 'active'; // ============ CSV SATIRLARI OLUSTUR ============ const rows = []; // Ana satir const mainRow = { __PRODUCT_KEY: PRODUCT_KEY, Handle: handle, Title: title, 'Body (HTML)': description, Vendor: brand, Type: productType, Tags: tags, Published: 'TRUE', 'Option1 Name': 'Title', 'Option1 Value': 'Default Title', 'Option2 Name': '', 'Option2 Value': '', 'Option3 Name': '', 'Option3 Value': '', 'Variant SKU': stockCode || productId, 'Variant Grams': weight, 'Variant Inventory Tracker': 'shopify', 'Variant Inventory Qty': stock, 'Variant Inventory Policy': 'deny', 'Variant Fulfillment Service': 'manual', 'Variant Price': variantPrice, 'Variant Compare At Price': compareAtPrice, 'Variant Requires Shipping': 'TRUE', 'Variant Taxable': 'TRUE', 'Variant Barcode': barcode, 'Image Src': images[0] || '', 'Image Position': images[0] ? '1' : '', 'Image Alt Text': images[0] ? title : '', 'Gift Card': 'FALSE', 'SEO Title': seoTitle.substring(0, 70), 'SEO Description': seoDescription.substring(0, 160), 'Google Shopping / Google Product Category': '', 'Google Shopping / Gender': 'unisex', 'Google Shopping / Age Group': 'adult', 'Google Shopping / MPN': stockCode || productId, 'Google Shopping / Condition': 'new', 'Variant Image': images[0] || '', 'Variant Weight Unit': 'g', 'Variant Tax Code': '', 'Cost per item': '', Status: productStatus }; rows.push(mainRow); // Ek gorseller (ilk gorsel haric) images.slice(1).forEach((src, idx) => { rows.push({ __PRODUCT_KEY: PRODUCT_KEY, Handle: handle, 'Image Src': src, 'Image Position': String(idx + 2), 'Image Alt Text': title }); }); return rows; };
Güncelle
İptal
İstatistikler
Toplam Çalışma
3393
Başarı Oranı
95%
İşlenen Ürün
0
Push Edilen
0