title: How can I update product categories using prestashop web service?
body: <p>Hi I want to remotely update all the "attributes" related with a product using prestashop web service. I have been trying to update its categories for days unsuccessfully. I am using prestashop_1.6.1.5.
  Following the <a href="http://doc.prestashop.com/display/PS16/Chapter+5+-+Data+modification+-+Updating+a+customer" rel="nofollow">doc</a> you can get a product xml like this</p>
  
  <pre><code>$xml = $this-&gt;webService-&gt;get(array('url' =&gt; 'http://prestashop.localhost/api/products/2'));
  
  var_dump($xml);
  
  $resources = $xml-&gt;children()-&gt;children();
  </code></pre>
  
  <p>Then if you do </p>
  
  <pre><code>$resources-&gt;reference = "NEW REFERENCE";
  </code></pre>
  
  <p>and you can modify the reference, for example.</p>
  
  <p>It is possible to view its categories by </p>
  
  <pre><code>$resources-&gt;associations-&gt;categories-&gt;categories
  </code></pre>
  
  <p>You will get the array of category ids that are related with the product. But if you do:</p>
  
  <pre><code>$resources-&gt;associations-&gt;categories-&gt;categories[2] = 8
  </code></pre>
  
  <p>You will not update the third category associated to the product to 8. It will remain like 0.
  I have also tried to assing it a string. I have tried to unset the whole categories node, create my own node with the same format it uses and after that, assing it again. I have tried also creating a SimpleXMlElement and adding it with addChild() for each id I want to modify. But nothing worked.</p>
  
  <p>Does anybody knows how to update categories?</p>
  
  <p>I have also another question, what is the difference between these category ids and the default_category_id that appears in product xml? If you see prestashop DDBB the default_category_id does not appear in the intermediate table. I mean If the default_category_id is 9, the other ids are 2,3,4 and 7 in the example products you have when you start using prestashop.</p>
  
  <p>thanks in advance</p>