tobiaseriksson Posted April 3, 2015 Share Posted April 3, 2015 I have been able to add a product using the WebService API but I have not been able to figure out how to set the product supplier id it does not work when setting creating the product e.g. <product> <id /> <id_manufacturer /> <id_supplier >6</id_supplier> ... Please help -Tobias Link to comment Share on other sites More sharing options...
tobiaseriksson Posted April 15, 2015 Author Share Posted April 15, 2015 I figured it out.... I think it is a bug the Product.php file inside of classes/ needs to be updated so that the following two methods/functions looks like this Basically, the problem was that when the WS (Webserivce API) triggered addWs or updateWs, then the SupplierId was never set... in the code below you can see two rows if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); and that is all that is needed ! public function addWs($autodate = true, $null_values = false) { $success = $this->add($autodate, $null_values); if ($success && Configuration::get('PS_SEARCH_INDEXATION')) Search::indexation(false, $this->id); if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); return $success; } public function updateWs($null_values = false) { $success = parent::update($null_values); if ($success && Configuration::get('PS_SEARCH_INDEXATION')) Search::indexation(false, $this->id); if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); return $success; } 1 Link to comment Share on other sites More sharing options...
lcalin Posted May 23, 2015 Share Posted May 23, 2015 I have the same issue in ver 1.6.0.14, but adding the 2 lines in addWS & updateWS does not work . Any clue? Thanks and regards, Lucian Link to comment Share on other sites More sharing options...
asilvestre87 Posted November 3, 2015 Share Posted November 3, 2015 I have the same problem in 1.6.0.14. Any clue?I see in ps_product table the id_supplier is correct but in Backend of prestashop, in the edit of product is not marked. why?I see a table called ps_product_supplier that contains id_supplier and id_product and other fields. If i change the id_supplier in this table on Backend of prestashop in the edit of product the supplier change, can i add one row per product with its id_supplier in this table to do this?I need to change other field or table to do this?Thanks! Link to comment Share on other sites More sharing options...
ricardolobo Posted February 28, 2017 Share Posted February 28, 2017 I figured it out.... I think it is a bug the Product.php file inside of classes/ needs to be updated so that the following two methods/functions looks like this Basically, the problem was that when the WS (Webserivce API) triggered addWs or updateWs, then the SupplierId was never set... in the code below you can see two rows if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); and that is all that is needed ! public function addWs($autodate = true, $null_values = false) { $success = $this->add($autodate, $null_values); if ($success && Configuration::get('PS_SEARCH_INDEXATION')) Search::indexation(false, $this->id); if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); return $success; } public function updateWs($null_values = false) { $success = parent::update($null_values); if ($success && Configuration::get('PS_SEARCH_INDEXATION')) Search::indexation(false, $this->id); if ($success) $this->addSupplierReference($this->id_supplier, 0, $this->supplier_reference, $this->wholesale_price, null); return $success; } Thank you very much. This actually works. I'm on the 1.6.1.11 version and this still hasn't been fixed. Link to comment Share on other sites More sharing options...
mlecoq Posted March 28, 2020 Share Posted March 28, 2020 It may be not sufficient if you had combinations on product through web service You have to modify Combination.php also to add supplier reference on every combinations Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now