Prestashop Web service to return JSON

后端 未结 4 872
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 22:41

After extensive search over internet i am sure that Prestashop does not return data in JSON format, it only returns in XML format (which leads to cross domain accessing issue un

4条回答
  •  难免孤独
    2021-02-05 23:32

    Using php pear "XML_Serializer":

    {
      "product": {
        "id_category_default": "XXX",
        "id_tax_rules_group": "1",
        "type": "simple",
        "id_shop_default": "1",
        "reference": "XXXXXXXX",
        "price": "XX.XXXXXX",
        "active": "1",
        "redirect_type": "404",
        "id_product_redirected": "0",
        "available_for_order": "1",
        "condition": "new",
        "show_price": "1",
        "indexed": "0",
        "visibility": "both",
        "advanced_stock_management": "0",
        "link_rewrite": {
          "language": {
            "_attributes": {
              "id": "1"
            },
            "_content": "ipod-nano"
          }
        },
        "name": {
          "language": {
            "_attributes": {
              "id": "1"
            },
            "_content": "iPod Nano"
          }
        },
        "associations": {
          "categories": {
            "category": {
              "id": "XXX"
            }
          },
          "stock_availables": {
            "stock_available": {
              "id": "XXXX",
              "id_product_attribute": "X"
            }
          }
        }
      }
    }
    

    See this link: https://www.prestashop.com/forums/topic/602449-aporte-webservice-prestashop-16-json-request-post-y-put/#elComment_2930631

提交回复
热议问题