sAddVoucher example


    public function sUpdateVoucher()
    {
        $voucher = $this->sGetVoucher();
        if ($voucher) {
            $this->sDeleteArticle('voucher');
            if (\is_array($this->sAddVoucher($voucher['code']))) {
                $this->session->offsetSet('sBasketVoucherRemovedInCart', true);
            }
        }
    }

    /** * Insert basket discount * Used only internally in sBasket::sGetBasket() * * @throws \Enlight_Exception * @throws \Enlight_Event_Exception * @throws \Zend_Db_Adapter_Exception */
/** * Add voucher to cart * * At failure view variable sVoucherError will give further information * At success return to cart / confirm view * * @return void */
    public function addVoucherAction()
    {
        if ($this->Request()->isPost()) {
            $voucher = $this->basket->sAddVoucher($this->Request()->getParam('sVoucher'));
            if (!empty($voucher['sErrorMessages'])) {
                $this->View()->assign('sVoucherError', $voucher['sErrorMessages']);
            }
        }
        $this->forward($this->Request()->getParam('sTargetAction', 'index'));
    }

    /** * Add premium / bonus product to cart * * request param "sAddPremium" - ordernumber of bonus product (defined in s_articles_premiums) * Return to cart / confirm page on success * * @return void */
Home | Imprint | This part of the site doesn't use cookies.