getDetails example

return;
        }
        $newOrderNumber = $numberModel->getNumber() + 1;

        // 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);

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

                
$total = $result->getCount();
            $ids = array_column($result->getData(), 'id');
        } else {
            $searchResult = $this->getRepository()->search($offset$limit$filter$sort);
            $total = $searchResult['total'];
            $ids = array_column($searchResult['orders'], 'id');
        }

        $orders = $this->getRepository()->getList($ids);
        $documents = $this->getRepository()->getDocuments($ids);
        $details = $this->getRepository()->getDetails($ids);
        $payments = $this->getRepository()->getPayments($ids);

        $orders = $this->assignAssociation($orders$documents, 'documents');
        $orders = $this->assignAssociation($orders$details, 'details');
        $orders = $this->assignAssociation($orders$payments, 'paymentInstances');

        $namespace = $this->get('snippets')->getNamespace('frontend/salutation');

        $stateTranslator = $this->get(StateTranslatorService::class);

        $numbers = [];
        
/** * Does the actual work of displaying the view file. Used internally * by links(), simpleLinks(), and makeLinks(). */
    protected function displayLinks(string $group, string $template): string
    {
        if (array_key_exists($template$this->config->templates)) {
            throw PagerException::forInvalidTemplate($template);
        }

        $pager = new PagerRenderer($this->getDetails($group));

        return $this->view->setVar('pager', $pager)
            ->render($this->config->templates[$template]);
    }

    /** * Stores a set of pagination data for later display. Most commonly used * by the model to automate the process. * * @return $this */
    


        $this->createAddresses($params$order);

        // 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');

            $order->setNumber((string) $orderNumber);
            foreach ($order->getDetails() as $detail) {
                $detail->setNumber((string) $orderNumber);
            }
        }

        $this->getManager()->persist($order);
        $this->flush();

        return $order;
    }

    /** * @param string $number * @param array<string, mixed> $params * * @throws CustomValidationException * @throws NotFoundException * @throws ParameterMissingException * @throws PrivilegeException * @throws ShopwareOrmException * @throws ValidationException * * @return OrderModel */
/** * Event listener function of the Shopware_Modules_Order_SaveOrder_ProcessDetails event. * This event is fired after a customer completed an order. * This function is used to add or increment the new also bought articles. */
    public function addNewAlsoBought(Enlight_Event_EventArgs $arguments)
    {
        if (Shopware()->Session()->get('Bot')) {
            return $arguments->getReturn();
        }

        $variants = $arguments->getDetails();
        if (\count($variants) <= 1) {
            return $arguments->getReturn();
        }
        $sql = ' SELECT basket1.articleID as article_id, basket2.articleID as related_article_id FROM s_order_basket basket1 INNER JOIN s_order_basket basket2 ON basket1.sessionID = basket2.sessionID AND basket1.articleID != basket2.articleID AND basket1.modus = 0 AND basket2.modus = 0 WHERE basket1.sessionID = :sessionId ';

        $this->rounding = $rounding;
    }

    public function recalculateOrderTotals(Order $order): void
    {
        $invoiceAmount = 0;
        $invoiceAmountNet = 0;

        // Iterate order details to recalculate the amount.         /** @var Detail $detail */
        foreach ($order->getDetails() as $detail) {
            $price = round($detail->getPrice(), 2);

            $invoiceAmount += $price * $detail->getQuantity();

            $tax = $detail->getTax();

            $taxValue = $detail->getTaxRate();

            // Additional tax checks required for sw-2238, sw-2903 and sw-3164             if ($tax && $tax->getId() !== 0 && $tax->getId() !== null && $tax->getTax() !== null) {
                $taxValue = (float) $tax->getTax();
            }

final class FormatException extends \LogicException implements ExceptionInterface
{
    private FormatExceptionContext $context;

    public function __construct(string $message, FormatExceptionContext $context, int $code = 0, \Throwable $previous = null)
    {
        $this->context = $context;

        parent::__construct(sprintf("%s in \"%s\" at line %d.\n%s", $message$context->getPath()$context->getLineno()$context->getDetails())$code$previous);
    }

    public function getContext(): FormatExceptionContext
    {
        return $this->context;
    }
}
Home | Imprint | This part of the site doesn't use cookies.