$result = [];
- foreach ($products as $product) {
+ foreach ($products as $index => $product) {
$components = json_decode($product->components, true);
$composition = [];
}
$result[] = [
- 'id' => $product->id,
+ 'id' => "000" . ($index + 1),
'name' => $product->name,
'pictures' => self::getProductPictureUrl($product->id),
'price' => self::getProductPrice($product->id),
'oldprice' => self::getProductOldPrice($product->id),
'description' => self::getProductDescription($product->id),
'qty' => self::getProductQty($product->id),
+ 'amount' => self::getProductQty($product->id),
'weight' => self::getProductWeight($product->id),
'minorder' => self::getProductMinOrder($product->id),
'composition' => $composition,
$categories = $shop->addChild('categories');
$category1 = $categories->addChild('category', 'Букеты');
$category1->addAttribute('id', '1');
- $category2 = $categories->addChild('category', 'Ð\90кÑ\81еÑ\81Ñ\81Ñ\83аÑ\80ы');
+ $category2 = $categories->addChild('category', 'ЦвеÑ\82ы');
$category2->addAttribute('id', '2');
// Добавление офферов (продуктов)
// Добавление веса и количества
$offer->addChild('weight', $product['weight']);
$offer->addChild('qty', $product['qty']);
+ $offer->addChild('amount', $product['amount']);
foreach ($product['composition'] as $component) {
$consist = $offer->addChild('consist', $component['quantity']);