Jump to content

Update only specified fields of PrestaShop product via API


m4rlb0r0

Recommended Posts

Is it really necessary to download the entire product from api to update the price?

I can send back such xml:

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
   <product>
       <id><![CDATA[]]></id>
       <price><![CDATA[]]></price>
       <wholesale_price><![CDATA[]]></wholesale_price>
    </product>
</prestashop>

Unfortunately, not completed fields clear entries in the database.
Is it possible to add a flag to the xml parsing function so that it does not update the absent fields?

Thanks in advance for your help

Link to comment
Share on other sites

As it says in devdocs class validation for fields is the same for POST (create) and PUT (update) but it will be fixed in future introducing PATCH method.

https://devdocs.prestashop.com/1.7/webservice/getting-started/#control-returned-fields-with-display

As bypass you can develop your own module using addWebserviceResources hook to handle request with custom XML (like you mentioned before).

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...