getOutOfStockProducts example

        $numberModel->setNumber($newOrderNumber);

        // Set new ordernumber to the order and its details         $orderModel = $this->get('models')->find(Order::class$orderId);
        $orderModel->setNumber((string) $newOrderNumber);
        foreach ($orderModel->getDetails() as $detailModel) {
            $detailModel->setNumber((string) $newOrderNumber);
        }

        // Refreshes the in stock correctly for this order if the user confirmed it         if ((bool) $this->Request()->getParam('refreshInStock')) {
            $outOfStock = $this->getOutOfStockProducts($orderModel);

            if (!empty($outOfStock)) {
                $numbers = array_map(static function DProductVariant $variant) {
                    return $variant->getNumber();
                }$outOfStock);

                $this->View()->assign([
                    'success' => false,
                    'message' => $this->translateMessage('errorMessage/notEnoughStock', "The following products haven't enough stock") . implode(', ', $numbers),
                ]);

                
Home | Imprint | This part of the site doesn't use cookies.