Jump to content

[1.7] Update related products via webservice


Smooth Systems

Recommended Posts

Hi,

I'm trying to only add related products trough the webservice and have some difficulties. Every time I try to PUT following content to the webservice endpoint, trying to add product 7 + 10 to product 4, my products disappears in the backend.

Here my body request:

== PUT /api/products ======================================

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product>
        <id>4</id>
        <price>66.030000</price>
        <associations>
            <accessories>
                <product>
                    <id>7</id>
                </product>
                <product>
                    <id>10</id>
                </product>
            </accessories>
        </associations>
    </product>
</prestashop>

============================================================

Any idea? I read in some documentation that PUT should only update the product. Fetching the product via webservice works. Also important, what's the minimal set of required product properties to only update the product without side effects?

Thx in advance

/david

Link to comment
Share on other sites

Currently I found out, that the associations block is not required when updating via put. But adding there accessories only also works fine.

Additional information I was able to get out of following post:

https://www.prestashop.com/forums/topic/532659-webservice-add-product-along-with-the-attributes-and-combinations/?page=0#comment-2339089

Thx to @roband

Still hoping to find some documentation on it, unfortunately I'm not a talented php developer :(

best

/david

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...