Checks if discount should be skipped for this article in basket. Returns true if yes.

@return bool
191
public function skipDiscounts()
    {
        // already loaded skip discounts config
        if ($this->_blSkipDiscounts !== null) {
            return $this->_blSkipDiscounts;
        }

        if ($this->oxarticles__oxskipdiscounts->value) {
            return true;
        }


        $this->_blSkipDiscounts = false;
        if (\OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->hasSkipDiscountCategories()) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sO2CView = getViewName('oxobject2category', $this->getLanguage());
            $sViewName = getViewName('oxcategories', $this->getLanguage());
            $sSelect = "select 1 from $sO2CView as $sO2CView left join {$sViewName} on {$sViewName}.oxid = $sO2CView.oxcatnid
                         where $sO2CView.oxobjectid=" . $oDb->quote($this->getId()) . " and {$sViewName}.oxactive = 1 and {$sViewName}.oxskipdiscounts = '1' ";
            $this->_blSkipDiscounts = ($oDb->getOne($sSelect) == 1);
        }

        return $this->_blSkipDiscounts;
    }
57468
private function checkStockNotEmpty()
    {
        $cart = $this->getSession()->getSessionCart($this->getDispatcher());

        $cartItems = $cart->getCartItems();

        foreach ($cartItems as $cartItem) {
            $pse = $cartItem->getProductSaleElements();

            $product = $cartItem->getProduct();

            if ($pse->getQuantity() <= 0 && $product->getVirtual() !== 1) {
                return $this->generateRedirectFromRoute('cart.view');
            }
        }

        return null;
    }
444000
public function HasBasketContentRestrictions()
    {
        $bHasArticleRestriction = $this->GetFromInternalCache('bHasArticleRestriction');
        if (is_null($bHasArticleRestriction)) {
            $aCategoryRestrictons = $this->GetMLTIdList('shop_category_mlt');
            $bHasArticleRestriction = (count($aCategoryRestrictons) > 0);
            if (!$bHasArticleRestriction) {
                $aArticleRestrictons = $this->GetMLTIdList('shop_article_mlt');
                $bHasArticleRestriction = (count($aArticleRestrictons) > 0);
            }
            $this->SetInternalCache('bHasArticleRestriction', $bHasArticleRestriction);
        }

        return $bHasArticleRestriction;
    }
1051129
protected function _isPriceViewModeNetto()
    {
        $blResult = (bool) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blShowNetPrice');
        $oUser = $this->getArticleUser();
        if ($oUser) {
            $blResult = $oUser->isPriceViewModeNetto();
        }

        return $blResult;
    }
216456
public function isDiscarded()
    {
        $deleteAfter = strtotime(self::config()->get('delete_after'), strtotime($this->Created));
        return ($this->Status === 'CART') && (time() > $deleteAfter);
    }
1282674
public function isVisible()
    {
        $oActivUser = \OxidEsales\Eshop\Core\Registry::getConfig()->getUser();
        $sActivUserId = null;
        if ($oActivUser) {
            $sActivUserId = $oActivUser->getId();
        }

        $blIsVisible = (bool) ($this->oxuserbaskets__oxpublic->value) ||
                       ($sActivUserId && ($this->oxuserbaskets__oxuserid->value == $sActivUserId));

        return $blIsVisible;
    }
57699
public function beforeSave($insert)
    {
        if (parent::beforeSave($insert)) {
            if (!$this->isNewRecord) {
                $this->total_price = \thienhungho\OrderManagement\models\OrderItem::find()
                    ->where(['order' => $this->id])
                    ->sum('total_price');
                $this->real_value = \thienhungho\OrderManagement\models\OrderItem::find()
                    ->where(['order' => $this->id])
                    ->sum('real_value');
                $this->discount_value = \thienhungho\OrderManagement\models\OrderItem::find()
                    ->where(['order' => $this->id])
                    ->sum('discount_value');
            }

            return true;
        }

        return false;
    }
401742
protected function _additionalChecksForArticle()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $utils = \OxidEsales\Eshop\Core\Registry::getUtils();

        $shouldContinue = true;
        if (!$this->_oProduct->isVisible()) {
            $shouldContinue = false;
        } elseif ($this->_oProduct->oxarticles__oxparentid->value) {
            $parentArticle = $this->_getParentProduct($this->_oProduct->oxarticles__oxparentid->value);
            if (!$parentArticle || !$parentArticle->isVisible()) {
                $shouldContinue = false;
            }
        }

        if (!$shouldContinue) {
            $utils->redirect($config->getShopHomeUrl());
            $utils->showMessageAndExit('');
        }

        $this->_processProduct($this->_oProduct);
        $this->_blIsInitialized = true;
    }
138334
public function isIgnored()
    {
        // don't ignore primary key
        if ($this->isPrimary) {
            return false;
        }
        // don't ignore when configuration is not set
        if (!$this->getConfig()->get(Formatter::CFG_SKIP_COLUMN_WITH_RELATION)) {
            return false;
        }
        // don't ignore when column has no relation
        if (0 === (count($this->getLocalForeignKeys()) + count($this->getForeignKeys()))) {
            return false;
        }

        return true;
    }
1144494
public function hasOutOfStockArticles()
    {
        $result = false;

        $basketContents = $this->getBasket()->getContents();

        foreach ($basketContents as $basketItem) {
            $article = $basketItem->getArticle();
            if (($article->getStockAmount() - $basketItem->getAmount()) < $this->getEmptyStockLevel()) {
                $result = true;
                break;
            }
        }

        return $result;
    }
1179784
protected function _calcItemsPrice()
    {
        // resetting
        $this->setSkipDiscounts(false);
        $this->_iProductsCnt = 0; // count different types
        $this->_dItemsCnt = 0; // count of item units
        $this->_dWeight = 0; // basket weight

        $this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
        $this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);

        $oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);

        /** @var \oxBasketItem $oBasketItem */
        foreach ($this->_aBasketContents as $oBasketItem) {
            $this->_iProductsCnt++;
            $this->_dItemsCnt += $oBasketItem->getAmount();
            $this->_dWeight += $oBasketItem->getWeight();

            if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
                $oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
                $oBasketItem->setRegularUnitPrice(clone $oBasketPrice);

                if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
                    // apply basket type discounts for item
                    $aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
                    reset($aDiscounts);
                    /** @var \oxDiscount $oDiscount */
                    foreach ($aDiscounts as $oDiscount) {
                        $oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
                    }
                    $oBasketPrice->calculateDiscount();
                } else {
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }

                $oBasketItem->setPrice($oBasketPrice);
                $this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());

                //P collect discount values for basket items which are discountable
                if (!$oArticle->skipDiscounts()) {
                    $this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
                } else {
                    $this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
                    $oBasketItem->setSkipDiscounts(true);
                    $this->setSkipDiscounts(true);
                }
            } elseif ($oBasketItem->isBundle()) {
                // if bundles price is set to zero
                $oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
                $oBasketItem->setPrice($oPrice);
            }
        }
    }
688031
public function beforeSave($insert)
    {
        if (parent::beforeSave($insert)) {

            $this->coupon = null;

            if ($this->isNewRecord) {
                $this->product_price = $this->product0->promotional_price;
                $this->product_unit = $this->product0->unit;
                $this->currency_unit = $this->product0->currency_unit;
                $orderItem = \thienhungho\OrderManagement\models\OrderItem::find()
                    ->where(['product' => $this->product])
                    ->andWhere(['order' => $this->order])
                    ->one();
                if (!empty($orderItem)) {
                    $this->quantity += $orderItem->quantity;
                    $orderItem->deleteWithRelated();
                }
            }

            $this->real_value = $this->quantity * $this->product_price;
            if ($this->coupon == null) {
                $this->discount_value =  0;
            }
            $this->total_price =  $this->real_value;

            return true;
        }

        return false;
    }
415290
public function checkDuplicates()
    {
        $shopNumbers = array();
        $files       = scandir(dirname($this->buildConfigFilePath()));

        foreach ($files as $file) {
            if (!is_file($this->buildConfigFilePath($file))) {
                continue;
            }

            $shopgate_config = null;
            /** @noinspection PhpIncludeInspection */
            include($this->buildConfigFilePath($file));
            if (isset($shopgate_config) && isset($shopgate_config['shop_number'])) {
                if (in_array($shopgate_config['shop_number'], $shopNumbers)) {
                    return true;
                } else {
                    $shopNumbers[] = $shopgate_config['shop_number'];
                }
            }
        }

        return false;
    }
489486
public function isVisible()
    {
        // admin preview mode
        if (($blCanPreview = \OxidEsales\Eshop\Core\Registry::getUtils()->canPreview()) !== null) {
            return $blCanPreview;
        }

        // active ?
        $sNow = date('Y-m-d H:i:s');
        if (!$this->oxarticles__oxactive->value &&
            ($this->oxarticles__oxactivefrom->value > $sNow ||
             $this->oxarticles__oxactiveto->value < $sNow
            )
        ) {
            return false;
        }

        // stock flags
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseStock') && $this->oxarticles__oxstockflag->value == 2) {
            $iOnStock = $this->oxarticles__oxstock->value + $this->oxarticles__oxvarstock->value;
            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPsBasketReservationEnabled')) {
                $iOnStock += $this->getSession()->getBasketReservations()->getReservedAmount($this->getId());
            }
            if ($iOnStock <= 0) {
                return false;
            }
        }

        return true;
    }
718981
public function isForBasketItem($oArticle)
    {
        if ($this->oxdiscount__oxamount->value == 0 && $this->oxdiscount__oxprice->value == 0) {
            return false;
        }

        // skipping bundle discounts
        if ($this->oxdiscount__oxaddsumtype->value == 'itm') {
            return false;
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        // check if this article is assigned
        $sQ = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxtype = 'oxarticles' ";
        $sQ .= $this->_getProductCheckQuery($oArticle);
        if (!($blOk = ( bool ) $oDb->getOne($sQ))) {
            // checking article category
            $blOk = $this->_checkForArticleCategories($oArticle);
        }

        return $blOk;
    }
1299790
protected function CheckBasketContents()
    {
        if ('basket' !== $this->fieldSystemname) {
            $oBasket = $this->getShopService()->getActiveBasket();
            if ($oBasket->dTotalNumberOfArticles <= 0) {
                $oBasketStep = TdbShopOrderStep::GetStep('basket');
                $this->JumpToStep($oBasketStep);
            }
        }
    }
567896
public function togglePublic()
    {
        if (!\OxidEsales\Eshop\Core\Registry::getSession()->checkSessionChallenge()) {
            return false;
        }

        if ($oUser = $this->getUser()) {
            $blPublic = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blpublic');
            $oBasket = $oUser->getBasket('wishlist');
            $oBasket->oxuserbaskets__oxpublic = new \OxidEsales\Eshop\Core\Field(($blPublic == 1) ? $blPublic : 0);
            $oBasket->save();
        }
    }