setNumber example



        foreach ($details as $detail) {
            if ($detail->getId() === $abortId) {
                continue;
            }
            $number = $this->interpretNumberSyntax($product$detail$commands$counter);
            ++$counter;
            if ($number === '') {
                continue;
            }
            $detail->setNumber($number);
            $this->get('models')->persist($detail);
        }
        $this->get('models')->flush();
        $this->View()->assign([
            'success' => true,
        ]);
    }

    /** * Event listener function of the product backend module. * Returns statistical data */

            $customer->setGroup($customerGroup);
        }

        if ($customer->getAffiliate()) {
            $customer->setAffiliate((int) $this->getPartnerId($customer));
        } else {
            $customer->setAffiliate(0);
        }

        if (!$customer->getNumber() && $this->config->get('shopwareManagedCustomerNumbers')) {
            $customer->setNumber((string) $this->numberIncrementer->increment('user'));
        }

        $this->validator->validate($customer);
        $this->modelManager->persist($customer);
        $this->modelManager->flush($customer);
        $this->modelManager->refresh($customer);
    }

    private function getPartnerId(Customer $customer): int
    {
        return (int) $this->connection->fetchColumn('SELECT id FROM s_emarketing_partner WHERE idcode = ?', [$customer->getAffiliate()]);
    }
$customer->setLanguageId($data['__customer_language']);
        $customer->setShopId($data['__customer_subshopID']);
        $customer->setReferer($data['__customer_referer']);
        $customer->setInternalComment($data['__customer_internalcomment']);
        $customer->setFailedLogins($data['__customer_failedlogins']);
        $customer->setDefaultBillingAddressId($data['__customer_default_billing_address_id']);
        $customer->setDefaultShippingAddressId($data['__customer_default_shipping_address_id']);
        $customer->setTitle($data['__customer_title']);
        $customer->setSalutation($data['__customer_salutation']);
        $customer->setFirstname($data['__customer_firstname']);
        $customer->setLastname($data['__customer_lastname']);
        $customer->setNumber($data['__customer_customernumber']);
        $customer->setNewsletter((bool) $data['__active_campaign']);

        if ($data['__customer_birthday']) {
            $customer->setBirthday(new DateTime($data['__customer_birthday']));
        }

        if ($customer->getBirthday()) {
            $customer->setAge($customer->getBirthday()->diff(new DateTime())->y);
        }

        if (!empty($data['__customer_lockeduntil'])) {
            
if ($numberModel === null) {
            $this->View()->assign([
                'success' => false,
                'message' => $this->translateMessage('errorMessage/noOrdernumber', 'Could not get ordernumber.'),
            ]);

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

            
throw new ValidationException($violations);
        }

        $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;
    }

    
$password = $this->Request()->getParam('newPassword');

        // Encode the password with md5         if (!empty($password)) {
            $customer->setPassword($password);
        }

        if (!$customer->getNumber() && Shopware()->Config()->get('shopwareManagedCustomerNumbers')) {
            /** @var NumberRangeIncrementerInterface $incrementer */
            $incrementer = Shopware()->Container()->get(NumberRangeIncrementerInterface::class);
            $customer->setNumber((string) $incrementer->increment('user'));
        }

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

        $this->View()->assign([
            'success' => true,
            'data' => $this->getCustomer($customer->getId()),
        ]);
    }

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