Jump to content

Error while creating products using webservices


Recommended Posts

Hello, 

I had been struggling while creating products on pretsashop 1.6.0.9, via web-services.

 

The error i`m getting are - 

 

Error 1 - 

 Undefined index:  (/var/www/prestashop/1609/classes/Product.php, line 4879)

Error 2 - [php Warning #2] array_splice() expects parameter 2 to be long, string given (/var/www/prestashop/1609/classes/Product.php, line 4881)

 

I thought the problem is in the way we are doing to create the products, but when i deeply check the problem and look inside some Core files of prestashop version 1.6.0.9.

 

I found these above issue(s), which when fixed by me obvious, everything is worked like a charm for me ;)

 

Now, I want to share it with all of you. May be it will help someone like me n save his/her time, I`lso want this forum to except it as a patch to this version.

 

Here is the fix - 

 

Fix for Error 1 - 

File name - Product.php

Line number - line 4846

class name - getWsPositionInCategory()

Replace return 0; in place of return '';

 

Fix to Error 2 - 

File name - Product.php

Line number - line 4881

class name - setWsPositionInCategory()

Replace "array_splice($result, (int)$position, 0, $save);"

in place of "array_splice($result,$position, 0, $save);"

 

That`s it...

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...