title: Prestashop 1.6 API Update Product Quantity
body: <p>I'm making a bridging app. to sync product quantities from a warehouse DB with a Prestashop 1.6 Multi-Store cart.</p>
  
  <p>The script just needs to update one product quantity at a time and we have the product "ID" and the "quantity", however, I keep getting the following error returned:</p>
  
  <pre><code>RETURN HTTP BODY
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;errors&gt;
  &lt;error&gt;
  &lt;code&gt;&lt;![CDATA[93]]&gt;&lt;/code&gt;
  &lt;message&gt;&lt;![CDATA[parameter "quantity" not writable. Please remove this attribute of this XML]]&gt;&lt;/message&gt;
  &lt;/error&gt;
  &lt;/errors&gt;
  &lt;/prestashop&gt;
  </code></pre>
  
  <p>This comes with:
  Other error
  This call to PrestaShop Web Services failed and returned an HTTP status of 400. That means: Bad Request.</p>
  
  <p>XML error code 93 is  The table  is not present in the descriptor. I thought this was done by including "$opt = array('resource' => 'products');"</p>
  
  <h2>Advanced Stock control is also enabled on the site and this script does not make adjustments with it(One should also include this, maybe next version).</h2>
  
  <p>The code I'm using to get the XML, change the quantity value, and update is:</p>
  
  <pre><code>function test1($id, $quantity){
      $id = (int)$id;
      $quantity = (int)$quantity;
  
      try
      {
          $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
          $opt = array('resource' =&gt; 'products', 'display' =&gt; '[id,quantity]');
          if (isset($id))
              $opt['id'] = $id;
          $xml = $webService-&gt;get($opt);
  
          $resources = $xml-&gt;children()-&gt;children();
      }
      catch (PrestaShopWebserviceException $e)
      {
          // Dealing with errors
          $trace = $e-&gt;getTrace();
          if ($trace[0]['args'][0] == 404) echo 'Bad ID';
          else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
          else echo 'Other error&lt;br /&gt;'.$e-&gt;getMessage();
      }
  
      if (isset($id) &amp;&amp; isset($quantity)){
  
          $resources-&gt;id = $id;
          $resources-&gt;quantity = $quantity;
          // Call the web service
          try
          {
              $opt = array('resource' =&gt; 'products');
              $opt['putXml'] = $xml-&gt;asXML();
              $opt['id'] = $id;
              $xml = $webService-&gt;edit($opt);
              echo "Successfully updated.";
          }
          catch (PrestaShopWebserviceException $ex)
          {
              // Here we are dealing with errors
              $trace = $ex-&gt;getTrace();
              if ($trace[0]['args'][0] == 404) echo 'Bad ID';
              else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
              else echo 'Other error&lt;br /&gt;'.$ex-&gt;getMessage();
          }
      }
  }
  </code></pre>
  
  <p>The initial XML returned that I use to update is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;product id="45" xlink:href="https://www.WEBSITE.com/api/products/45"/&gt;
  &lt;/prestashop&gt;
  </code></pre>
  
  <p>The XML that was sent for the Update is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;product id="45" xlink:href="https://www.WEBSITE.com/api/products/45"&gt;&lt;id&gt;45&lt;/id&gt;&lt;quantity&gt;22&lt;/quantity&gt;&lt;/product&gt;
  &lt;/prestashop&gt;
  </code></pre>
  
  <p>It seems that the sent XML or something is missing the table reference or something. </p>
  
  <p>I've tried a couple ways all with the same result. Any ideas?</p>
  
  <p>Thanks</p>