akvariuz Posted November 30, 2024 at 09:36 PM Share Posted November 30, 2024 at 09:36 PM (edited) Есть ли какой-нибудь модуль, ктороый бы формировал YML для импорта товаров в VK. Сейчас стоит какой-то на Яндекс товары, но он не подходит, VK его не берет. Или может есть кто-то, кто может подправить, чтобы подошел...? Сейчас стоит такой код для YML: //headerXML $xml .= '<yml_catalog date="' . date('Y-m-d H:i', time()) . '">'; $xml .= '<shop>'; $xml .= '<url>' . HTTPS_SERVER . '</url>'; $xml .= '<name>' . $this->config->get('config_name') . '</name>'; $xml .= '<company>' . $startup['name'] . '</company>'; $xml .= '<phone>' . $this->config->get('config_telephone') . '</phone>'; $xml .= '<currencies>'; $xml .= '<currency id="RUB" rate="1"></currency>'; $xml .= '</currencies>'; if($startup['categories_xml']) { $xml .= '<categories>'; foreach($startup['categories_xml'] as $category) { if($category['parent_id']){ $xml .= '<category id="' . $category['category_id'] .'" parentId="' . $category['parent_id'] . '">' . $category['name'] .'</category>'; } else{ $xml .= '<category id="' . $category['category_id'] .'">' . $category['name'] .'</category>'; } } $xml .= '</categories>'; } if($startup['delivery_cost'] !== false) { $xml .= '<delivery-options><option cost="' . $startup['delivery_cost'] . '" days="' . $startup['delivery_time'] . '" order-before="' . $startup['delivery_jump'] . '"></option></delivery-options>'; } $xml .= '<offers>'; $xml = $this->unixml->exportToXml($startup, $xml, "start"); //headerXML //generateXML for($startup['iteration'] = 0; 1; $startup['iteration']++){ $controller_data = $this->load->controller($controller, $startup); $startup['stat'] = $controller_data['data']['stat']; if($controller_data['products']){ foreach($controller_data['products'] as $product_id => $product){ $group_id = ''; if(isset($product['group_id'])){ $group_id = 'group_id="' . $product['group_id'] . '"'; } $xml .= '<offer id="' . $product_id . '" available="' . ($product['stock']?'true':'') .'" ' . $group_id . '>'; $xml .= '<name>' . $product['name'] . '</name>'; $xml .= '<vendorCode>' . $product['model'] . '</vendorCode>'; $xml .= '<url>' . $product['url'] . '</url>'; $xml .= '<currencyId>' . $startup['currency_xml'] . '</currencyId>'; $xml .= '<categoryId>' . $product['category_id'] . '</categoryId>'; $xml .= '<condition type="preowned"><quality>excellent</quality><reason>Незначительные следы эксплуатации.</reason></condition>'; if($product['special']){ $xml .= '<price>' . $product['special'] . '</price>'; $xml .= '<oldprice>' . $product['price'] . '</oldprice>'; }else{ $xml .= '<price>' . $product['price'] . '</price>'; } if($product['image']){ $xml .= '<picture>' . $product['image'] . '</picture>'; } if($product['images']){ foreach($product['images'] as $image){ $xml .= '<picture>' . $image . '</picture>'; } } $xml .= '<vendor>' . $product['manufacturer'] . '</vendor>'; $xml .= '<description><![CDATA[' . $product['description'] . ']]></description>'; foreach($product['attributes_full'] as $attribute){ $xml .= '<' . $attribute['name'] . '>' . $attribute['text'] . '</' . $attribute['end'] . '>'; } if($product['attributes']){ foreach($product['attributes'] as $attribute){ $xml .= '<param name="' . $attribute['name'] . '">' . $attribute['text'] . '</param>'; } } $xml .= '</offer>'; } } else { break; } $xml = $this->unixml->exportToXml($controller_data['data'], $xml); } //generateXML //footerXML $xml .= '</offers>'; $xml .= '</shop>'; $xml .= '</yml_catalog>'; $this->unixml->exportToXml($controller_data['data'], $xml, "finish"); //footerXML VK дает такой пример файла: (прикреплен), и ругается на мой, что у него нет описания. Primer.xml Edited November 30, 2024 at 09:40 PM by akvariuz 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.