$result[] = [
'id' => $product->id,
'name' => $product->name,
- 'picture' => self::getProductPictureUrl($product->id),
+ 'pictures' => self::getProductPictureUrl($product->id),
'price' => self::getProductPrice($product->id),
'oldprice' => self::getProductOldPrice($product->id),
'description' => self::getProductDescription($product->id),
$xml->addAttribute('date', date('Y-m-d\TH:i:sP'));
$shop = $xml->addChild('shop');
- $shop->addChild('name', 'BestSeller');
- $shop->addChild('company', 'The Best inc.');
- $shop->addChild('url', 'http://best.seller.ru');
+ $shop->addChild('name', 'База Цветов 24');
+ $shop->addChild('company', 'База Цветов 24');
+ $shop->addChild('url', 'https://bazacvetov24.ru');
// Добавление валюты
$currencies = $shop->addChild('currencies');
$category = $categories->addChild('category', 'Букеты');
$category->addAttribute('id', '1');
- // Добавление информации о доставке
+ // Добавление информации о доставке???
$deliveryOptions = $shop->addChild('delivery-options');
$deliveryOption = $deliveryOptions->addChild('option');
$deliveryOption->addAttribute('cost', '200');
$offer = $offers->addChild('offer');
$offer->addAttribute('id', $product['id']);
$offer->addChild('name', htmlspecialchars($product['name']));
- $offer->addChild('url', 'http://best.seller.ru/product_page.asp?pid=' . $product['id']);
+ //TODO добавить url на конкректный букет
+ $offer->addChild('url', 'https://bazacvetov24.ru/flowers/' . $product['id']);
$offer->addChild('price', $product['price']);
$offer->addChild('currencyId', 'RUR');
$offer->addChild('categoryId', '1');
}
foreach ($product['composition'] as $component) {
- $consist = $offer->addChild('param', $component['quantity']);
+ $consist = $offer->addChild('consist', $component['quantity']);
$consist->addAttribute('name', htmlspecialchars($component['name']));
$consist->addAttribute('unit', $component['unit']);
}
+ foreach ($product['pictures'] as $picture) {
+ $offer->addChild('picture', $picture);
+ }
}
return $xml->asXML();
// Приватные статические вспомогательные методы
private static function getProductPictureUrl($productId) {
- return 'https://files.erp24.ru/pic.jpg';
+ return ['https://files.erp24.ru/pic.jpg'];
}
private static function getProductPrice($productId) {
$price = Prices::find()