foreach ($products as $key => $quantity) { | foreach ($products as $key => $quantity) { | ||||
$product = Product::findOne($key); | $product = Product::findOne($key); | ||||
if ($product) { | |||||
if ($product && $quantity) { | |||||
$productOrder = new ProductOrder; | $productOrder = new ProductOrder; | ||||
$productOrder->id_order = $order->id; | $productOrder->id_order = $order->id; | ||||
$productOrder->id_product = $key; | $productOrder->id_product = $key; |