簡體   English   中英

在Prestashop上按SKU在購物車中添加產品

[英]Adding products in cart by sku on prestashop

我正在使用prestashop網絡服務進行集成,

我正在發送引發POST http:// url / prestashop / api / carts?schema = blank&ws_key = MYKEY = keywords&language = 1

這個XML

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
   <customer>
      <id_customer>12</id_customer>
      <id_currency>1</id_currency>
      <id_lang>1</id_lang>
      <associations>
         <cart_rows>
            <cart_row>
               <CartRow>
                  <id_product>1</id_product>
                  <id_product_attribute>1</id_product_attribute>
                  <id_address_delivery>10</id_address_delivery>
                  <quantity>1</quantity>
               </CartRow>
            </cart_row>
         </cart_rows>
      </associations>
   </customer>
</prestashop>

我有兩個問題要解決,

第一:我收到此錯誤:

<![CDATA[[SQL Error] Column 'id_product_attribute' cannot be null. From CartCore->setWsCartRows() Query was : INSERT INTO `ps_cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `id_address_delivery`, `quantity`, `date_add`, `id_shop`) VALUES (18, 0, NULL, 0, 0, NOW(), 1)]]>

但是id屬性和product在數據庫中(我在表products和prorduct_attribute上進行了檢查)

第二:

我只有sku,有什么辦法讓id_product和id_product_attribute拋出Web服務產品嗎? 還是我必須構建一個自定義模塊或其他東西來獲取產品編號?

非常感謝您的幫助!

您的XML格式錯誤。 請注意,在查詢錯誤中,id_product和id_product_attribute的值為0和NULL,因此要傳遞給XML的數據永遠不會在Web服務中找到正確的目的地。

如果您有SKU,則必須先按參考(或ean13或UPC或SKU在Prestashop中代表的字段)過濾產品。 這樣,您將獲得id_product和id_product_attribute並將其通過XML傳遞到Web服務。

祝好運。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM