I have a little code to create an order which don't work with php7
foreach ($object['products'] as $productInfoSrc) {
$productId = $productInfoSrc['product_id'];
$qty = $productInfoSrc['qty'];
$data['order']['add_products'][$productId] = array('qty' => $qty);
}
The line $data['order']['add_products'][$productId] = array('qty' => $qty);
return me the bug php.
I try to make some correction like this :
foreach ($object['products'] as $productInfoSrc) {
$productId = $productInfoSrc['product_id'];
$qty = $productInfoSrc['qty'];
$data['order']['add_products']= array($productId, array('qty' => $qty);
}
but if I have 2 product, just 1 was taken by this code (i don't merge array i think).
someone can help me ?
$data['order']['add_products'][$productId] = array('qty' => $qty);
which is array to string conversion. So$productId
has to be an array - which I typed in my answer. If he changes it, the script should work. Why this it not an answer?