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
/** * Daniel Bebeto (ButikSistem) XML -> Shopify CSV Converter * XML: https://bebeto.butiksistem.com/xml/product * * XML Yapisi: * <Products> * <Product> * id, name, model_code, color_code, color_name * type_id, type_name, brand * image, image2, image3, image4, image5, image6, image7, image8 * price, market_price, cost_price * details, status, stock, tax_rate * variants -> variant[] (id, name, quantity, price, barcode) * </Product> * </Products> */ module.exports = function convertBebeto(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(/\r\n/g, ' ') .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]; }; // Beden siralama const SIZE_ORDER = ['XXS', 'XS', 'S', 'M', 'L', 'XL', '2XL', 'XXL', '3XL', '4XL', '5XL']; const sizeRank = s => { const u = String(s || '').toUpperCase().trim(); const i = SIZE_ORDER.indexOf(u); return i === -1 ? 999 : i; }; // ============ XML WRAPPER UNWRAP ============ // Root wrapper kontrolu - Products > Product if (item.Products) { const products = toArray(item.Products.Product || item.Products); return products.flatMap(p => convertBebeto(p, utils)); } // Alternatif wrapper - Product array if (item.Product && !item.id && !item.name) { const products = toArray(item.Product); return products.flatMap(p => convertBebeto(p, utils)); } // ============ SINGLE PRODUCT CONVERSION ============ // Temel alanlar const productId = trim(val(item.id)) || ''; const productName = trim(val(item.name)) || 'Isimsiz Urun'; const modelCode = trim(val(item.model_code)) || ''; const colorCode = trim(val(item.color_code)) || ''; const colorName = trim(val(item.color_name)) || ''; const brand = trim(val(item.brand)) || 'Bebeto Tekstil'; const typeName = trim(val(item.type_name)) || ''; // Baslik olustur (isim + renk) const title = colorName ? `${productName} - ${colorName}` : productName; // SKU olustur (model_code + color_code) const baseSku = modelCode && colorCode ? `${modelCode}-${colorCode}` : (modelCode || productId); // Kategori const productType = typeName || 'Gomlek'; // Durum kontrolu const status = trim(val(item.status)); const productStatus = status === '1' ? 'active' : 'draft'; // Toplam stok const totalStock = toInt(val(item.stock)); // Fiyatlar const basePrice = toNum(val(item.price)) || 0; const marketPrice = toNum(val(item.market_price)) || 0; // Compare at price (market_price > price ise) let compareAtPrice = ''; if (marketPrice > 0 && marketPrice > basePrice) { compareAtPrice = money(marketPrice); } // Aciklama const description = cleanHTML(val(item.details) || ''); // Gorseller const images = []; // image, image2, image3... image8 const mainImage = trim(val(item.image)); if (isUrl(mainImage)) { images.push(mainImage); } for (let i = 2; i <= 8; i++) { const imgUrl = trim(val(item['image' + i])); if (isUrl(imgUrl) && !images.includes(imgUrl)) { images.push(imgUrl); } } // Tags const tags = uniq([ brand, typeName, colorName ]).filter(Boolean).join(', '); // Handle olustur const handle = utils.toHandle ? utils.toHandle(productId + '-' + title) : slugify(productId + '-' + title); const PRODUCT_KEY = productId || handle; // ============ VARYANT ISLEME ============ let variants = []; // variants.variant kontrolu let variantsNode = item.variants; if (Array.isArray(variantsNode)) { variantsNode = variantsNode[0]; } if (variantsNode && variantsNode.variant) { const variantArray = toArray(variantsNode.variant); variants = variantArray .map(v => ({ id: trim(val(v.id)), name: trim(val(v.name)) || 'STD', quantity: toInt(val(v.quantity)), price: toNum(val(v.price)) || basePrice, barcode: trim(val(v.barcode)) })) .filter(v => v.name); // Bos isimli varyantlari filtrele } // Varyant yoksa varsayilan olustur if (variants.length === 0) { variants = [{ id: productId, name: 'STD', quantity: totalStock, price: basePrice, barcode: '' }]; } // Bedenleri sirala variants.sort((a, b) => sizeRank(a.name) - sizeRank(b.name)); // ============ CSV SATIRLARI OLUSTUR ============ const rows = []; variants.forEach((variant, idx) => { const isFirst = idx === 0; const variantSku = baseSku ? `${baseSku}-${variant.name}` : `${productId}-${variant.name}`; const variantPrice = money(variant.price); const row = { __PRODUCT_KEY: PRODUCT_KEY, Handle: handle, Title: isFirst ? title : '', 'Body (HTML)': isFirst ? description : '', Vendor: isFirst ? brand : '', Type: isFirst ? productType : '', Tags: isFirst ? tags : '', Published: 'TRUE', 'Option1 Name': isFirst ? 'Beden' : '', 'Option1 Value': variant.name, 'Option2 Name': '', 'Option2 Value': '', 'Option3 Name': '', 'Option3 Value': '', 'Variant SKU': variantSku, 'Variant Grams': 200, 'Variant Inventory Tracker': 'shopify', 'Variant Inventory Qty': variant.quantity, 'Variant Inventory Policy': 'deny', 'Variant Fulfillment Service': 'manual', 'Variant Price': variantPrice, 'Variant Compare At Price': isFirst ? compareAtPrice : '', 'Variant Requires Shipping': 'TRUE', 'Variant Taxable': 'TRUE', 'Variant Barcode': variant.barcode, 'Image Src': isFirst && images[0] ? images[0] : '', 'Image Position': isFirst && images[0] ? '1' : '', 'Image Alt Text': isFirst && images[0] ? `${title} ${variant.name}` : '', 'Gift Card': 'FALSE', 'SEO Title': isFirst ? title.substring(0, 70) : '', 'SEO Description': isFirst ? description.replace(/<[^>]*>/g, ' ').substring(0, 160).trim() : '', 'Google Shopping / Google Product Category': '', 'Google Shopping / Gender': isFirst ? 'unisex' : '', 'Google Shopping / Age Group': isFirst ? 'adult' : '', 'Google Shopping / MPN': variantSku, 'Google Shopping / AdWords Grouping': '', 'Google Shopping / AdWords Labels': '', 'Google Shopping / Condition': isFirst ? 'new' : '', 'Google Shopping / Custom Product': '', 'Google Shopping / Custom Label 0': '', 'Google Shopping / Custom Label 1': '', 'Google Shopping / Custom Label 2': '', 'Google Shopping / Custom Label 3': '', 'Google Shopping / Custom Label 4': '', 'Variant Image': isFirst && images[0] ? images[0] : '', 'Variant Weight Unit': 'g', 'Variant Tax Code': '', 'Cost per item': '', Status: isFirst ? productStatus : '' }; rows.push(row); }); // 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
3450
Başarı Oranı
92%
İşlenen Ürün
0
Push Edilen
0