return category list for article or parent article if article is variant and fetched category list is empty.

@param TdbShopArticle $oArticle

@return TdbShopCategoryList
350902
protected function &getCategoryList(TdbShopArticle $oArticle)
    {
        /** @var $oCategoryList TdbShopCategoryList */
        $oCategoryList = &$oArticle->GetFieldShopCategoryList();
        $oCategoryList->GoToStart();
        if (0 === $oCategoryList->Length() && $oArticle->IsVariant()) {
            $oParent = &$oArticle->GetFieldVariantParent();
            $oCategoryList = &$oParent->GetFieldShopCategoryList();
            $oCategoryList->GoToStart();
        }

        return $oCategoryList;
    }
1358263
public function loadRecommLists(\OxidEsales\Eshop\Application\Model\Article $oArticle)
    {
        if (($this->_aChannel = $this->_loadFromCache(self::RSS_ARTRECOMMLISTS . $oArticle->getId()))) {
            return;
        }

        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $oConfig->setConfigParam('iNrofCrossellArticles', $oConfig->getConfigParam('iRssItemsCount'));

        $oList = oxNew(\OxidEsales\Eshop\Application\Model\RecommendationList::class)->getRecommListsByIds([$oArticle->getId()]);
        if ($oList == null) {
            $oList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
        }

        $oLang = Registry::getLang();
        $this->_loadData(
            self::RSS_ARTRECOMMLISTS . $oArticle->getId(),
            $this->getRecommListsTitle($oArticle),
            sprintf($oLang->translateString('LISTMANIA_LIST_FOR', $oLang->getBaseLanguage()), $oArticle->oxarticles__oxtitle->value),
            $this->_getRecommListItems($oList),
            $this->getRecommListsUrl($oArticle),
            $oArticle->getLink()
        );
    }
233872
protected function _checkForArticleCategories($oArticle)
    {
        // check if article is in some assigned category
        $aCatIds = $oArticle->getCategoryIds();
        if (!$aCatIds || !count($aCatIds)) {
            // no categories are set for article, so no discounts from categories..
            return false;
        }

        $sCatIds = "(" . implode(",", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aCatIds)) . ")";

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        // getOne appends limit 1, so this one should be fast enough
        $sQ = "select oxobjectid from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxobjectid in $sCatIds and oxtype = 'oxcategories'";

        return $oDb->getOne($sQ);
    }
73685
public function RemoveArticle(TShopBasketArticle &$oItem)
    {
        // find the item, then drop it
        $oItemToRemove = $this->FindItemWithProperty('sBasketItemKey', $oItem->sBasketItemKey);

        if (false === $oItemToRemove) {
            return null;
        }
        parent::RemoveItem('sBasketItemKey', $oItem->sBasketItemKey);
        $this->UpdateListData();
        $this->PostDeleteItemHook($oItemToRemove);

        return $oItemToRemove;
    }
507391
protected function _deleteThumbnail($oArticle)
    {
        if ($this->canDeleteThumbnail($oArticle)) {
            if (!$oArticle->isDerived()) {
                $oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
                $oPicHandler->deleteThumbnail($oArticle);
            }

            //reseting field
            $oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
        }
    }
988659
private static function getInstanceForCategory(TdbShopCategory $activeCategory, TdbShop $oShop)
    {
        $sPkgShopListfilterId = $activeCategory->GetFieldPkgShopListfilterIdRecursive();
        if (empty($sPkgShopListfilterId)) {
            if (!empty($oShop->fieldPkgShopListfilterCategoryFilterId)) {
                $sPkgShopListfilterId = $oShop->fieldPkgShopListfilterCategoryFilterId;
            }
        }

        if (!empty($sPkgShopListfilterId)) {
            return TdbPkgShopListfilter::GetNewInstance($sPkgShopListfilterId);
        }

        return null;
    }
500198
public function getCategoryArticlesUrl(\OxidEsales\Eshop\Application\Model\Category $oCat)
    {
        $oLang = Registry::getLang();

        return $this->_prepareUrl(
            "cl=rss&amp;fnc=catarts&amp;cat=" . urlencode($oCat->getId()),
            sprintf($oLang->translateString('CATEGORY_PRODUCTS_S', $oLang->getBaseLanguage()), $oCat->oxcategories__oxtitle->value)
        );
    }
760341
public function &GetPrimaryCategory()
    {
        $oCategory = null;
        // if this is a variant, then we want to take the parent object instead - at least if no data is set for the child
        if (!empty($this->fieldShopCategoryId)) {
            $oCategory = &$this->GetFieldShopCategory();
            if (!is_null($oCategory) && false == $oCategory->AllowDisplayInShop()) {
                $oCategory = null;
            }
        }

        if (is_null($oCategory)) {
            $oCategories = &$this->GetFieldShopCategoryList();
            $oCategories->GoToStart();
            if ($oCategories->Length() > 0) {
                $oCategory = &$oCategories->Current();
            }
        }
        if (is_null($oCategory) && $this->IsVariant()) {
            $oParent = &$this->GetFieldVariantParent();
            $oCategory = &$oParent->GetPrimaryCategory();
        }

        return $oCategory;
    }
261658
protected function _getManufacturerList($oArticle)
    {
        if ($oArticle->oxarticles__oxmanufacturerid->value) {
            $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
            if ($oManufacturer->loadInLang($this->getEditLang(), $oArticle->oxarticles__oxmanufacturerid->value)) {
                return [$oManufacturer];
            }
        }
    }
340704
public function getRecommListsUrl(\OxidEsales\Eshop\Application\Model\Article $oArticle)
    {
        $oLang = Registry::getLang();
        $iLang = $oLang->getBaseLanguage();

        return $this->_prepareUrl(
            "cl=rss&amp;fnc=recommlists&amp;anid=" . $oArticle->getId(),
            $oLang->translateString("LISTMANIA", $iLang) . "/" . $oArticle->oxarticles__oxtitle->value
        );
    }
1156100
public function ArticleListValidForShippingType(TShopBasketArticleList &$oArticleList)
    {
        $bIsValid = true;
        $dArticleValue = $oArticleList->dProductPrice;
        $dNumberOfArticles = $oArticleList->dNumberOfItems;
        $dArticleWeight = $oArticleList->dTotalWeight;
        $dArticleVolume = $oArticleList->dTotalVolume;

        if ($this->fieldValueBasedOnEntireBasket) {
            $oBasket = TShopBasket::GetInstance();
            $dArticleValue = $oBasket->dCostArticlesTotalAfterDiscounts;
        }
        if ($this->fieldApplyToAllProducts) {
            $oBasket = TShopBasket::GetInstance();
            $dNumberOfArticles = $oBasket->dTotalNumberOfArticles;
            $dArticleWeight = $oBasket->dTotalWeight;
            $dArticleVolume = $oBasket->dTotalVolume;
        }

        $bValueOk = ($this->fieldRestrictToValueFrom <= $dArticleValue && (0 == $this->fieldRestrictToValueTo || $this->fieldRestrictToValueTo >= $dArticleValue));

        $bNumberOfArticlesOk = ($this->fieldRestrictToArticlesFrom <= $dNumberOfArticles && (0 == $this->fieldRestrictToArticlesTo || $this->fieldRestrictToArticlesTo >= $dNumberOfArticles));

        $bArticleWeightOk = ($this->fieldRestrictToWeightFrom <= $dArticleWeight && (0 == $this->fieldRestrictToWeightTo || $this->fieldRestrictToWeightTo >= $dArticleWeight));

        $bArticleVolumeOk = ($this->fieldRestrictToVolumeFrom <= $dArticleVolume && (0 == $this->fieldRestrictToVolumeTo || $this->fieldRestrictToVolumeTo >= $dArticleVolume));

        $bIsValid = ($bValueOk && $bNumberOfArticlesOk && $bArticleWeightOk && $bArticleVolumeOk);

        return $bIsValid;
    }
844723
protected function _getCategory($oArticle, $iLang)
    {
        $oCat = null;
        $oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
        if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
            $oCat = $oView->getActiveCategory();
        } elseif ($oView instanceof \OxidEsales\Eshop\Core\Controller\BaseController) {
            $oCat = $oView->getActCategory();
        }

        return $oCat;
    }
894000
protected function GetVariantInfo($oArticle, $aData)
    {
        $aVariantTypeList = array();
        if ($oArticle) {
            if ($oArticle->IsVariant()) {
                $oVariantSet = $oArticle->GetFieldShopVariantSet();
                $oVariantTypes = $oVariantSet->GetFieldShopVariantTypeList();
                while ($oVariantType = $oVariantTypes->Next()) {
                    $oValue = $oArticle->GetActiveVariantValue($oVariantType->fieldIdentifier);
                    $aType = array(
                        'sTitle' => $oVariantType->fieldName,
                        'sSystemName' => $oVariantType->fieldIdentifier,
                        'cms_media_id' => $oVariantType->fieldCmsMediaId,
                        'aItems' => array(),
                    );
                    $aItems = array();
                    $aItem = array(
                        'sTitle' => $oValue->fieldName,
                        'sColor' => $oValue->fieldColorCode,
                        'cms_media_id' => $oValue->fieldCmsMediaId,
                        'bIsActive' => false,
                        'sSelectLink' => '',
                    );
                    $aItems[] = $aItem;
                    $aType['aItems'] = $aItems;
                    $aVariantTypeList[] = $aType;
                }
            }
            $aData['aVariantTypes'] = $aVariantTypeList;
        }

        return $aData;
    }
693465
public function &GetArticleObject()
    {
        if (is_null($this->oArticle)) {
            $this->oArticle = TdbShopArticle::GetNewInstance();
            if (!$this->oArticle->Load($this->sqlData['shop_article_id'])) {
                $this->oArticle = null;
            }
        }

        return $this->oArticle;
    }
273141
protected function getArticle(TdbShopOrderItem $oOrderItem, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
    {
        $aArticle = array();
        $oArticle = &$oOrderItem->GetFieldShopArticle();

        $aArticle['iAmount'] = $oOrderItem->fieldOrderAmountFormated;
        $aArticle['sManufacturer'] = $oOrderItem->fieldShopManufacturerName;
        $aArticle['sArticleName'] = $oOrderItem->fieldName;
        $aArticle['sArticleVariantName'] = $oOrderItem->fieldNameVariantInfo;
        $aArticle['sShippingInformation'] = '';
        $aArticle['sPrice'] = $oOrderItem->fieldOrderPriceFormated;
        $aArticle['sPriceTotal'] = $oOrderItem->fieldOrderPriceTotalFormated;
        $aArticle['sVat'] = $oOrderItem->fieldVatPercentFormated;
        $aArticle['sVatFormatted'] = number_format($oOrderItem->fieldVatPercent, 0, '.', '').'%';
        if ($oArticle) {
            $aArticle['sImageId'] = $this->getArticleImageId($oArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle = $this->GetVariantInfo($oArticle, $aArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle['sArticleDetailURL'] = $oArticle->GetDetailLink($this->bAbsoluteArticleUrls);
            if ($bCachingEnabled) {
                $oCacheTriggerManager->addTrigger($oArticle->table, $oArticle->id);
            }
        }
        if ($oOrderItem instanceof IPkgShopOrderItemWithCustomData) {
            $aArticle['customData'] = $oOrderItem->getCustomDataForTwigOutput();
            $aArticle['customDataTwigTemplate'] = $oOrderItem->getCustomDataTwigTemplate();
        }

        return $aArticle;
    }
965842
protected function _setCampaignDetailLink($oArticle)
    {
        // #827
        if ($sCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCampaign")) {
            // modify detaillink
            //#1166R - pangora - campaign
            $oArticle->appendLink("campaign={$sCampaign}");

            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blAppendCatToCampaign") &&
                ($sCat = $this->getCategoryString($oArticle))
            ) {
                $oArticle->appendLink("/$sCat");
            }
        }

        return $oArticle;
    }
505241
public function isMdVariant($oArticle)
    {
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseMultidimensionVariants')) {
            if (strpos($oArticle->oxarticles__oxvarselect->value, trim($this->_sMdSeparator)) !== false) {
                return true;
            }
        }

        return false;
    }