Jump to content

Edit History

Anonymous No.2

Anonymous No.2


problem solved

It looks like  I  cannot create a new record in the stock_availables via API when it does not exist, I am getting an error

<error>
<code><![CDATA[101]]></code>
<message><![CDATA[Method POST is not allowed for the resource stock_availables]]></message>
</error>

when my product looks like this

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id><![CDATA[79]]></id>
  ...
<stock_availables nodeType="stock_available" api="stock_availables"/>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>  

I believe  associations between product and stock_availables dissapeared after I added this line  while updating products

$clientXml->children()[0]->associations->categories->category[0]->id=$idCategory;

because products without associated categories did not appear in the shop. Now products do appear in the shop, but I cannot update the qty in stock anymore :(.

I noticed I also have 59 orphan records in the ps_stock_available table for not existing products. SQL I used to find orphans:

SELECT pa.* FROM `ps_stock_available` pa WHERE not exists (select p.id_product from ps_product p where p.id_product=pa.id_product)

Any ideas how to fix it?
PS version 1.7.5.2

 

Well, my problem was id_shop_group was set to 1 in my code, not specifying the category. Sorry.

Anonymous No.2

Anonymous No.2

It looks like  I  cannot create a new record in the stock_availables via API when it does not exist, I am getting an error

<error>
<code><![CDATA[101]]></code>
<message><![CDATA[Method POST is not allowed for the resource stock_availables]]></message>
</error>

when my product looks like this

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id><![CDATA[79]]></id>
  ...
<stock_availables nodeType="stock_available" api="stock_availables"/>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>  

I believe  associations between product and stock_availables dissapeared after I added this line  while updating products

$clientXml->children()[0]->associations->categories->category[0]->id=$idCategory;

because products without associated categories did not appear in the shop. Now products do appear in the shop, but I cannot update the qty in stock anymore :(.

I noticed I also have 59 orphan records in the ps_stock_available table for not existing products. SQL I used to find orphans:

SELECT pa.* FROM `ps_stock_available` pa WHERE not exists (select p.id_product from ps_product p where p.id_product=pa.id_product)

Any ideas how to fix it?
PS version 1.7.5.2

Anonymous No.2

Anonymous No.2

It looks like  I  cannot create a new record in the stock_availables via API when it does not exist, I am getting an error

<error>
<code><![CDATA[101]]></code>
<message><![CDATA[Method POST is not allowed for the resource stock_availables]]></message>
</error>

when my product looks like this

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id><![CDATA[79]]></id>
  ...
<stock_availables nodeType="stock_available" api="stock_availables"/>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>  

I believe  associations between product and stock_availables dissapeared after I added this line  while updating products

$clientXml->children()[0]->associations->categories->category[0]->id=$idCategory;

because products without associated categories did not appear in the shop. Now products do appear in the shop, but I cannot update the qty in stock anymore :(.

Any ideas how to fix it?
PS version 1.7.5.2

Anonymous No.2

Anonymous No.2

It looks like  I  cannot create a new record in the stock_availables via API when it does not exist:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id><![CDATA[79]]></id>
  ...
<stock_availables nodeType="stock_available" api="stock_availables"/>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>  

I believe  associations between product and stock_availables dissapeared after I added this line  while updating products

$clientXml->children()[0]->associations->categories->category[0]->id=$idCategory;

because products without associated categories did not appear in the shop. Now products do appear in the shop, but I cannot update the qty in stock anymore :(

Any ideas how to fix it?
PS version 1.7.5.2

Anonymous No.2

Anonymous No.2

It looks like  I  cannot create a new record in the stock_availables via API when it does not exist:

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
	<id><![CDATA[79]]></id>
  ...
<stock_availables nodeType="stock_available" api="stock_availables"/>
<accessories nodeType="product" api="products"/>
<product_bundle nodeType="product" api="products"/>
</associations>
</product>
</prestashop>  

I believe  associations between product and stock_availables dissapeared after I added this line  while updating products

$clientXml->children()[0]->associations->categories->category[0]->id=$idCategory;

because products without associated categories did not appear in the shop. Now products do appear in the shop, but I cannot update the qty in stock :(

Any ideas how to fix it?
PS version 1.7.5.2

×
×
  • Create New...