Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Модуль Яндекс.Маркет


JollyJoy

Recommended Posts

ocStore v0.1.6. без изменений. хостинг nic.ru.

При проверке YML-файла яндекс выдает вот такую ошибку:

"Фатальная ошибка: Ошибка парсинга XML: Error parsing XML feed: Unknown element 'b' (строка 1, столбец 3)"

посмотрел сам yml-файл, там на первой строке такая запись:

"<b>Notice</b>: Undefined offset: 0 in <b>/docs/catalog/controller/export/yml.php</b> on line <b>44</b>"

я так понял ошибка в обработке 44-ой строки в файле yml.php.

что это значит? что и где не работает? что надо делать?

Надіслати
Поділитися на інших сайтах


содержимое файла yml.php

<?php

class ControllerExportYml extends Controller {

private $eof = "\n";

public function index() {

if ($this->config->get('yandex_market_status')) {

$output = '<?xml version="1.0" encoding="utf-8" ?>';

$output .= '<!DOCTYPE yml_catalog SYSTEM "shops.dtd">';

$output .= '<yml_catalog date="' . date("Y-m-d H:m") . '">';

$output .= '<shop>' . "\n";

$output .= '<name>' . $this->config->get('config_name') . '</name>';

$output .= '<company>' . $this->config->get('config_meta_description') . '</company>';

$output .= '<url>' . HTTP_SERVER . '</url>'. "\n";

// Перечесляем валюту магазина

// TODO: Добавить возможность настраивать проценты.

$output .= '<currencies>';

$output .= '<currency id="RUR" rate="1"/>';

$output .= '<currency id="USD" rate="CBRF" plus="3"/>';

$output .= '<currency id="EUR" rate="CBRF" plus="3"/>';

$output .= '</currencies>';

// Категории товаров

$this->load->model('catalog/category');

$output .= '<categories>';

$output .= $this->getCat();

$output .= '</categories>';

// Товарные позиции

$this->load->model('catalog/product');

$this->load->model('tool/image');

$output .= '<offers>';

$products = $this->model_catalog_product->getProducts();

foreach ($products as $product) {

$output .= '<offer id="'.$product['product_id'].'" type="vendor.model" available="true" bid="13">' . $this->eof;

$output .= '<url>'.(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id']).'</url>';

$output .= '<price>' . $this->tax->calculate($product['price'], $product['tax_class_id']) . '</price>';

$output .= '<currencyId>RUR</currencyId>';

// Определяем категорию для товара

$categories = $this->model_catalog_product->getCategories($product['product_id']);

$output .= '<categoryId>'.$categories[0]['category_id'].'</categoryId>';

// Определеяме изображение

if ($product['image']) {

$output .= '<picture>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</picture>';

} else {

$output .= '<picture>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</picture>';

}

$output .= '<delivery> true </delivery>';

$output .= '<local_delivery_cost>300</local_delivery_cost>';

// $output .= '<typePrefix> </typePrefix>';

$output .= '<vendor>' . $product['manufacturer'] . '</vendor>';

// $output .= '<vendorCode> </vendorCode>';

$output .= '<model>'.$product['model'].'</model>';

$output .= '<description>'.$product['description'].'</description>';

$output .= '<manufacturer_warranty>true</manufacturer_warranty>';

$output .= '<country_of_origin>РЇРїРѕРЅРёСЏ</country_of_origin>';

$output .= '</offer>';

}

$output .= '</offers>';

$output .= '</shop>';

$output .= '</yml_catalog>';

$this->response->addHeader('Content-Type: application/xml');

$this->response->setOutput($output);

}

}

// Возвращает массив категорий

protected function getCat($pi=0) {

$categories = $this->model_catalog_category->getCategories($pi);

$out = '';

foreach ($categories as $category) {

$out .= '<category id="'.$category['category_id'].'"';

if($pi != 0) $out .= ' parentId="'.$pi.'"';

$out .='>'.$category['name'].'</category>';

if($e = $this->getCat($category['category_id'])) $out .= $e;

}

return $out;

}

}

?>

Надіслати
Поділитися на інших сайтах


ну так проверьте, есть ли у вас вобще данные такие.

добавьте перед

$output .= '<categoryId>'.$categories[0]['category_id'].'</categoryId>';
print "<hr /><pre>";
print_r($categories[0]);
print "</pre><hr /><br />";

и смотрите, что выводится между линиями.

Надіслати
Поділитися на інших сайтах

подставил, вот что выводиться в начале yml-файла:

Array

(

[product_id] => 61

[category_id] => 35

)

Array

(

[product_id] => 52

[category_id] => 35

)

Array

(

[product_id] => 63

[category_id] => 35

)

Array

(

[product_id] => 53

[category_id] => 35

)

Array

(

[product_id] => 55

[category_id] => 35

)

Array

(

[product_id] => 51

[category_id] => 35

)

Notice: Undefined offset: 0 in /docs/catalog/controller/export/yml.php on line 45

Notice: Undefined offset: 0 in docs/catalog/controller/export/yml.php on line 47

Array

(

[product_id] => 49

[category_id] => 35

)

Array

(

[product_id] => 57

[category_id] => 35

)

Array

(

[product_id] => 59

[category_id] => 35

)

Array

(

[product_id] => 60

[category_id] => 35

)

Array

(

[product_id] => 64

[category_id] => 35

)

Array

(

[product_id] => 54

[category_id] => 35

)

Array

(

[product_id] => 50

[category_id] => 35

)

Array

(

[product_id] => 62

[category_id] => 35

)

Array

(

[product_id] => 58

[category_id] => 35

)

Array

(

[product_id] => 65

[category_id] => 35

)

Array

(

[product_id] => 66

[category_id] => 35

)

Array

(

[product_id] => 67

[category_id] => 35

)

Array

(

[product_id] => 68

[category_id] => 35

)

Array

(

[product_id] => 69

[category_id] => 35

)

Array

(

[product_id] => 70

[category_id] => 35

)

Array

(

[product_id] => 71

[category_id] => 35

)

Array

(

[product_id] => 72

[category_id] => 35

)

Array

(

[product_id] => 73

[category_id] => 35

)

Notice: Undefined offset: 0 in docs/catalog/controller/export/yml.php on line 45

Notice: Undefined offset: 0 in docs/catalog/controller/export/yml.php on line 47

Array

(

[product_id] => 75

[category_id] => 35

)

Array

(

[product_id] => 77

[category_id] => 36

)

что мне с этим делать?
Надіслати
Поділитися на інших сайтах


попробуйте просто спрятать нолик в одинарные кавычки:

$output .= '<categoryId>'.$categories['0']['category_id'].'</categoryId>';

PS:

бошка уже трещит, могу и глупость сморозить.

Надіслати
Поділитися на інших сайтах

  • 3 weeks later...

забыл сюда отписать =)

сначала я отключил вывод ошибок в система->настройки->Сервер->Показывать ошибки

после этого выяснилось что проблема в том что когда в карточке товара не указана его категория, то модуль выгрузки не может корректно выгрузить этот товар в yml.

короче надо весь товар проверить чтобы была указана категория, видимо при добавлении галочку забыли поставить.

Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.