@param TdbShopArticle                                 $oArticle
@param TdbShopArticleImage|TdbShopArticlePreviewImage $oImage
@param IMapperCacheTriggerRestricted                  $oCacheTriggerManager

@return array
547721
private function getImageDetails(TdbShopArticle $oArticle, $oImage, IMapperCacheTriggerRestricted $oCacheTriggerManager)
    {
        $oCacheTriggerManager->addTrigger('cms_media', $oImage->fieldCmsMediaId);

        $router = $this->getRouter();
        $quickShopLink = $router->generateWithPrefixes('shop_article_quickshop', array('identifier' => $oArticle->sqlData['cmsident']));
        $quickShopLink = $quickShopLink.'?imageid='.$oImage->id;

        $aImage = array(
            'sImageId' => $oImage->fieldCmsMediaId,
            'sImageTitle' => '',
            'sSelectImageURL' => $quickShopLink,
            'sLargeImageId' => $oImage->fieldCmsMediaId,
            'sLargeTitle' => '',
            'sLargeSelectImageURL' => $quickShopLink,
        );

        return $aImage;
    }
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];
            }
        }
    }
308606
protected function getPaymentInformation(TdbShopOrder $oOrder, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
    {
        $aPaymentInformation = array();

        $oPaymentMethodParameterList = &$oOrder->GetFieldShopOrderPaymentMethodParameterList();
        $oPaymentMethodParameterList->GoToStart();
        while ($oPaymentParameter = &$oPaymentMethodParameterList->Next()) {
            if ($bCachingEnabled) {
                $oCacheTriggerManager->addTrigger($oPaymentParameter->table, $oPaymentParameter->id);
            }
            $aPaymentInformation[] = array(
                'sName' => $oPaymentParameter->fieldName,
                'sValue' => $oPaymentParameter->fieldValue,
            );
        }

        return $aPaymentInformation;
    }
914674
public static function GetActiveDiscountListForArticle(&$oArticle, $bIncludeUserRestrictedDiscounts = false)
    {
        $oDiscountList = new TIterator();
        if (false == $oArticle->fieldExcludeFromDiscounts) {
            $oDiscountListComplete = TdbShopDiscountList::GetActiveDiscountList();
            $oUser = null;
            if ($bIncludeUserRestrictedDiscounts) {
                $oUser = TdbDataExtranetUser::GetInstance();
            }
            while ($oDiscount = $oDiscountListComplete->Next()) {
                $bIsAbsoluteArticle = ('absolut' == $oDiscount->fieldValueType);
                $bShowDiscountOnArticleDetailPage = $oDiscount->fieldShowDiscountOnArticleDetailpage;

                $bAllowUseOfDiscount = (false == $bIsAbsoluteArticle && true == $bShowDiscountOnArticleDetailPage && true == $oDiscount->AllowDiscountForArticle($oArticle) && true == $oDiscount->AllowDiscountForUser($oUser) && false == $oDiscount->HasBasketRestrictions());
                if ($bAllowUseOfDiscount) {
                    $oDiscountList->AddItem($oDiscount);
                }
            }
        }

        return $oDiscountList;
    }
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;
    }
904737
public function getArticleFiles($blAddFromParent = false)
    {
        if ($this->_aArticleFiles === null) {
            $this->_aArticleFiles = false;

            $sQ = "SELECT * FROM `oxfiles` WHERE `oxartid` = '" . $this->getId() . "'";

            if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blVariantParentBuyable') && $blAddFromParent) {
                $sQ .= " OR `oxartId` = '" . $this->oxarticles__oxparentid->value . "'";
            }

            $oArticleFiles = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $oArticleFiles->init("oxfile");
            $oArticleFiles->selectString($sQ);
            $this->_aArticleFiles = $oArticleFiles;
        }

        return $this->_aArticleFiles;
    }
29720
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
    {
        $bPaymentOk = parent::ExecutePayment($oOrder);
        if ($bPaymentOk) {
            if ($oOrder->fieldValueTotal * 100 == $this->sAuthorisedAmount) {
                $bPaymentOk = $this->ExecuteDataTransPaymentCall($oOrder);
            } else {
                $oMsgManager = TCMSMessageManager::GetInstance();
                $oMsgManager->AddMessage($sMessageConsumer, 'ERROR_PAYMENT_DATA_TRANS_ORDER_REQUEST_AMOUNT_CHANGE');
                $bPaymentOk = false;
            }
        }

        return $bPaymentOk;
    }
485320
public function &GetAffectedBasketArticles()
    {
        if (is_null($this->oAffectedBasketArticles)) {
            $this->oAffectedBasketArticles = null;
            $oBasket = TShopBasket::GetInstance();
            $this->oAffectedBasketArticles = &$oBasket->GetArticlesAffectedByShippingType($this);
        }

        return $this->oAffectedBasketArticles;
    }
32587
protected function getDataFromVoucher(TdbShopVoucherUse $oVoucherUse, TdbShopVoucher $oVoucher = null, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
    {
        $aVoucher = array(
            'sCode' => '',
            'sName' => '',
            'dValue' => $oVoucherUse->fieldValueUsed,
            'dValueInOrderCurrency' => $oVoucherUse->fieldValueUsedInOrderCurrency,
            'sValue' => TCMSLocal::GetActive()->FormatNumber($oVoucherUse->fieldValueUsed, 2),
            'sValueInOrderCurrency' => TCMSLocal::GetActive()->FormatNumber($oVoucherUse->fieldValueUsedInOrderCurrency, 2),
            'sRemoveFromBasketLink' => '#', );

        if (null !== $oVoucher) {
            $aVoucher['sCode'] = $oVoucher->fieldCode;
            $oVoucherSeries = &$oVoucher->GetFieldShopVoucherSeries();
            if (null !== $oVoucherSeries) {
                if ($bCachingEnabled) {
                    $oCacheTriggerManager->addTrigger($oVoucherSeries->table, $oVoucherSeries->id);
                }
                $aVoucher['sName'] = $oVoucherSeries->fieldName;
            }
        }

        return $aVoucher;
    }
441536
public static function GetNavigationStepList(TdbShopOrderStep $oActiveStep)
    {
        $query = "SELECT *
                 FROM `shop_order_step`
                WHERE `show_in_navigation` = '1'
             ORDER BY `position` ASC
              ";
        $oSteps = &TdbShopOrderStepList::GetList($query);
        $oSteps->bAllowItemCache = true;
        $stepIdList = array();
        while ($oStep = &$oSteps->Next()) {
            if (false === $oStep->IsActive()) {
                continue;
            }
            $stepIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($oStep->id);
            if ($oActiveStep->id == $oStep->id) {
                $oStep->bIsTheActiveStep = true;
            } else {
                $oStep->bIsTheActiveStep = false;
            }
        }

        $query = "SELECT *
                 FROM `shop_order_step`
                WHERE `show_in_navigation` = '1' AND `id` IN ('".implode("','", $stepIdList)."')
             ORDER BY `position` ASC
              ";
        $oSteps = &TdbShopOrderStepList::GetList($query);
        $oSteps->bAllowItemCache = true;
        while ($oStep = &$oSteps->Next()) {
            $stepIdList[] = $oStep->id;
            if ($oActiveStep->id == $oStep->id) {
                $oStep->bIsTheActiveStep = true;
            } else {
                $oStep->bIsTheActiveStep = false;
            }
        }

        $oSteps->GoToStart();

        return $oSteps;
    }
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()
        );
    }
802853
protected function GetExternalPaymentHandlerURL(TdbShopOrder $oOrder)
    {
        $oUser = TdbDataExtranetUser::GetInstance();
        $oCountry = $oUser->GetCountry();
        $sActiveFrontEndLanguageCode = self::getLanguageService()->getLanguageIsoCode();
        $aParameter = array(
            'PSPID' => $this->GetPSPID(),
            'ORDERID' => $oOrder->fieldOrdernumber,
            'AMOUNT' => $oOrder->fieldValueTotal * 100,
            'CURRENCY' => $this->GetCurrency(),
            'LANGUAGE' => strtolower($sActiveFrontEndLanguageCode).'_'.strtoupper($sActiveFrontEndLanguageCode),
            'CN' => $oUser->fieldFirstname.' '.$oUser->fieldLastname,
            'EMAIL' => $oUser->fieldName,
            'OWNERADDRESS' => $oUser->fieldStreet.' '.$oUser->fieldStreetnr,
            'OWNERCTY' => $oCountry->fieldName,
            'OWNERTOWN' => $oUser->fieldCity,
            'OWNERZIP' => $oUser->fieldPostalcode,
            'PARAMPLUS' => 'PAYCALL='.self::URL_IDENTIFIER.'&PAYHAID='.$this->sqlData['cmsident'], 'PARAMVAR' => self::URL_IDENTIFIER_NOTIFY, );
        $this->AddCustomParameter($aParameter);
        $sOgonePaymentLayoutPageURL = $this->GetOgonePaymentLayoutPage();
        if ($sOgonePaymentLayoutPageURL) {
            $aParameter['TP'] = $sOgonePaymentLayoutPageURL;
        }
        $aParameter['ACCEPTURL'] = $this->GetResponseURL('success');
        $aParameter['DECLINEURL'] = $this->GetResponseURL('decline');
        $aParameter['SHASIGN'] = $this->BuildOutgoingHash($aParameter);
        $sExternalHandlerURL = $this->GetPaymentURL().'?'.str_replace('&amp;', '&', TTools::GetArrayAsURL($aParameter));

        return $sExternalHandlerURL;
    }
511659
public function parseRequest(TdbPkgShopPaymentIpnMessage $oMessage)
    {
        if (false === $this->isIPNRequest()) {
            throw new TPkgShopPaymentIPNException_RequestError($this, "handleIPN called with an invalid URL (URL: {$this->getRequestURL(
            )})", 0);
        }

        $aParts = explode(self::URL_IPN_IDENTIFIER, $this->requestURL);
        if (2 !== count($aParts)) {
            throw new TPkgShopPaymentIPNException_RequestError($this, "handleIPN called with an invalid URL (URL: {$this->getRequestURL(
            )})", 0);
        }

        $sData = substr(
            $this->requestURL,
            stripos($this->requestURL, self::URL_IPN_IDENTIFIER) + strlen(self::URL_IPN_IDENTIFIER)
        );

        if ('' === empty($sData)) {
            throw new TPkgShopPaymentIPNException_RequestError($this, "handleIPN called with an invalid URL (URL: {$this->getRequestURL(
            )})", 0);
        }

        $sPaymentGroupIdentifier = null;
        $sOrderCmsIdent = null;
        if (false !== strpos($sData, '__')) {
            $sPaymentGroupIdentifier = substr($sData, 0, strpos($sData, '__'));
            $sOrderCmsIdent = substr($sData, strpos($sData, '__') + 2);
        } else {
            $sPaymentGroupIdentifier = $sData;
        }

        if (null !== $sPaymentGroupIdentifier) {
            $this->paymentHandlerGroup = null;
            $oPaymentHandlerGroup = TdbShopPaymentHandlerGroup::GetNewInstance();
            if (false === $oPaymentHandlerGroup->LoadFromField('ipn_group_identifier', $sPaymentGroupIdentifier)) {
                if (false === $oPaymentHandlerGroup->LoadFromField('system_name', $sPaymentGroupIdentifier)) {
                    $oPaymentHandlerGroup = null;
                }
            }

            // cast to correct object type
            if (null !== $oPaymentHandlerGroup) {
                $this->paymentHandlerGroup = TdbShopPaymentHandlerGroup::GetNewInstance($oPaymentHandlerGroup->sqlData);
            }
        }
        if (null === $this->paymentHandlerGroup) {
            throw new TPkgShopPaymentIPNException_InvalidPaymentHandlerGroupInRequest($this, "no payment handler group found for URL (URL: {$this->getRequestURL(
            )})", 0);
        }

        // we have a payment group - we may need to transform the raw data using it (because the encoding may be non utf8 for exampel)
        $oMessage->SaveFieldsFast(array('shop_payment_handler_group_id' => $this->paymentHandlerGroup->id));

        // once we have the group we may need to convert the request data
        if ('UTF-8' !== strtoupper($this->getPaymentHandlerGroup()->fieldIpnPayloadCharacterCharset)) {
            $this->requestPayload = $this->convertCharset(
                $this->requestPayload,
                $this->getPaymentHandlerGroup()->fieldIpnPayloadCharacterCharset
            );
        }

        $this->requestPayload = $this->paymentHandlerGroup->processRawRequestData($this->requestPayload);

        $oMessage->SaveFieldsFast(
            array('payload' => serialize($this->requestPayload))
        ); // note: we need to serialize the data since savefieldsfast does NO data transformation before saving

        if (null !== $sOrderCmsIdent) {
            $oOrder = TdbShopOrder::GetNewInstance();
            if (true === $oOrder->LoadFromField('cmsident', $sOrderCmsIdent)) {
                $this->order = $oOrder;
            } else {
                throw new TPkgShopPaymentIPNException_OrderNotFound($sOrderCmsIdent, $this, "order [{$sOrderCmsIdent}] passed via URL not found (URL: {$this->getRequestURL(
                )})", 0);
            }
        } else {
            $this->order = $this->getPaymentHandlerGroup()->getOrderFromRequestData($this->getRequestPayload());
            if (null === $this->order) {
                throw new TPkgShopPaymentIPNException_OrderNotFound($sOrderCmsIdent, $this, "Order not found using payment group [{$this->getPaymentHandlerGroup(
                )->id} class: ".get_class($this->getPaymentHandlerGroup()).'] for request ['.print_r(
                    $this->getRequestPayload(),
                    true
                )."] (URL: {$this->getRequestURL()})", 0);
            }
        }

        $oMessage->SaveFieldsFast(array('shop_order_id' => $this->getOrder()->id));

        $oPaymentHandler = $this->getOrder()->GetPaymentHandler();

        if (null === $oPaymentHandler || false === ($oPaymentHandler instanceof IPkgShopPaymentIPNPaymentHandler)) {
            throw new TPkgShopPaymentIPNException_SystemError_PaymentHanlderDoesNotSupportIPN($this, "Payment handler in order ({$this->getOrder(
            )->id}) must be an instance of IPkgShopPaymentIPNPaymentHandler", 0);
        }

        $this->paymentHandler = $oPaymentHandler;

        // add trigger
        $this->addTrigger($oMessage);
    }
185607
protected function ViewArticleHook()
    {
        $this->SetTemplate('MTShopArticleCatalog', 'system/article');

        // add review item and fill with user data
        $oReviewItem = TdbShopArticleReview::GetNewInstance();
        /** @var $oReviewItem TdbShopArticleReview */
        $oGlobal = TGlobal::instance();
        $aReviewData = array();
        if ($oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) {
            $aReviewData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME);
        } else {
            $oUser = TdbDataExtranetUser::GetInstance();
            if ($oUser->IsLoggedIn()) {
                $aReviewData['author_name'] = $oUser->GetUserAlias();
                $aReviewData['author_email'] = $oUser->GetUserEMail();
            }
        }
        $aReviewData['captcha-question'] = $this->GenerateCaptcha();

        if (is_array($aReviewData)) {
            $oReviewItem->LoadFromRowProtected($aReviewData);
        }
        $this->data['oReviewEntryItem'] = &$oReviewItem;
    }
775484
private function validateBasketContentBuyable(TShopBasketArticle $oBasketArticle, $sMessageManager)
    {
        $bValid = true;
        if (false === $oBasketArticle->IsBuyable()) {
            $oMessage = TCMSMessageManager::GetInstance();
            $aErrorCodes = $oBasketArticle->GetSQLWithTablePrefix();
            $oMessage->AddMessage($sMessageManager, 'ERROR-ADD-TO-BASKET-ARTICLE-NOT-BUYABLE', $aErrorCodes);
            if ($this->IsInList($oBasketArticle)) {
                $this->RemoveArticle($oBasketArticle);
            }
            $bValid = false;
        }

        return $bValid;
    }
1132817
public function SaveArticles(TShopBasketArticleList $oBasketArticleList)
    {
        if (!is_null($this->id)) {
            $oBasketArticleList->GoToStart();
            while ($oBasketItem = $oBasketArticleList->Next()) {
                $this->SaveArticle($oBasketItem);
            }
        }
    }
1125989
public function AllowDiscountForArticle(TdbShopArticle $oArticle)
    {
        $bMayBeUsed = true;
        if ($oArticle->fieldExcludeFromDiscounts) {
            $bMayBeUsed = false;
        }

        // check article restrictions
        if ($bMayBeUsed) {
            $aArticleRestrictions = $this->GetFieldShopArticleWithInverseEmptySelectionLogicIdList();
            if (null === $aArticleRestrictions || (count($aArticleRestrictions) > 0 && !in_array($oArticle->id, $aArticleRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        // check category restrictions
        if ($bMayBeUsed) {
            $aCategoryRestrictions = $this->GetFieldShopCategoryWithInverseEmptySelectionLogicIdList();
            if (null === $aCategoryRestrictions || (count($aCategoryRestrictions) > 0 && !$oArticle->IsInCategory($aCategoryRestrictions))) {
                $bMayBeUsed = false;
            }
        }

        return $bMayBeUsed;
    }