sInsertPremium example

if ($this->Request()->isPost()) {
            if (!$this->Request()->getParam('sAddPremium')) {
                $this->session->offsetSet(
                    'sErrorMessages',
                    $this->container->get('snippets')->getNamespace('frontend')->get(
                        'CheckoutSelectPremiumVariant',
                        'Please select an option to place the required premium to the cart'
                    )
                );
            } else {
                $this->front->ensureRequest()->setQuery('sAddPremium', $this->Request()->getParam('sAddPremium'));
                $this->basket->sInsertPremium();
            }
        }
        $this->redirect([
            'controller' => $this->Request()->getParam('sTarget', 'checkout'),
            'action' => $this->Request()->getParam('sTargetAction', 'index'),
        ]);
    }

    /** * On any change on country, payment or dispatch recalculate shipping costs * and forward to cart / confirm view * * @return void */
foreach ($basketData as $basketContent) {
            if (empty($basketContent['modus'])) {
                $cartItem = new CartItemStruct();
                $cartItem->setId((int) $basketContent['id']);
                $cartItem->setQuantity((int) $basketContent['quantity']);
                $cartItems[] = $cartItem;
            }
        }
        $this->updateCartItems($cartItems);

        // Check, if we have some free products for the client         $this->sInsertPremium();

        // Delete previous given discounts         $premiumShipping = $this->config->get('sPREMIUMSHIPPIUNG');
        if (empty($premiumShipping)) {
            $this->db->delete(
                's_order_basket',
                [
                    'sessionID = ?' => $this->session->get('sessionId'),
                    'modus = 3',
                ]
            );
        }
Home | Imprint | This part of the site doesn't use cookies.