PrestaSharp
PrestaSharp copied to clipboard
PrestaShop 8
Trying to add a new product in prestashop 8 i always receive this error
<'?xml version="1.0" encoding="UTF-8"?>
<'prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<'errors>
<'error>
<'code><'![CDATA[3]]><'/code>
<'message><'![CDATA[[PHP Warning #2] foreach() argument must be of type array|object, string given (/var/www/vhosts/...../classes/Product.php, line 7908)]]><'/message>
<'/error>
<'/errors>
<'/prestashop>
HttpStatusCode: InternalServerError
in Bukimedia.PrestaSharp.Factories.RestSharpFactory.CheckResponse(IRestResponse response, RestRequest request)
in Bukimedia.PrestaSharp.Factories.RestSharpFactory.Execute[T](RestRequest request)
in Bukimedia.PrestaSharp.Factories.GenericFactory1.Add(T Entity)
in 1.7.8.x versions the insertion works correctly
I'm interested to know if an update compatible with version 8 will be released in the future.
(view error / line)
In file clases\product.php i comment this line: (line 7093) and the problem are solved. This is not the best solution and i don't know than delete this line may by thorw.
// result is indexed by recordset order and not position. positions start at index 1 so we need an empty element
// array_unshift($result, null); // foreach ($result as &$value) { // $value = $value['id_product']; // }
or this : // result is indexed by recordset order and not position. positions start at index 1 so we need an empty element if ($result !== null) { array_unshift($result, null); foreach ($result as &$value) { if (is_array($value) && isset($value['id_product'])) { $value = $value['id_product']; } } }