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
module.exports = function convertPureScarfs (root, utils = {}) { /* ────────────────── ERKEN ÇIKIŞLAR ────────────────── */ if (!root) return []; /* ---------------- Ürün listesi çıkar ---------------- */ let list = []; if (root.products?.product) { list = Array.isArray(root.products.product) ? root.products.product : [root.products.product]; } else if (root.product) { list = Array.isArray(root.product) ? root.product : [root.product]; } else { list = [root]; } return processProductList(list); /* ---------------- XML → CSV satırları ---------------- */ function processProductList (products) { /* ──────────────── YARDIMCILAR ──────────────── */ const get = v => { if (v == null) return ''; if (Array.isArray(v)) return get(v[0]); if (typeof v === 'object') { if ('_' in v) return get(v._); if ('#text' in v) return get(v['#text']); if (typeof v.$ === 'string') return v.$.trim(); const vals = Object.values(v); if (vals.length === 1 && typeof vals[0] === 'string') return vals[0].trim(); return get(vals[0]); } return String(v).trim(); }; // Eski price() kalsın ama TRY için ayrı fonksiyon kullanacağız const price = v => { const n = Number(String(v || '').replace(',', '.')); return Number.isFinite(n) ? n.toFixed(2) : '0.00'; }; // USD sayıya çevir const numUSD = v => { const n = Number(String(v || '').replace(',', '.')); return Number.isFinite(n) ? n : 0; }; const url = u => (/^https?:\/\//i.test((u || '').trim()) ? u.trim() : ''); const slug = s => String(s) .toLowerCase() .replace(/[ğĞ]/g, 'g') .replace(/[üÜ]/g, 'u') .replace(/[şŞ]/g, 's') .replace(/[ıİ]/g, 'i') .replace(/[öÖ]/g, 'o') .replace(/[çÇ]/g, 'c') .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, ''); const uniq = arr => [...new Set(arr.filter(Boolean))]; // ✅ XML Parser'a uyumlu imagesOf fonksiyonu (seninle aynı) const imagesOf = obj => { if (!obj || typeof obj !== 'object' || !obj.images) return []; let images = obj.images; const urls = new Set(); if (Array.isArray(images)) { if (images.length === 0) return []; images = images[0]; } if (!images || typeof images !== 'object') return []; if (Array.isArray(images.img_item)) { images.img_item.forEach(item => { const imgUrl = url(get(item)); if (imgUrl) urls.add(imgUrl); }); } else if (typeof images.img_item === 'string') { const imgUrl = url(images.img_item.trim()); if (imgUrl) urls.add(imgUrl); } else if (images.img_item && typeof images.img_item === 'object') { const keys = Object.keys(images.img_item); const numericKeys = keys.filter(k => /^\d+$/.test(k)).sort((a, b) => parseInt(a) - parseInt(b)); if (numericKeys.length > 0) { numericKeys.forEach(key => { const imgUrl = url(get(images.img_item[key])); if (imgUrl) urls.add(imgUrl); }); } else { const imgUrl = url(get(images.img_item)); if (imgUrl) urls.add(imgUrl); } } const imgKeys = Object.keys(images).filter(k => k.startsWith('img_item')); if (imgKeys.length > 1) { imgKeys.forEach(key => { const imgUrl = url(get(images[key])); if (imgUrl) urls.add(imgUrl); }); } const imageKeys = Object.keys(images).filter(k => /^(image|img|picture)\d*$/i.test(k) || /^(image|img|picture)_?(item|url|src|path)\d*$/i.test(k) ); if (imageKeys.length > 0) { imageKeys.forEach(key => { const imgUrl = url(get(images[key])); if (imgUrl) urls.add(imgUrl); }); } if (images.images) { const nestedUrls = imagesOf({images: images.images}); nestedUrls.forEach(imgUrl => urls.add(imgUrl)); } return Array.from(urls); }; /* ───────────── Kur ve Set ayarları ───────────── */ const USD_TRY = 40.5; // sabit kur const PACK_SIZE = 5; // set adedi const packTRY = usd => (usd * USD_TRY * PACK_SIZE).toFixed(2); /* ──────────────── CSV üretimi ──────────────── */ const rows = []; products.forEach(prod => { const main = prod; const code = get(main.code) || get(main.ws_code) || 'NO-CODE'; const name = get(main.name) || `Ürün-${code}`; const vendor = get(main.brand) || 'Pure Scarfs'; const type = get(main.cat1name) || get(main.model) || ''; const cat = get(main.category_path) || get(main.cat1name) || ''; const body = get(main.detail) || ''; const seoT = get(main.seo_title) || name; const seoD = get(main.seo_description) || ''; const tags = uniq([cat, type, 'Toptan', `${PACK_SIZE}’li Set`]).join(', '); const weight = 50; const handle = slug(`${code}-${name}`); const images = imagesOf(main); const base = () => ({ Handle: handle, Title: '', 'Body (HTML)': '', Vendor: '', Type: '', Tags: '', Published: 'TRUE', 'Option1 Name': '', 'Option1 Value': '', 'Option2 Name': '', 'Option2 Value': '', 'Option3 Name': '', 'Option3 Value': '', 'Variant SKU': '', 'Variant Grams': weight, 'Variant Inventory Tracker': 'shopify', 'Variant Inventory Qty': 0, 'Variant Inventory Policy': 'deny', 'Variant Fulfillment Service': 'manual', 'Variant Price': '0.00', 'Variant Compare At Price': '', 'Variant Requires Shipping': 'TRUE', 'Variant Taxable': 'TRUE', 'Variant Barcode': '', 'Image Src': '', 'Image Position': '', 'Image Alt Text': '', 'Gift Card': 'FALSE', 'SEO Title': seoT, 'SEO Description': seoD, 'Google Shopping / Google Product Category': '', 'Google Shopping / Gender': 'unisex', 'Google Shopping / Age Group': 'adult', 'Google Shopping / MPN': '', 'Google Shopping / AdWords Grouping': '', 'Google Shopping / AdWords Labels': '', 'Google Shopping / Condition': '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': '', 'Variant Weight Unit': 'g', 'Variant Tax Code': '', 'Cost per item': '', Status: 'active' }); let imgPos = 1; /* ----------- Ana varyant satırı ----------- */ const row = base(); row.Title = name; // Açıklama: net set notu + orijinal içerik (hesap/adet fiyatı yazmıyoruz) const notice = ` <div style="padding:8px;border:1px solid #eee;border-radius:8px;margin-bottom:8px;"> <strong>TOPTAN / SET SATIŞ:</strong> Bu ürün <strong>${PACK_SIZE} adetlik set</strong> halinde satılır. Görünen fiyat <strong>${PACK_SIZE} adet için toplam</strong> fiyattır. </div> `; row['Body (HTML)'] = notice + body; row.Vendor = vendor; row.Type = type; row.Tags = tags; // Renk/varyant analizi const parts = name.split(/\s*[-–—]\s*/); if (parts.length > 1) { const color = parts.slice(1).join(' - ').trim(); if (color) { row['Option1 Name'] = 'Renk'; row['Option1 Value'] = color; } } const sku = get(main.ws_code) || get(main.code) || code; row['Variant SKU'] = sku; row['Variant Barcode'] = get(main.barcode) || ''; row['Variant Inventory Qty'] = Math.min(parseInt(get(main.stock) || '0', 10) || 0, 999); // >>> FİYAT: USD → TRY × 5 (set) const usdBase = numUSD(get(main.price_list)) || numUSD(get(main.price_list_vat_included)) || numUSD(get(main.price_list_campaign)); row['Variant Price'] = packTRY(usdBase); // 5’li set toplam TRY // İlk görseli ana satıra ekle if (images.length > 0) { row['Variant Image'] = images[0]; row['Image Src'] = images[0]; row['Image Position'] = imgPos++; row['Image Alt Text'] = name; } rows.push(row); // Kalan görselleri ek satırlar if (images.length > 1) { images.slice(1).forEach(src => { const ir = base(); // image-only satır: sadece görsel alanları ir.Title = ir['Body (HTML)'] = ir.Vendor = ir.Type = ir.Tags = ''; ir.Published = ir.Status = ''; ir['Option1 Name'] = ir['Option1 Value'] = ''; ir['Variant SKU'] = ir['Variant Grams'] = ''; ir['Variant Inventory Tracker'] = ''; ir['Variant Inventory Qty'] = ''; ir['Variant Inventory Policy'] = ''; ir['Variant Fulfillment Service'] = ''; ir['Variant Price'] = ''; ir['Variant Compare At Price'] = ''; ir['Variant Requires Shipping'] = ''; ir['Variant Taxable'] = ''; ir['Variant Barcode'] = ''; ir['Variant Image'] = ''; ir['Variant Weight Unit'] = ''; ir['SEO Title'] = ir['SEO Description'] = ''; ir['Image Src'] = src; ir['Image Position'] = imgPos++; ir['Image Alt Text'] = name; rows.push(ir); }); } }); // Duplicate görsel kontrolü - aynı handle + aynı image src tekrarlarını at const uniqueRows = []; const seen = new Set(); rows.forEach(row => { if (row['Image Src']) { const key = `${row.Handle}|||${row['Image Src']}`; if (!seen.has(key)) { seen.add(key); uniqueRows.push(row); } } else { uniqueRows.push(row); } }); return uniqueRows; } };
Güncelle
İptal
İstatistikler
Toplam Çalışma
4633
Başarı Oranı
96%
İşlenen Ürün
0
Push Edilen
0