Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrestaShop 8 #458

Open
nturini-cascinanet opened this issue Jan 23, 2023 · 4 comments
Open

PrestaShop 8 #458

nturini-cascinanet opened this issue Jan 23, 2023 · 4 comments

Comments

@nturini-cascinanet
Copy link
Contributor

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

@DomenicoFormoso
Copy link

I'm interested to know if an update compatible with version 8 will be released in the future.

@robertoalonsovelasco
Copy link

(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'];
// }

@robertoalonsovelasco
Copy link

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'];
}
}
}

@sanctusmob
Copy link
Contributor

This issue is on prestashop. I also apply this fix

array_unshift($result, null);
        foreach ($result as $key => &$value) {
                if ($value !== null) {
                    $value = $value['id_product'];
                }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants