Prestashop: Product_suppliers aren't filled throw webservice

Created on 26 Aug 2020  路  9Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

Add or update a product throw webservice with id_supplier and supplier_reference filled.
Only product table is filled and product_supplier table isn't filled. This is a problem because database schema isn't repected like a product's update into backoffice.

Expected behavior

product_supplier table must be filled too.

Additional information

PrestaShop version: 1.7.7
I already did the patch, I'll commit it asap.

1.7.6.7 1.7.7.x BO Bug Duplicate Minor PR available Products Suppliers WS Webservice

All 9 comments

Thanks for opening this issue! We will help you to keep its state consistent

Hi @matks
I'm not sure. These issues tell the problem is product table isn't updated. Here, product table is updated and the product supplier isn't updated.

I suggest to update Product addWs() and updateWs() in order to use addSupplierReference() in order to update too product supplier table.

I see it only with webservice, I don't get this issue with BO.

What do you think about?

As it concerns the 1.7.7, we need to ensure if it's not a regression compared to 1.7.6
@khouloudbelguith @sarahdib

Hi @marionf,

I manage to reproduce the issue with PS1.7.6.7.
I tried with this script

<prestashop>
<product>
  <id/>
  <id_manufacturer>2</id_manufacturer>
  <id_supplier xlink:href="http://prestashop.local/1767/api/suppliers/1">1</id_supplier>
  <supplier_reference>testing</supplier_reference>
  <state>1</state>
  <id_category_default>2</id_category_default>
  <active>1</active>
  <advanced_stock_management>1</advanced_stock_management>
  <associations>
    <categories>
      <category><id>2</id></category>
    </categories>
  </associations>
  <reference>boom</reference>
  <name>
  <language id="1">product_success_add</language></name>
  <price>100</price>
  <id_shop_default>1</id_shop_default>
  <low_stock_alert>0</low_stock_alert>
  <link_rewrite>abc</link_rewrite>
  <show_price>1</show_price>
  <minimal_quantity>1</minimal_quantity>
  <available_for_order>1</available_for_order>
</product>
</prestashop>

In the Table ps_product => ok
image
The table ps_product_supplier is empty
image

In the BO => Catalog => Product details page, the supplier is not setected
image

Thanks!

Thank you @khouloudbelguith, could you apply the severity label ?

@PierreRambaud made a feedback onto my PR.
Maybe the issue isn't "product_supplier aren't filled", but the issue is "id_supplier and supplier_reference should be removed from product's object".
Maybe Pierre can give his point of view.
If Prestashop's team goal is to fully manage suppliers, maybe id_supplier and supplier reference into product's object are depreceated.
If not, i think my PR is OK.
If yes, my PR is KO and instead we should remove these fields from webservice product method.

I think someone should help with some spirit or guidelines about it !

Hi @Max84,

We are awre of this issue, it is added to our debug roadmap.
Your ticket is a duplicate of #16086
So, I close it.
Thanks!

Duplicate of #16086

Was this page helpful?
0 / 5 - 0 ratings