fix: set id_shop=1 in stock_available XML to fix OUT OF STOCK display

PS Webservice creates stock_available records with id_shop=0 when
products are created via API. The PS frontend reads id_shop=1 records
for stock display in a single-shop setup, causing OUT OF STOCK to appear
even when quantity > 0. Adding id_shop=1 to the XML ensures stock updates
target the correct shop-specific record.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
luklpz 2026-05-17 18:56:06 +02:00
parent 9c16d45c0e
commit fe7be5fc80
1 changed files with 1 additions and 0 deletions

View File

@ -289,6 +289,7 @@ public class PrestashopClient {
} }
String idAttr = dto.idProductAttribute() != null ? dto.idProductAttribute() : "0"; String idAttr = dto.idProductAttribute() != null ? dto.idProductAttribute() : "0";
sb.append("<id_product_attribute>").append(idAttr).append("</id_product_attribute>"); sb.append("<id_product_attribute>").append(idAttr).append("</id_product_attribute>");
sb.append("<id_shop>1</id_shop>");
sb.append("<quantity>").append(dto.quantity()).append("</quantity>"); sb.append("<quantity>").append(dto.quantity()).append("</quantity>");
sb.append("<depends_on_stock>0</depends_on_stock>"); sb.append("<depends_on_stock>0</depends_on_stock>");
sb.append("<out_of_stock>2</out_of_stock>"); sb.append("<out_of_stock>2</out_of_stock>");