returns an article view.

@param string $sShopArticleId
@param string $sViewName
@param string $sViewType
@param array  $aCallTimeVars

@return stdClass
517511
protected function GetArticleView($sShopArticleId = null, $sViewName = 'standard', $sViewType = 'Customer', $aCallTimeVars = array())
    {
        $oReturnObject = new stdClass();

        $oArticle = TdbShopArticle::GetNewInstance();
        $oArticle->Load($sShopArticleId);
        if ($oArticle->IsVariant()) {
            TdbShop::RegisterActiveVariantForSpot($this->sCallingSpotName, $oArticle->fieldVariantParentId, $oArticle->id);
        }
        $oReturnObject->sItemPage = $oArticle->Render($sViewName, $sViewType, $aCallTimeVars);
        $sKey = $oArticle->id;
        if ($oArticle->IsVariant()) {
            $sKey = $oArticle->fieldVariantParentId;
        }
        $oReturnObject->iListKey = 'key'.md5($sKey);

        return $oReturnObject;
    }
553382
protected function getArticle(
        TdbShopOrderStatusItem $oPosition,
        IMapperCacheTriggerRestricted $oCacheTriggerManager,
        $bCachingEnabled
    ) {
        $oOrderItem = $oPosition->GetFieldShopOrderItem();
        $aArticle = array();
        /** @var $oArticle TdbShopArticle */
        $oArticle = &$oOrderItem->GetFieldShopArticle();

        $aArticle['iAmount'] = number_format((float) $oOrderItem->fieldOrderAmount, 0, ',', '');
        $aArticle['iUsedAmount'] = number_format($oPosition->fieldAmount, 0, ',', '');
        $aArticle['sManufacturer'] = $oOrderItem->fieldShopManufacturerName;
        $aArticle['sArticleName'] = $oOrderItem->fieldName;
        $aArticle['sArticleVariantName'] = $oOrderItem->fieldNameVariantInfo;
        $aArticle['sPrice'] = $oOrderItem->fieldOrderPriceFormated;
        $aArticle['sPriceTotal'] = $oOrderItem->fieldOrderPriceTotalFormated;
        $aArticle['sUsedPriceTotal'] = $oOrderItem->fieldPrice * $oPosition->fieldAmount;

        if ($oArticle) {
            $aArticle['sImageId'] = $this->getArticleImageId($oArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle = $this->GetVariantInfo($oArticle, $aArticle, $oCacheTriggerManager, $bCachingEnabled);
            $aArticle['sArticleDetailURL'] = $oArticle->getLink(true);
            if ($bCachingEnabled) {
                $oCacheTriggerManager->addTrigger($oArticle->table, $oArticle->id);
            }
        }

        return $aArticle;
    }
993960
protected function &GetAdditionalViewVariables($sViewName, $sViewType)
    {
        $aViewVariables = &parent::GetAdditionalViewVariables($sViewName, $sViewType);

        $aViewVariables['bShowNewsletterSignup'] = true;
        $aViewVariables['newsletter'] = false;
        $aInput = TGlobal::instance()->GetUserData('aInput');
        if (is_array($aInput) && isset($aInput['newsletter']) && '1' == $aInput['newsletter']) {
            $aViewVariables['newsletter'] = true;
        }

        $oUser = TdbDataExtranetUser::GetInstance();
        // show newsletter signup at all?
        $aCondition = array(
            "`email` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->GetUserEMail())."'",
        );

        if ($oUser && $oUser->IsLoggedIn()) {
            $aCondition[] = "`data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oUser->id)."'";
        }
        $query = "SELECT COUNT(*) AS total FROM `pkg_newsletter_user` WHERE `optin` = '1' AND ((".implode(') OR (', $aCondition).'))';
        if ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            if ($aRow['total'] > 0) {
                $aViewVariables['bShowNewsletterSignup'] = false;
            }
        }

        return $aViewVariables;
    }
1053555
public function saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '')
    {
        $sShopId = $sShopId === null ? $this->_iShopId : $sShopId;
        if ($sShopId == $this->_iShopId) {
            $storedType = $this->getShopConfType($sVarName, $sModule);
            if ($sModule == Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme')){
                $storedValue = $this->_aConfigParamsParentTheme[$sVarName];
            } else {
                $storedValue = $this->getConfigParam($sVarName);
            }
            if ($sVarType == 'bool') {
                //some modules that have all kinds of bool representations in metadata.php may cause
                //$sVarVal to something else then a boolean, converting the value like parent::saveShopConfVar
                //would do so we can compare it to the strored representation
                $sVarVal = (($sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
            }

            if ($sVarType == $storedType && $sVarVal == $storedValue) {
                return false;
            }
        }
        parent::saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId, $sModule);
        return true;
    }
1306057
public function Render($sViewName = 'standard', $sViewType = 'Customer', $aCallTimeVars = array())
    {
        $oView = new TViewParser();
        /** @var $oView TViewParser */
        $oView->AddVar('oListItem', $this);
        $oView->AddVar('oFilterType', $this->GetFieldPkgShopListfilterItemType());
        $oView->AddVar('aCallTimeVars', $aCallTimeVars);
        $aOtherParameters = $this->GetAdditionalViewVariables($sViewName, $sViewType);
        $oView->AddVarArray($aOtherParameters);

        return $oView->RenderObjectPackageView($sViewName, TdbPkgShopListfilterItem::VIEW_PATH, $sViewType);
    }
7416
public function Render($sSpotName = null, $aCallTimeVars = array())
    {
        $oUser = TdbDataExtranetUser::GetInstance();
        if (!is_null($oUser->fieldName) && !$oUser->IsLoggedIn()) {
            $this->SetLastUserBoughtToSession($oUser);
        }
        $sHTML = parent::Render($sSpotName, $aCallTimeVars);
        TdbShopOrderStep::ResetMarkOrderProcessAsCompleted();
        // if the user is not logged in, we need to clear the user object

        if (empty($oUser->id) || false == $oUser->IsLoggedIn()) {
            $tmp = $oUser->GetInstance(true);
        }

        return $sHTML;
    }
785463
public function getCategoryList($sType, $sValue)
    {
        /** @var \OxidEsales\Eshop\Application\Model\CategoryList $oCatTree parent category tree */
        $oCatTree = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
        $oCatTree->loadList();
        if ($sType === 'cat') {
            foreach ($oCatTree as $oCategory) {
                if ($oCategory->oxcategories__oxid->value == $sValue) {
                    $oCategory->selected = 1;
                    break;
                }
            }
        }

        return $oCatTree;
    }
840028
public function getRecord($recordId, $contentTypeName = null, DataDimensions $dataDimensions = null)
    {

        if ($contentTypeName == null)
        {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        if ($dataDimensions == null)
        {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->hasContentType($contentTypeName))
        {
            if ($this->hasStashedRecord($contentTypeName, $recordId, $dataDimensions))
            {
                return $this->getStashedRecord($contentTypeName, $recordId, $dataDimensions, $this->getRecordClassForContentType($contentTypeName));
            }
            $url = 'content/' . $contentTypeName . '/record/' . $recordId . '/' . $dataDimensions->getWorkspace() . '?language=' . $dataDimensions->getLanguage() . '&view=' . $dataDimensions->getViewName() . '&timeshift=' . $dataDimensions->getTimeShift();;

            try
            {
                $response = $this->getClient()->get($url);
            }
            catch (ClientException $e)
            {
                if ($e->getCode() == 404)
                {
                    return false;
                }
                throw new AnyContentClientException ($e->getMessage());
            }

            $json = $response->json();

            $record = $this->getRecordFactory()
                           ->createRecordFromJSON($this->getContentTypeDefinition($contentTypeName), $json['record']);

            $this->stashRecord($record, $dataDimensions);

            return $record;
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);

    }
212878
public function getArticleList()
    {
        if ($this->_aArticleList === null) {
            $this->_aArticleList = [];
            if ($this->_getLoadActionsParam()) {
                // start list
                $oArtList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
                $oArtList->loadActionArticles('OXSTART');
                if ($oArtList->count()) {
                    $this->_aArticleList = $oArtList;
                }
            }
        }

        return $this->_aArticleList;
    }
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;
    }
1291523
protected function &GetAdditionalViewVariables($sViewName, $sViewType)
    {
        $aViewVariables = parent::GetAdditionalViewVariables($sViewName, $sViewType);

        $aViewVariables['oWrappingList'] = TdbShopWrappingList::GetList();
        $aViewVariables['oCardList'] = TdbShopWrappingCardList::GetList();

        return $aViewVariables;
    }
857578
protected function &GetAdditionalViewVariables($sViewName, $sViewType)
    {
        $aViewVariables = array();

        // generate a captcha
        $this->aUserInput['captcha-question'] = $this->GenerateCaptcha();

        // if no article id is in aInputData, then we fetch it from post/get
        $oArticle = TdbShopArticle::GetNewInstance();
        /** @var $oArticle TdbShopArticle */
        if (!$oArticle->Load($this->aUserInput[MTShopArticleCatalogCore::URL_ITEM_ID])) {
            $oArticle = null;
        }
        $aViewVariables['oArticle'] = &$oArticle;

        $oMsgManager = TCMSMessageManager::GetInstance();

        $aInitInputData = array('name', 'email', 'toname', 'toemail', 'comment', 'captcha');
        $aFieldMessages = array();
        foreach ($aInitInputData as $sField) {
            if (!array_key_exists($sField, $this->aUserInput)) {
                $this->aUserInput[$sField] = '';
            }
            $aFieldMessages[$sField] = false;
            $sConsumerName = 'tell-a-friend-field-'.$sField;
            if ($oMsgManager->ConsumerHasMessages($sConsumerName)) {
                $oMsgs = $oMsgManager->ConsumeMessages($sConsumerName);
                while ($oMsg = &$oMsgs->Next()) {
                    $aFieldMessages[$sField] .= $oMsg->Render();
                }
            }
        }
        $this->aUserInput['captcha'] = '';
        $aViewVariables['aFieldMessages'] = &$aFieldMessages;
        $aViewVariables['aUserInput'] = &$this->aUserInput;

        return $aViewVariables;
    }
1144746
protected function prepareBundledArticlesDataForView($article)
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDB();
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $articleTable = getViewName('oxarticles', $this->_iEditLang);
        $query = "select {$articleTable}.oxtitle, {$articleTable}.oxartnum, {$articleTable}.oxvarselect " .
            "from {$articleTable} where 1 ";
        // #546
        $isVariantSelectionEnabled = $config->getConfigParam('blVariantsSelection');
        $bundleIdField = 'oxarticles__oxbundleid';
        $query .= $isVariantSelectionEnabled ? '' : " and {$articleTable}.oxparentid = '' ";
        $query .= " and {$articleTable}.oxid = " . $database->quote($article->$bundleIdField->value);

        $resultFromDatabase = $database->select($query);
        if ($resultFromDatabase != false && $resultFromDatabase->count() > 0) {
            while (!$resultFromDatabase->EOF) {
                $articleNumber = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[1]);
                $articleTitle = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[0] . " " . $resultFromDatabase->fields[2]);
                $resultFromDatabase->fetchRow();
            }
        }
        $this->_aViewData['bundle_artnum'] = $articleNumber;
        $this->_aViewData['bundle_title'] = $articleTitle;
    }
1204519
private function getFilterFieldArticleType($filterArticleType)
    {
        $oViewRenderer = new ViewRenderer();
        $oViewRenderer->AddSourceObject('sInputClass', 'form-control form-control-sm submitOnSelect');
        $oViewRenderer->AddSourceObject('sName', 'filterArticleType');
        $oViewRenderer->AddSourceObject('sValue', '0');
        $oViewRenderer->AddSourceObject('sLabelText', $this->getTranslation('chameleon_system_shop.list_manager_article.filter_type_label'));
        $oViewRenderer->AddSourceObject('sValue', '1');
        $oViewRenderer->AddSourceObject('autoWidth', true);

        $aValueList = array();
        $aValueList[] = array('sName' => $this->getTranslation('chameleon_system_shop.list_manager_article.filter_type_all'), 'sValue' => 'all');
        $aValueList[] = array('sName' => $this->getTranslation('chameleon_system_shop.list_manager_article.filter_type_main'), 'sValue' => 'parents');
        $aValueList[] = array('sName' => $this->getTranslation('chameleon_system_shop.list_manager_article.filter_type_variants'), 'sValue' => 'variants');

        $oViewRenderer->AddSourceObject('aValueList', $aValueList);
        $oViewRenderer->AddSourceObject('sValue', $filterArticleType);

        return $oViewRenderer->Render('userInput/form/select.html.twig', null, false);
    }
847327
private function loadView($sView, $aData = array())
    {
        $oView = Factory::service('View');
        $sFile = $this->oSkin->path . 'views/' . $sView;

        if (is_file($sFile . '.php')) {

            $oView->load($sFile, $aData);

        } elseif (!empty($this->oSkinParent)) {

            $sFile = $this->oSkinParent->path . 'views/' . $sView;

            if (is_file($sFile . '.php')) {
                $oView->load($sFile, $aData);
            } else {
                throw new NailsException('Failed to load blog view "' . $sView . '"');
            }

        } else {
            throw new NailsException('Failed to load blog view "' . $sView . '"');
        }
    }
599531
public static function GetReviewsForArticleSortedByRate($iShopArticleId)
    {
        $sQuery = "SELECT * FROM `shop_article_review`
                       WHERE `shop_article_review`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopArticleId)."'
                         AND `shop_article_review`.`publish` = '1'
                    ORDER BY `shop_article_review`.`helpful_count` DESC , `shop_article_review`.`datecreated` DESC";
        $oList = &TdbShopArticleReviewList::GetList($sQuery);

        return $oList;
    }
1369832
public function getPreviousItem($currentArticleId, $pagerSpotName)
    {
        $result = $this->searchPrevious($currentArticleId, $this->requestToListUrlConverter->getListUrl());
        if (null === $result) {
            return null;
        }

        $item = $result['item'];
        $pageUrl = $result['pageUrl'];

        return $this->addPagerInfoToItem($item, $pageUrl);
    }