', LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL); $channel = $xml->addChild('channel'); $channel->addChild('title', 'Rovicky'); $channel->addChild('link', 'https://rovicky.eu/'); $channel->addChild('description', 'Rovicky - sklep internetowy z odzieżą'); $channel->addChild('language', 'pl'); $channel->addChild('generator', 'Rovicky'); $channel->addChild('lastBuildDate', date('r')); $file = file_get_contents('https://rovicky.eu/data/export/feed10005_13d435cb09783ede936d4703.xml'); $products = new SimpleXMLElement($file); foreach ($products->products->product as $product) { // echo '
' . print_r($product, true) . '
'; exit; foreach ( $product->sizes->size as $size ) { $item = $channel->addChild('item'); $item->addChild('g:id', (string)$size['code'], 'http://base.google.com/ns/1.0'); $item->addChild('title', $product->description->name); $item->addChild('g:link', $product->card['url'], 'http://base.google.com/ns/1.0'); $item->addChild('g:image_link', $product->images->large->image[0]['url'], 'http://base.google.com/ns/1.0'); $item->addChild('g:gtin', (string)$size['code_producer'], 'http://base.google.com/ns/1.0'); $item->addChild('g:product_type', $product->category_idosell['path'], 'http://base.google.com/ns/1.0'); $item->addChild('g:condition', 'new', 'http://base.google.com/ns/1.0'); $item->addChild('g:availability', $size['available'], 'http://base.google.com/ns/1.0'); // price $item->addChild('g:price', $size -> price['gross'] . ' PLN', 'http://base.google.com/ns/1.0'); // brand $item->addChild('g:brand', $product -> producer['name'], 'http://base.google.com/ns/1.0'); // size $item->addChild('g:size', $size['name'], 'http://base.google.com/ns/1.0'); // g:item_group_id $item -> addChild('g:item_group_id', $product['id'], 'http://base.google.com/ns/1.0'); // g:shipping_weight $item -> addChild('g:shipping_weight', $size['weight'] . ' g', 'http://base.google.com/ns/1.0'); } } $xml->asXml('feed-main.xml'); echo '

wygenerowano https://cdn.projectpro.pl/rovicky-pl/feed-main.xml

';