Jump to content

Importing product via prestashop's webservice


prince67300

Recommended Posts

Hi all !

 

I'm trying to import some products to my prestashop using REST webservice. The problem is when I try to add a product to an empty category I created using webservice or using PS web interface, I get the following response:

<error>
<code><![CDATA[135]]></code>
<message><![CDATA[You cannot set a position greater than the total number of products in the category, minus 1 (position numbering starts at 0).]]></message>
</error>
It occurs with the first product. If I add it via web interface and I add the others using webservice, it works.

 

XML:

 

  Reveal hidden contents

 

 

I've already read this topic http://www.prestashop.com/forums/topic/347750-solvedcant-add-product-to-empty-category-using-webservice/ but the solution is not really a solution so does anyone have an idea about this issue ?

 

Thanks for your answers

Link to comment
Share on other sites

Hello, 

 

It look like a bug in classes/Product.php at line 4872:

 

"if ($position + 1 > count($result)) "

When category is empty then only logical value for position is -1 which is not possible ...

 

Just comment line 4872 and 4873 in that file and it will work.

 

Matus

  • Like 1
Link to comment
Share on other sites

  • 5 years later...
  On 10/21/2014 at 3:14 PM, bxmatus said:

Hello, 

 

It look like a bug in classes/Product.php at line 4872:

 

"if ($position + 1 > count($result)) "

When category is empty then only logical value for position is -1 which is not possible ...

 

Just comment line 4872 and 4873 in that file and it will work.

 

Matus

Expand  

Hello

Shouldn't this be reported as a bug so that PrestaShop people could globally correct it?

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