privatefunctiongetPartnerId(Customer $customer): int { return(int)$this->connection->fetchColumn('SELECT id FROM s_emarketing_partner WHERE idcode = ?', [$customer->getAffiliate()]); }
// Set new ordernumber
$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);
// Generate an order number if none was provided. Doing it after validation since
// the generation of the order number cannot be reverted in a simple manner.
if($order->getNumber() === null){ $orderNumberGenerator = Shopware()->Container()->get(NumberRangeIncrementerInterface::class); $orderNumber = $orderNumberGenerator->increment('invoice');