Настройка RSS-канала (покупки в Google) для интернет-магазина на основе Vue-storefront - PullRequest
0 голосов
/ 20 декабря 2018

Я создал интернет-магазин на основе Vue-store, где я хочу размещать рекламу в Google Shopping.Я хочу использовать RSS-канал для продуктов и не знаю, как правильно его настроить, поскольку я получаю "Unexpected token < in JSON at position 0" при запуске "yarn feed" в корневой папке.

Действия по воспроизведению проблемы

  • 1.Перейти в папку проекта;cd vue-storefront
  • 2.создать папку «скрипты»;`mkdir scripts`
  • 3.Перейти в папку скриптов;`cd scripts` и использовать код в этом хранилище для создания нового файла;`touch feed.json`
  • 4.добавьте репозиторий jsontoxml в `vue-storefront / node_modules`, получите его здесь
  • 5.Отредактируйте файл package.json в папке проекта / vue-storefront и добавьте «feed»: «node scripts / feed.js» в разделе «scripts» `` scripts "`: {
  • 6.`подача пряжи '

Ожидаемый результат:

The file was saved!
Done in 0.41s.  

Фактический результат:

$ sudo yarn feed
yarn run v1.12.3
$ node scripts/feed.js
(node:2527) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at     
https://hoversport.no/api/catalog/hoversport.no/product/_search?size=9000&from=0&sort=&_source_exclude=configurable_children%2Cconfigurable_options%2Csgn&_source_include=type_id%2Csku%2Cproduct_links%2Ctax_class_id%2Cspecial_price%2Cspecial_to_date%2Cspecial_from_date%2Cname%2Cprice%2CpriceInclTax%2CoriginalPriceInclTax%2CoriginalPrice%2CspecialPriceInclTax%2Cid%2Cimage%2Csale%2Cnew%2Curl_key%2Cstatus%2Ctier_prices%2Cdescription 
reason: Unexpected token < in JSON at position 0
at /opt/bitnami/apps/hoversport.no/vue-storefront/node_modules/node-fetch/lib/body.js:48:31
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:2527) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2527) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 0.35s.

1 Ответ

0 голосов
/ 22 декабря 2018

Похоже, что vue-storefront-api не отвечает или не отвечает с ошибкой

https://hoversport.no/api/catalog/hoversport.no/product/_search?size=9000&from=0&sort=&_source_exclude=configurable_children%2Cconfigurable_options%2Csgn&_source_include=type_id%2Csku%2Cproduct_links%2Ctax_class_id%2Cspecial_price%2Cspecial_to_date%2Cspecial_from_date%2Cname%2Cprice%2CpriceInclTax%2CoriginalPriceInclTax%2CoriginalPrice%2CspecialPriceInclTax%2Cid%2Cimage%2Csale%2Cnew%2Curl_key%2Cstatus%2Ctier_prices%2Cdescription 
reason: Unexpected token < in JSON at position 0

У меня есть эта ошибка:

Похоже, что нетУпругий поиск индексируется с именем hoversport.no (вероятно, это: vue_storefront_catalog?)

...