idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
37,100
public function hasAmountPrice ( ) { if ( self :: $ _blHasAmountPrice === null ) { self :: $ _blHasAmountPrice = false ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "SELECT 1 FROM `oxprice2article` LIMIT 1" ; if ( $ oDb -> getOne ( $ sQ ) ) { self :: $ _blHasAmountPrice = true ; } } return self :: $ _blHasAmountPrice ; }
Checks if articles has amount price
37,101
protected function _selectCategoryIds ( $ query , $ field ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ aResult = $ oDb -> getAll ( $ query ) ; $ aReturn = [ ] ; foreach ( $ aResult as $ aValue ) { $ aValue = array_change_key_case ( $ aValue , CASE_LOWER ) ; $ aReturn [ ] = $ aValue [ $ field ] ; } return $ aReturn ; }
Selects category IDs from given SQL statement and ID field name
37,102
protected function _getCategoryIdsSelect ( $ blActCats = false ) { $ sO2CView = $ this -> _getObjectViewName ( 'oxobject2category' ) ; $ sCatView = $ this -> _getObjectViewName ( 'oxcategories' ) ; $ sArticleIdSql = 'oxobject2category.oxobjectid=' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getId ( ) ) ; if ( $ this -> getParentId ( ) ) { $ sArticleIdSql = '(' . $ sArticleIdSql . ' or oxobject2category.oxobjectid=' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getParentId ( ) ) . ')' ; } $ sActiveCategorySql = $ blActCats ? $ this -> _getActiveCategorySelectSnippet ( ) : '' ; $ sSelect = "select oxobject2category.oxcatnid as oxcatnid from $sO2CView as oxobject2category left join $sCatView as oxcategories on oxcategories.oxid = oxobject2category.oxcatnid where $sArticleIdSql and oxcategories.oxid is not null and oxcategories.oxactive = 1 $sActiveCategorySql order by oxobject2category.oxtime" ; return $ sSelect ; }
Returns query for article categories select
37,103
protected function _hasAnyVariant ( $ blForceCoreTable = null ) { if ( ( $ sId = $ this -> getId ( ) ) ) { if ( $ this -> oxarticles__oxshopid -> value == \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ) { return ( bool ) $ this -> oxarticles__oxvarcount -> value ; } $ sArticleTable = $ this -> getViewName ( $ blForceCoreTable ) ; return ( bool ) \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getOne ( "select 1 from $sArticleTable where oxparentid='{$sId}'" ) ; } return false ; }
Checks if parent has ANY variant assigned
37,104
protected function _saveArtLongDesc ( ) { if ( in_array ( "oxlongdesc" , $ this -> _aSkipSaveFields ) ) { return ; } if ( $ this -> _blEmployMultilanguage ) { $ sValue = $ this -> getLongDescription ( ) -> getRawValue ( ) ; if ( $ sValue !== null ) { $ oArtExt = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ MultiLanguageModel :: class ) ; $ oArtExt -> init ( 'oxartextends' ) ; $ oArtExt -> setLanguage ( ( int ) $ this -> getLanguage ( ) ) ; if ( ! $ oArtExt -> load ( $ this -> getId ( ) ) ) { $ oArtExt -> setId ( $ this -> getId ( ) ) ; } $ oArtExt -> oxartextends__oxlongdesc = new \ OxidEsales \ Eshop \ Core \ Field ( $ sValue , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oArtExt -> save ( ) ; } } else { $ oArtExt = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ MultiLanguageModel :: class ) ; $ oArtExt -> setEnableMultilang ( false ) ; $ oArtExt -> init ( 'oxartextends' ) ; $ aObjFields = $ oArtExt -> _getAllFields ( true ) ; if ( ! $ oArtExt -> load ( $ this -> getId ( ) ) ) { $ oArtExt -> setId ( $ this -> getId ( ) ) ; } foreach ( $ aObjFields as $ sKey => $ sValue ) { if ( preg_match ( '/^oxlongdesc(_(\d{1,2}))?$/' , $ sKey ) ) { $ sField = $ this -> _getFieldLongName ( $ sKey ) ; if ( isset ( $ this -> $ sField ) ) { $ sLongDesc = null ; if ( $ this -> $ sField instanceof \ OxidEsales \ Eshop \ Core \ Field ) { $ sLongDesc = $ this -> $ sField -> getRawValue ( ) ; } elseif ( is_object ( $ this -> $ sField ) ) { $ sLongDesc = $ this -> $ sField -> value ; } if ( isset ( $ sLongDesc ) ) { $ sAEField = $ oArtExt -> _getFieldLongName ( $ sKey ) ; $ oArtExt -> $ sAEField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sLongDesc , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; } } } } $ oArtExt -> save ( ) ; } }
inserts article long description to artextends table
37,105
protected function _getAmountPrice ( $ amount = 1 ) { startProfile ( "_getAmountPrice" ) ; $ dPrice = $ this -> _getGroupPrice ( ) ; $ oAmtPrices = $ this -> _getAmountPriceList ( ) ; foreach ( $ oAmtPrices as $ oAmPrice ) { if ( $ oAmPrice -> oxprice2article__oxamount -> value <= $ amount && $ amount <= $ oAmPrice -> oxprice2article__oxamountto -> value && $ dPrice > $ oAmPrice -> oxprice2article__oxaddabs -> value ) { $ dPrice = $ oAmPrice -> oxprice2article__oxaddabs -> value ; } } stopProfile ( "_getAmountPrice" ) ; return $ dPrice ; }
Modifies article price depending on given amount . Takes data from oxprice2article table .
37,106
protected function _modifySelectListPrice ( $ dPrice , $ aChosenList = null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> getConfigParam ( 'bl_perfLoadSelectLists' ) && $ myConfig -> getConfigParam ( 'bl_perfUseSelectlistPrice' ) ) { $ aSelLists = $ this -> getSelectLists ( ) ; foreach ( $ aSelLists as $ key => $ aSel ) { if ( isset ( $ aChosenList [ $ key ] ) && isset ( $ aSel [ $ aChosenList [ $ key ] ] ) ) { $ oSel = $ aSel [ $ aChosenList [ $ key ] ] ; if ( $ oSel -> priceUnit == 'abs' ) { $ dPrice += $ oSel -> price ; } elseif ( $ oSel -> priceUnit == '%' ) { $ dPrice += \ OxidEsales \ Eshop \ Core \ Price :: percent ( $ dPrice , $ oSel -> price ) ; } } } } return $ dPrice ; }
Modifies article price according to selected select list value
37,107
protected function _fillAmountPriceList ( $ aAmPriceList ) { $ oLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; foreach ( $ aAmPriceList as $ sId => $ oItem ) { $ oItemPrice = $ this -> _getPriceObject ( ) ; if ( $ oItem -> oxprice2article__oxaddabs -> value ) { $ dBasePrice = $ oItem -> oxprice2article__oxaddabs -> value ; $ dBasePrice = $ this -> _prepareModifiedPrice ( $ dBasePrice ) ; $ oItemPrice -> setPrice ( $ dBasePrice ) ; $ this -> _calculatePrice ( $ oItemPrice ) ; } else { $ dBasePrice = $ this -> _getGroupPrice ( ) ; $ dBasePrice = $ this -> _prepareModifiedPrice ( $ dBasePrice ) ; $ oItemPrice -> setPrice ( $ dBasePrice ) ; $ oItemPrice -> subtractPercent ( $ oItem -> oxprice2article__oxaddperc -> value ) ; } $ aAmPriceList [ $ sId ] -> fbrutprice = $ oLang -> formatCurrency ( $ oItemPrice -> getBruttoPrice ( ) ) ; $ aAmPriceList [ $ sId ] -> fnetprice = $ oLang -> formatCurrency ( $ oItemPrice -> getNettoPrice ( ) ) ; if ( $ quantity = $ this -> getUnitQuantity ( ) ) { $ aAmPriceList [ $ sId ] -> fbrutamountprice = $ oLang -> formatCurrency ( $ oItemPrice -> getBruttoPrice ( ) / $ quantity ) ; $ aAmPriceList [ $ sId ] -> fnetamountprice = $ oLang -> formatCurrency ( $ oItemPrice -> getNettoPrice ( ) / $ quantity ) ; } } return $ aAmPriceList ; }
Fills amount price list object and sets amount price for article object
37,108
protected function _applyVAT ( \ OxidEsales \ Eshop \ Core \ Price $ oPrice , $ dVat ) { startProfile ( __FUNCTION__ ) ; $ oPrice -> setVAT ( $ dVat ) ; $ oVatSelector = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ VatSelector :: class ) ; if ( ( $ dVat = $ oVatSelector -> getArticleUserVat ( $ this ) ) !== false ) { $ oPrice -> setUserVat ( $ dVat ) ; } stopProfile ( __FUNCTION__ ) ; }
Applies VAT to article
37,109
protected function _applyCurrency ( \ OxidEsales \ Eshop \ Core \ Price $ oPrice , $ oCur = null ) { if ( ! $ oCur ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; } $ oPrice -> multiply ( $ oCur -> rate ) ; }
Applies currency factor
37,110
protected function _getAttribsString ( & $ sAttributeSql , & $ iCnt ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = 'select oxattrid from oxobject2attribute where oxobject2attribute.oxobjectid=' . $ oDb -> quote ( $ this -> getId ( ) ) ; if ( $ this -> getParentId ( ) ) { $ sSelect .= ' OR oxobject2attribute.oxobjectid=' . $ oDb -> quote ( $ this -> getParentId ( ) ) ; } $ sAttributeSql = '' ; $ aAttributeIds = $ oDb -> getCol ( $ sSelect ) ; if ( is_array ( $ aAttributeIds ) && count ( $ aAttributeIds ) ) { $ aAttributeIds = array_unique ( $ aAttributeIds ) ; $ iCnt = count ( $ aAttributeIds ) ; $ sAttributeSql .= 't1.oxattrid IN ( ' . implode ( ',' , $ oDb -> quoteArray ( $ aAttributeIds ) ) . ') ' ; } }
gets attribs string
37,111
protected function _getSimList ( $ sAttributeSql , $ iCnt ) { $ iAttrPercent = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iAttributesPercent' ) / 100 ; if ( ! $ iAttrPercent || $ iAttrPercent < 0 || $ iAttrPercent > 1 ) { $ iAttrPercent = 0.70 ; } $ iHitMin = ceil ( $ iCnt * $ iAttrPercent ) ; $ aExcludeIds = [ ] ; $ aExcludeIds [ ] = $ this -> getId ( ) ; if ( $ this -> getParentId ( ) ) { $ aExcludeIds [ ] = $ this -> getParentId ( ) ; } $ sSelect = "select oxobjectid from oxobject2attribute as t1 where ( $sAttributeSql ) and t1.oxobjectid NOT IN (" . implode ( ', ' , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aExcludeIds ) ) . ") group by t1.oxobjectid having count(*) >= $iHitMin LIMIT 0, 20" ; return \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getCol ( $ sSelect ) ; }
Gets similar list .
37,112
protected function _generateSimListSearchStr ( $ sArticleTable , $ aList ) { $ sFieldList = $ this -> getSelectFields ( ) ; $ aList = array_slice ( $ aList , 0 , \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iNrofSimilarArticles' ) ) ; $ sSearch = "select $sFieldList from $sArticleTable where " . $ this -> getSqlActiveSnippet ( ) . " and $sArticleTable.oxissearch = 1 and $sArticleTable.oxid in ( " ; $ sSearch .= implode ( ',' , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aList ) ) . ')' ; $ sSearch .= ' order by rand() ' ; return $ sSearch ; }
Generates search string for similar list .
37,113
protected function _generateSearchStrForCustomerBought ( ) { $ sArtTable = $ this -> getViewName ( ) ; $ sOrderArtTable = getViewName ( 'oxorderarticles' ) ; $ sIn = " '{$this->oxarticles__oxid->value}' " ; if ( $ this -> oxarticles__oxparentid -> value ) { $ sIn .= ", '{$this->oxarticles__oxparentid->value}' " ; $ sParentIdForVariants = $ this -> oxarticles__oxparentid -> value ; } else { $ sParentIdForVariants = $ this -> getId ( ) ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ oRs = $ oDb -> select ( "select oxid from {$sArtTable} where oxparentid = " . $ oDb -> quote ( $ sParentIdForVariants ) . " and oxid != " . $ oDb -> quote ( $ this -> oxarticles__oxid -> value ) ) ; if ( $ oRs != false && $ oRs -> count ( ) > 0 ) { while ( ! $ oRs -> EOF ) { $ sIn .= ", " . $ oDb -> quote ( current ( $ oRs -> fields ) ) . " " ; $ oRs -> fetchRow ( ) ; } } $ iLimit = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iNrofCustomerWhoArticles' ) ; $ iLimit = $ iLimit ? ( $ iLimit * 10 ) : 50 ; return "select distinct {$sArtTable}.* from ( select d.oxorderid as suborderid from {$sOrderArtTable} as d use index ( oxartid ) where d.oxartid in ( {$sIn} ) limit {$iLimit} ) as suborder left join {$sOrderArtTable} force index ( oxorderid ) on suborder.suborderid = {$sOrderArtTable}.oxorderid left join {$sArtTable} on {$sArtTable}.oxid = {$sOrderArtTable}.oxartid where {$sArtTable}.oxid not in ( {$sIn} ) and ( {$sArtTable}.oxissearch = 1 or {$sArtTable}.oxparentid <> '' ) and " . $ this -> getSqlActiveSnippet ( ) ; }
Generates SQL select string for getCustomerAlsoBoughtThisProduct
37,114
protected function buildAmountPriceList ( ) { if ( $ this -> getAmountPriceList ( ) === null ) { $ oAmPriceList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ AmountPriceList :: class ) ; $ this -> setAmountPriceList ( $ oAmPriceList ) ; if ( ! $ this -> skipDiscounts ( ) ) { $ oAmPriceList -> load ( $ this ) ; $ oBasePrice = $ this -> _getGroupPrice ( ) ; foreach ( $ oAmPriceList as $ oAmPrice ) { if ( $ oAmPrice -> oxprice2article__oxaddperc -> value ) { $ oAmPrice -> oxprice2article__oxaddabs = new \ OxidEsales \ Eshop \ Core \ Field ( \ OxidEsales \ Eshop \ Core \ Price :: percent ( $ oBasePrice , 100 - $ oAmPrice -> oxprice2article__oxaddperc -> value ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; } } } $ this -> setAmountPriceList ( $ oAmPriceList ) ; } return $ this -> _oAmountPriceList ; }
Collecting assigned to article amount - price list .
37,115
protected function _isFieldEmpty ( $ sFieldName ) { $ mValue = $ this -> $ sFieldName -> value ; if ( is_null ( $ mValue ) ) { return true ; } if ( $ mValue === '' ) { return true ; } $ aZeroValueFields = [ 'oxarticles__oxprice' , 'oxarticles__oxvat' , 'oxarticles__oxunitquantity' ] ; if ( ! $ mValue && in_array ( $ sFieldName , $ aZeroValueFields ) ) { return true ; } if ( ! strcmp ( $ mValue , '0000-00-00 00:00:00' ) || ! strcmp ( $ mValue , '0000-00-00' ) ) { return true ; } $ sFieldName = strtolower ( $ sFieldName ) ; if ( $ sFieldName == 'oxarticles__oxicon' && ( strpos ( $ mValue , "nopic_ico.jpg" ) !== false || strpos ( $ mValue , "nopic.jpg" ) !== false ) ) { return true ; } if ( strpos ( $ mValue , "nopic.jpg" ) !== false && ( $ sFieldName == 'oxarticles__oxthumb' || substr ( $ sFieldName , 0 , 17 ) == 'oxarticles__oxpic' || substr ( $ sFieldName , 0 , 18 ) == 'oxarticles__oxzoom' ) ) { return true ; } return false ; }
Detects if field is empty .
37,116
protected function _isImageField ( $ sFieldName ) { return ( stristr ( $ sFieldName , '_oxthumb' ) || stristr ( $ sFieldName , '_oxicon' ) || stristr ( $ sFieldName , '_oxzoom' ) || stristr ( $ sFieldName , '_oxpic' ) ) ; }
Detects if field is an image field by field name
37,117
protected function _assignNotBuyableParent ( ) { if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blVariantParentBuyable' ) && ( $ this -> _blHasVariants || $ this -> oxarticles__oxvarstock -> value || $ this -> oxarticles__oxvarcount -> value ) ) { $ this -> _blNotBuyableParent = true ; } }
if we have variants then depending on config option the parent may be non buyable
37,118
protected function _assignStock ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ myConfig -> getConfigParam ( 'blAllowUnevenAmounts' ) && ! $ this -> isAdmin ( ) ) { $ this -> oxarticles__oxstock = new \ OxidEsales \ Eshop \ Core \ Field ( ( int ) floor ( $ this -> oxarticles__oxstock -> value ) ) ; } $ this -> _iStockStatus = 0 ; if ( $ myConfig -> getConfigParam ( 'blUseStock' ) && $ this -> oxarticles__oxstockflag -> value != 4 ) { $ iStock = $ this -> oxarticles__oxstock -> value ; if ( $ this -> _blNotBuyableParent ) { $ iStock = $ this -> oxarticles__oxvarstock -> value ; } if ( $ iStock <= $ myConfig -> getConfigParam ( 'sStockWarningLimit' ) && $ iStock > 0 ) { $ this -> _iStockStatus = 1 ; } if ( $ iStock <= 0 ) { $ this -> _iStockStatus = - 1 ; } } if ( $ myConfig -> getConfigParam ( 'blUseStock' ) && ( $ this -> oxarticles__oxstockflag -> value == 3 || $ this -> oxarticles__oxstockflag -> value == 2 ) ) { $ iOnStock = $ this -> oxarticles__oxstock -> value ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blPsBasketReservationEnabled' ) ) { $ iOnStock += $ this -> getSession ( ) -> getBasketReservations ( ) -> getReservedAmount ( $ this -> getId ( ) ) ; } if ( $ iOnStock <= 0 ) { $ this -> setBuyableState ( false ) ; } } if ( $ this -> _blNotBuyable && $ this -> oxarticles__oxvarstock -> value ) { $ this -> setBuyableState ( true ) ; $ this -> _blNotBuyableParent = true ; } if ( ! $ myConfig -> getConfigParam ( 'blVariantParentBuyable' ) && ! $ myConfig -> getConfigParam ( 'blLoadVariants' ) && $ this -> oxarticles__oxvarstock -> value ) { $ this -> setBuyableState ( false ) ; } if ( ! $ this -> _blNotBuyable && $ this -> _blNotBuyableParent && $ this -> oxarticles__oxvarcount -> value == 0 ) { $ this -> setBuyableState ( false ) ; } }
Assigns stock status to article
37,119
protected function _assignPersistentParam ( ) { $ aPersParam = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'persparam' ) ; if ( isset ( $ aPersParam ) && isset ( $ aPersParam [ $ this -> getId ( ) ] ) ) { $ this -> _aPersistParam = $ aPersParam [ $ this -> getId ( ) ] ; } }
Assigns persistent param to article .
37,120
protected function _assignDynImageDir ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sThisShop = $ this -> oxarticles__oxshopid -> value ; $ this -> _sDynImageDir = $ myConfig -> getPictureUrl ( null , false ) ; $ this -> dabsimagedir = $ myConfig -> getPictureDir ( false ) ; $ this -> nossl_dimagedir = $ myConfig -> getPictureUrl ( null , false , false , null , $ sThisShop ) ; $ this -> ssl_dimagedir = $ myConfig -> getPictureUrl ( null , false , true , null , $ sThisShop ) ; }
assigns dynimagedir to article
37,121
protected function _assignComparisonListFlag ( ) { $ aItems = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'aFiltcompproducts' ) ; if ( isset ( $ aItems [ $ this -> getId ( ) ] ) ) { $ this -> _blIsOnComparisonList = true ; } }
Adds a flag if article is on comparisonlist .
37,122
protected function _deleteRecords ( $ articleId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ articleId = $ oDb -> quote ( $ articleId ) ; $ sDelete = 'delete from oxobject2article where oxarticlenid = ' . $ articleId . ' or oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxobject2attribute where oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxobject2category where oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxobject2selectlist where oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxprice2article where oxartid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxreviews where oxtype="oxarticle" and oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxratings where oxobjectid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxaccessoire2article where oxobjectid = ' . $ articleId . ' or oxarticlenid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxobject2delivery where oxobjectid = ' . $ articleId . ' and oxtype=\'oxarticles\' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxartextends where oxid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; foreach ( $ this -> _getLanguageSetTables ( "oxartextends" ) as $ sSetTbl ) { $ oDb -> execute ( "delete from $sSetTbl where oxid = {$articleId}" ) ; } $ sDelete = 'delete from oxactions2article where oxartid = ' . $ articleId . ' ' ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = 'delete from oxobject2list where oxobjectid = ' . $ articleId . ' ' ; return $ oDb -> execute ( $ sDelete ) ; }
Deletes records in database
37,123
protected function _deleteVariantRecords ( $ sOXID ) { if ( $ sOXID ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ query = 'select oxid from ' . $ this -> getViewName ( ) . ' where oxparentid = ?' ; $ rs = $ database -> select ( $ query , [ $ sOXID ] ) ; $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { while ( ! $ rs -> EOF ) { $ oArticle -> setId ( $ rs -> fields [ 0 ] ) ; $ oArticle -> delete ( ) ; $ rs -> fetchRow ( ) ; } } } }
Deletes variant records
37,124
protected function _onChangeResetCounts ( $ sOxid , $ sVendorId = null , $ sManufacturerId = null ) { $ myUtilsCount = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsCount ( ) ; if ( $ sVendorId ) { $ myUtilsCount -> resetVendorArticleCount ( $ sVendorId ) ; } if ( $ sManufacturerId ) { $ myUtilsCount -> resetManufacturerArticleCount ( $ sManufacturerId ) ; } $ aCategoryIds = $ this -> getCategoryIds ( ) ; foreach ( $ aCategoryIds as $ sCatId ) { $ myUtilsCount -> resetCatArticleCount ( $ sCatId ) ; } }
Resets category and vendor counts . This method is supposed to be called on article change trigger .
37,125
protected function _onChangeUpdateStock ( $ parentId ) { if ( $ parentId ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ query = 'SELECT oxstock, oxvendorid, oxmanufacturerid FROM oxarticles WHERE oxid = ?' ; $ rs = $ database -> select ( $ query , [ $ parentId ] ) ; $ oldStock = $ rs -> fields [ 0 ] ; $ vendorId = $ rs -> fields [ 1 ] ; $ manufacturerId = $ rs -> fields [ 2 ] ; $ query = 'SELECT SUM(oxstock) FROM ' . $ this -> getViewName ( true ) . ' WHERE oxparentid = ? AND ' . $ this -> getSqlActiveSnippet ( true ) . ' AND oxstock > 0 ' ; $ stock = ( float ) $ database -> getOne ( $ query , [ $ parentId ] ) ; $ query = 'UPDATE oxarticles SET oxvarstock = ? WHERE oxid = ?' ; $ database -> execute ( $ query , [ $ stock , $ parentId ] ) ; if ( $ stock < 0 ) { $ stock = 0 ; } if ( $ oldStock < 0 ) { $ oldStock = 0 ; } if ( $ this -> oxarticles__oxstockflag -> value == 2 && $ oldStock xor $ stock ) { $ this -> _onChangeResetCounts ( $ parentId , $ vendorId , $ manufacturerId ) ; } } }
Updates article stock . This method is supposed to be called on article change trigger .
37,126
protected function _onChangeStockResetCount ( $ sOxid ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> getConfigParam ( 'blUseStock' ) && $ this -> oxarticles__oxstockflag -> value == 2 && ( $ this -> oxarticles__oxstock -> value + $ this -> oxarticles__oxvarstock -> value ) <= 0 ) { $ this -> _onChangeResetCounts ( $ sOxid , $ this -> oxarticles__oxvendorid -> value , $ this -> oxarticles__oxmanufacturerid -> value ) ; } }
Resets article count cache when stock value is zero and article goes offline .
37,127
protected function _onChangeUpdateVarCount ( $ parentId ) { if ( $ parentId ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ query = "SELECT COUNT(*) AS varcount FROM oxarticles WHERE oxparentid = ?" ; $ varCount = ( int ) $ database -> getOne ( $ query , [ $ parentId ] ) ; $ query = "UPDATE oxarticles SET oxvarcount = ? WHERE oxid = ?" ; $ database -> execute ( $ query , [ $ varCount , $ parentId ] ) ; } }
Updates variant count . This method is supposed to be called on article change trigger .
37,128
protected function _setVarMinMaxPrice ( $ sParentId ) { if ( $ sParentId ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ sQ = ' SELECT MIN( IF( `oxarticles`.`oxprice` > 0, `oxarticles`.`oxprice`, `p`.`oxprice` ) ) AS `varminprice`, MAX( IF( `oxarticles`.`oxprice` > 0, `oxarticles`.`oxprice`, `p`.`oxprice` ) ) AS `varmaxprice` FROM ' . $ this -> getViewName ( true ) . ' AS `oxarticles` LEFT JOIN ' . $ this -> getViewName ( true ) . ' AS `p` ON ( `p`.`oxid` = `oxarticles`.`oxparentid` AND `p`.`oxprice` > 0 ) WHERE ' . $ this -> getSqlActiveSnippet ( true ) . ' AND ( `oxarticles`.`oxparentid` = ' . $ database -> quote ( $ sParentId ) . ' )' ; $ aPrices = $ database -> getRow ( $ sQ ) ; if ( isset ( $ aPrices [ 'varminprice' ] , $ aPrices [ 'varmaxprice' ] ) ) { $ sQ = ' UPDATE `oxarticles` SET `oxvarminprice` = ' . $ database -> quote ( $ aPrices [ 'varminprice' ] ) . ', `oxvarmaxprice` = ' . $ database -> quote ( $ aPrices [ 'varmaxprice' ] ) . ' WHERE `oxid` = ' . $ database -> quote ( $ sParentId ) ; } else { $ sQ = ' UPDATE `oxarticles` SET `oxvarminprice` = `oxprice`, `oxvarmaxprice` = `oxprice` WHERE `oxid` = ' . $ database -> quote ( $ sParentId ) ; } $ database -> execute ( $ sQ ) ; } }
Updates variant min price . This method is supposed to be called on article change trigger .
37,129
protected function _hasMasterImage ( $ iIndex ) { $ sPicName = basename ( $ this -> { "oxarticles__oxpic" . $ iIndex } -> value ) ; if ( $ sPicName == "nopic.jpg" || $ sPicName == "" ) { return false ; } if ( $ this -> isVariant ( ) && $ this -> getParentArticle ( ) && $ this -> getParentArticle ( ) -> { "oxarticles__oxpic" . $ iIndex } -> value == $ this -> { "oxarticles__oxpic" . $ iIndex } -> value ) { return false ; } $ sMasterPic = 'product/' . $ iIndex . "/" . $ sPicName ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getMasterPicturePath ( $ sMasterPic ) ) { return true ; } return false ; }
Checks if article has uploaded master image for selected picture
37,130
protected function _isPriceViewModeNetto ( ) { $ blResult = ( bool ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blShowNetPrice' ) ; $ oUser = $ this -> getArticleUser ( ) ; if ( $ oUser ) { $ blResult = $ oUser -> isPriceViewModeNetto ( ) ; } return $ blResult ; }
Checks and return true if price view mode is netto
37,131
protected function _getPriceObject ( $ blCalculationModeNetto = null ) { $ oPrice = oxNew ( \ OxidEsales \ Eshop \ Core \ Price :: class ) ; if ( $ blCalculationModeNetto === null ) { $ blCalculationModeNetto = $ this -> _isPriceViewModeNetto ( ) ; } if ( $ blCalculationModeNetto ) { $ oPrice -> setNettoPriceMode ( ) ; } else { $ oPrice -> setBruttoPriceMode ( ) ; } return $ oPrice ; }
Depending on view mode prepare oxPrice object
37,132
protected function _getPriceForView ( $ oPrice ) { if ( $ this -> _isPriceViewModeNetto ( ) ) { $ dPrice = $ oPrice -> getNettoPrice ( ) ; } else { $ dPrice = $ oPrice -> getBruttoPrice ( ) ; } return $ dPrice ; }
Depending on view mode prepare price for viewing
37,133
protected function _preparePrice ( $ dPrice , $ dVat , $ blCalculationModeNetto = null ) { if ( $ blCalculationModeNetto === null ) { $ blCalculationModeNetto = $ this -> _isPriceViewModeNetto ( ) ; } $ oCurrency = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; $ blEnterNetPrice = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blEnterNetPrice' ) ; if ( $ blCalculationModeNetto && ! $ blEnterNetPrice ) { $ dPrice = round ( \ OxidEsales \ Eshop \ Core \ Price :: brutto2Netto ( $ dPrice , $ dVat ) , $ oCurrency -> decimal ) ; } elseif ( ! $ blCalculationModeNetto && $ blEnterNetPrice ) { $ dPrice = round ( \ OxidEsales \ Eshop \ Core \ Price :: netto2Brutto ( $ dPrice , $ dVat ) , $ oCurrency -> decimal ) ; } return $ dPrice ; }
Depending on view mode prepare price before calculation
37,134
protected function _getUserPriceSufix ( ) { $ sPriceSuffix = '' ; $ oUser = $ this -> getArticleUser ( ) ; if ( $ oUser ) { if ( $ oUser -> inGroup ( 'oxidpricea' ) ) { $ sPriceSuffix = 'a' ; } elseif ( $ oUser -> inGroup ( 'oxidpriceb' ) ) { $ sPriceSuffix = 'b' ; } elseif ( $ oUser -> inGroup ( 'oxidpricec' ) ) { $ sPriceSuffix = 'c' ; } } return $ sPriceSuffix ; }
Return price suffix
37,135
protected function _getPrice ( ) { $ sPriceSuffix = $ this -> _getUserPriceSufix ( ) ; if ( $ sPriceSuffix === '' ) { $ dPrice = $ this -> oxarticles__oxprice -> value ; } else { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blOverrideZeroABCPrices' ) ) { $ dPrice = ( $ this -> { 'oxarticles__oxprice' . $ sPriceSuffix } -> value != 0 ) ? $ this -> { 'oxarticles__oxprice' . $ sPriceSuffix } -> value : $ this -> oxarticles__oxprice -> value ; } else { $ dPrice = $ this -> { 'oxarticles__oxprice' . $ sPriceSuffix } -> value ; } } return $ dPrice ; }
Return prepared price
37,136
protected function _getVarMinPrice ( ) { if ( $ this -> _dVarMinPrice === null ) { $ dPrice = $ this -> _getShopVarMinPrice ( ) ; if ( is_null ( $ dPrice ) ) { $ sPriceSuffix = $ this -> _getUserPriceSufix ( ) ; if ( $ sPriceSuffix === '' ) { $ dPrice = $ this -> oxarticles__oxvarminprice -> value ; } else { $ sSql = 'SELECT ' ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blOverrideZeroABCPrices' ) ) { $ sSql .= 'MIN( IF(`oxprice' . $ sPriceSuffix . '` = 0, `oxprice`, `oxprice' . $ sPriceSuffix . '`) ) AS `varminprice` ' ; } else { $ sSql .= 'MIN(`oxprice' . $ sPriceSuffix . '`) AS `varminprice` ' ; } $ sSql .= ' FROM ' . $ this -> getViewName ( true ) . ' WHERE ' . $ this -> getSqlActiveSnippet ( true ) . ' AND ( `oxparentid` = ' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getId ( ) ) . ' )' ; $ dPrice = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getOne ( $ sSql ) ; } } $ this -> _dVarMinPrice = $ dPrice ; } return $ this -> _dVarMinPrice ; }
Return variant min price
37,137
protected function _getVarMaxPrice ( ) { if ( $ this -> _dVarMaxPrice === null ) { $ dPrice = $ this -> _getShopVarMaxPrice ( ) ; if ( is_null ( $ dPrice ) ) { $ sPriceSuffix = $ this -> _getUserPriceSufix ( ) ; if ( $ sPriceSuffix === '' ) { $ dPrice = $ this -> oxarticles__oxvarmaxprice -> value ; } else { $ sSql = 'SELECT ' ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blOverrideZeroABCPrices' ) ) { $ sSql .= 'MAX( IF(`oxprice' . $ sPriceSuffix . '` = 0, `oxprice`, `oxprice' . $ sPriceSuffix . '`) ) AS `varmaxprice` ' ; } else { $ sSql .= 'MAX(`oxprice' . $ sPriceSuffix . '`) AS `varmaxprice` ' ; } $ sSql .= ' FROM ' . $ this -> getViewName ( true ) . ' WHERE ' . $ this -> getSqlActiveSnippet ( true ) . ' AND ( `oxparentid` = ' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getId ( ) ) . ' )' ; $ dPrice = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getOne ( $ sSql ) ; } } $ this -> _dVarMaxPrice = $ dPrice ; } return $ this -> _dVarMaxPrice ; }
Return variant max price
37,138
protected function _updateParentDependFields ( ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; foreach ( $ this -> _getCopyParentFields ( ) as $ sField ) { $ sValue = isset ( $ this -> $ sField -> value ) ? $ this -> $ sField -> value : 0 ; $ sSqlSets [ ] = '`' . str_replace ( 'oxarticles__' , '' , $ sField ) . '` = ' . $ oDb -> quote ( $ sValue ) ; } $ sSql = "UPDATE `oxarticles` SET " ; $ sSql .= implode ( ', ' , $ sSqlSets ) . '' ; $ sSql .= " WHERE `oxparentid` = " . $ oDb -> quote ( $ this -> getId ( ) ) ; return $ oDb -> execute ( $ sSql ) ; }
Set parent field value to child - variants in DB
37,139
protected function _assignParentDependFields ( ) { $ sParent = $ this -> getParentArticle ( ) ; if ( $ sParent ) { foreach ( $ this -> _getCopyParentFields ( ) as $ sField ) { $ this -> $ sField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sParent -> $ sField -> value ) ; } } }
Set parent field value to child - variants
37,140
protected function _saveSortingFieldValuesOnLoad ( ) { $ aSortingFields = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aSortCols' ) ; $ aSortingFields = ! empty ( $ aSortingFields ) ? ( array ) $ aSortingFields : [ ] ; foreach ( $ aSortingFields as $ sField ) { $ sFullField = $ this -> _getFieldLongName ( $ sField ) ; $ this -> _aSortingFieldsOnLoad [ $ sFullField ] = $ this -> $ sFullField -> value ; } }
Saves values of sorting fields on article load .
37,141
protected function getLoadVariantsQuery ( $ blRemoveNotOrderables , $ forceCoreTableUsage , $ baseObject , $ sArticleTable ) { return "select " . $ baseObject -> getSelectFields ( $ forceCoreTableUsage ) . " from $sArticleTable where " . $ this -> getActiveCheckQuery ( $ forceCoreTableUsage ) . $ this -> getVariantsQuery ( $ blRemoveNotOrderables , $ forceCoreTableUsage ) . " order by $sArticleTable.oxsort" ; }
Forms query to load variants .
37,142
public function getSession ( ) { if ( self :: $ _oSession == null ) { self :: $ _oSession = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) ; } return self :: $ _oSession ; }
oxSession instance getter
37,143
public function getUser ( ) { if ( self :: $ _oActUser === null ) { self :: $ _oActUser = false ; $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ user -> loadActiveUser ( ) ) { self :: $ _oActUser = $ user ; } } return self :: $ _oActUser ; }
Active user getter
37,144
public function dispatchEvent ( \ Symfony \ Component \ EventDispatcher \ Event $ event ) { $ container = \ OxidEsales \ EshopCommunity \ Internal \ Application \ ContainerFactory :: getInstance ( ) -> getContainer ( ) ; $ dispatcher = $ container -> get ( EventDispatcherInterface :: class ) ; return $ dispatcher -> dispatch ( $ event :: NAME , $ event ) ; }
Dispatch given event .
37,145
public function save ( ) { parent :: save ( ) ; $ soxId = $ this -> getEditObjectId ( ) ; if ( $ this -> _allowAdminEdit ( $ soxId ) ) { $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ aDynvalues = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "dynvalue" ) ; if ( isset ( $ aDynvalues ) ) { $ aParams [ 'oxuserpayments__oxvalue' ] = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> assignValuesToText ( $ aDynvalues ) ; } if ( $ aParams [ 'oxuserpayments__oxid' ] == "-1" ) { $ aParams [ 'oxuserpayments__oxid' ] = null ; } $ oAdress = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ UserPayment :: class ) ; $ oAdress -> assign ( $ aParams ) ; $ oAdress -> save ( ) ; } }
Saves user payment settings .
37,146
public function delPayment ( ) { $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ soxId = $ this -> getEditObjectId ( ) ; if ( $ this -> _allowAdminEdit ( $ soxId ) ) { if ( $ aParams [ 'oxuserpayments__oxid' ] != "-1" ) { $ oAdress = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ UserPayment :: class ) ; if ( $ oAdress -> load ( $ aParams [ 'oxuserpayments__oxid' ] ) ) { $ this -> _blDelete = ( bool ) $ oAdress -> delete ( ) ; } } } }
Deletes selected user payment information .
37,147
public function getUser ( ) { if ( $ this -> _oActiveUser == null ) { $ this -> _oActiveUser = false ; $ sOxId = $ this -> getEditObjectId ( ) ; if ( isset ( $ sOxId ) && $ sOxId != "-1" ) { $ this -> _oActiveUser = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; $ this -> _oActiveUser -> load ( $ sOxId ) ; } } return $ this -> _oActiveUser ; }
Returns selected user
37,148
public function getSelUserPayment ( ) { if ( $ this -> _oUserPayment == null ) { $ this -> _oUserPayment = false ; $ sPaymentId = $ this -> getPaymentId ( ) ; if ( $ sPaymentId != "-1" && isset ( $ sPaymentId ) ) { $ this -> _oUserPayment = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ UserPayment :: class ) ; $ this -> _oUserPayment -> load ( $ sPaymentId ) ; $ sTemplate = $ this -> _oUserPayment -> oxuserpayments__oxvalue -> value ; $ oPaymentTypes = $ this -> getPaymentTypes ( ) ; foreach ( $ oPaymentTypes as $ oPayment ) { if ( $ oPayment -> oxpayments__oxid -> value == $ this -> _oUserPayment -> oxuserpayments__oxpaymentsid -> value ) { $ oPayment -> selected = 1 ; if ( ! $ sTemplate ) { $ sTemplate = $ oPayment -> oxpayments__oxvaldesc -> value ; } break ; } } $ this -> _oUserPayment -> setDynValues ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> assignValuesFromText ( $ sTemplate ) ) ; } } return $ this -> _oUserPayment ; }
Returns selected Payment
37,149
protected function _getEncoder ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ SeoEncoderContent :: class ) ; }
Returns current object type seo encoder object
37,150
public function objectToXml ( $ oInput , $ sDocument ) { $ oXml = new SimpleXMLElement ( "<?xml version=\"1.0\" encoding=\"utf-8\"?><$sDocument/>" ) ; $ this -> _addSimpleXmlElement ( $ oXml , $ oInput ) ; return $ oXml -> asXml ( ) ; }
Parses object structure to XML string
37,151
protected function _addChildNode ( $ oXml , $ sKey , $ mElement , $ sPreferredKey = null ) { $ aAttributes = [ ] ; if ( is_array ( $ mElement ) && array_key_exists ( 'attributes' , $ mElement ) && is_array ( $ mElement [ 'attributes' ] ) ) { $ aAttributes = $ mElement [ 'attributes' ] ; $ mElement = $ mElement [ 'value' ] ; } if ( is_object ( $ mElement ) || is_array ( $ mElement ) ) { if ( is_int ( key ( $ mElement ) ) ) { $ this -> _addSimpleXmlElement ( $ oXml , $ mElement , $ sKey ) ; } else { $ oChildNode = $ oXml -> addChild ( $ sPreferredKey ? $ sPreferredKey : $ sKey ) ; $ this -> _addNodeAttributes ( $ oChildNode , $ aAttributes ) ; $ this -> _addSimpleXmlElement ( $ oChildNode , $ mElement ) ; } } else { $ oChildNode = $ oXml -> addChild ( $ sPreferredKey ? $ sPreferredKey : $ sKey , $ mElement ) ; $ this -> _addNodeAttributes ( $ oChildNode , $ aAttributes ) ; } return $ oXml ; }
Adds child node to given simple xml object .
37,152
protected function _addNodeAttributes ( $ oNode , $ aAttributes ) { $ aAttributes = ( array ) $ aAttributes ; foreach ( $ aAttributes as $ sKey => $ sValue ) { $ oNode -> addAttribute ( $ sKey , $ sValue ) ; } return $ oNode ; }
Adds attributes to given node .
37,153
protected function _toList ( $ sListType , $ sProductId , $ dAmount , $ aSel ) { if ( $ oUser = $ this -> getUser ( ) ) { $ sProductId = ( $ sProductId ) ? $ sProductId : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'itmid' ) ; $ sProductId = ( $ sProductId ) ? $ sProductId : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'aid' ) ; $ dAmount = isset ( $ dAmount ) ? $ dAmount : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'am' ) ; $ aSel = $ aSel ? $ aSel : \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sel' ) ; $ dAmount = str_replace ( ',' , '.' , $ dAmount ) ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blAllowUnevenAmounts' ) ) { $ dAmount = round ( ( string ) $ dAmount ) ; } $ oBasket = $ oUser -> getBasket ( $ sListType ) ; $ oBasket -> addItemToBasket ( $ sProductId , abs ( $ dAmount ) , $ aSel , ( $ dAmount == 0 ) ) ; $ oBasket -> getItemCount ( true ) ; } }
Adds chosen product to defined user list . if amount is 0 item is removed from the list
37,154
public function delete ( $ sOxId = null ) { if ( ! $ sOxId ) { $ sOxId = $ this -> getId ( ) ; } $ this -> unsetDiscountRelations ( ) ; $ this -> unsetUserGroups ( ) ; $ this -> deleteVoucherList ( ) ; return parent :: delete ( $ sOxId ) ; }
Override delete function so we can delete user group and article or category relations first .
37,155
public function setUserGroups ( ) { if ( $ this -> _oGroups === null ) { $ this -> _oGroups = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ ListModel :: class ) ; $ this -> _oGroups -> init ( 'oxgroups' ) ; $ sViewName = getViewName ( "oxgroups" ) ; $ sSelect = "select gr.* from {$sViewName} as gr, oxobject2group as o2g where o2g.oxobjectid = " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getId ( ) ) . " and gr.oxid = o2g.oxgroupsid " ; $ this -> _oGroups -> selectString ( $ sSelect ) ; } return $ this -> _oGroups ; }
Collects and returns user group list .
37,156
public function unsetUserGroups ( ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sDelete = 'delete from oxobject2group where oxobjectid = ' . $ oDb -> quote ( $ this -> getId ( ) ) ; $ oDb -> execute ( $ sDelete ) ; }
Removes user groups relations .
37,157
public function getVoucherList ( ) { $ oVoucherList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ VoucherList :: class ) ; $ sSelect = 'select * from oxvouchers where oxvoucherserieid = ' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ this -> getId ( ) ) ; $ oVoucherList -> selectString ( $ sSelect ) ; return $ oVoucherList ; }
Returns array of a vouchers assigned to this serie .
37,158
public function countVouchers ( ) { $ aStatus = [ ] ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQuery = 'select count(*) as total from oxvouchers where oxvoucherserieid = ' . $ oDb -> quote ( $ this -> getId ( ) ) ; $ aStatus [ 'total' ] = $ oDb -> getOne ( $ sQuery ) ; $ sQuery = 'select count(*) as used from oxvouchers where oxvoucherserieid = ' . $ oDb -> quote ( $ this -> getId ( ) ) . ' and ((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0))' ; $ aStatus [ 'used' ] = $ oDb -> getOne ( $ sQuery ) ; $ aStatus [ 'available' ] = $ aStatus [ 'total' ] - $ aStatus [ 'used' ] ; return $ aStatus ; }
Returns array of vouchers counts .
37,159
protected function _setRootObjectData ( ) { $ this -> setId ( 'root' ) ; $ this -> oxvendor__oxicon = new \ OxidEsales \ Eshop \ Core \ Field ( '' , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ this -> oxvendor__oxtitle = new \ OxidEsales \ Eshop \ Core \ Field ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'BY_VENDOR' , $ this -> getLanguage ( ) , false ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ this -> oxvendor__oxshortdesc = new \ OxidEsales \ Eshop \ Core \ Field ( '' , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; return true ; }
Sets root vendor data . Returns true
37,160
public function changePassword ( ) { if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> checkSessionChallenge ( ) ) { return ; } $ oUser = $ this -> getUser ( ) ; if ( ! $ oUser ) { return ; } $ sOldPass = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'password_old' , true ) ; $ sNewPass = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'password_new' , true ) ; $ sConfPass = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'password_new_confirm' , true ) ; $ oInputValidator = \ OxidEsales \ Eshop \ Core \ Registry :: getInputValidator ( ) ; if ( ( $ oExcp = $ oInputValidator -> checkPassword ( $ oUser , $ sNewPass , $ sConfPass , true ) ) ) { switch ( $ oExcp -> getMessage ( ) ) { case 'ERROR_MESSAGE_INPUT_EMPTYPASS' : case 'ERROR_MESSAGE_PASSWORD_TOO_SHORT' : return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'ERROR_MESSAGE_PASSWORD_TOO_SHORT' , false , true ) ; default : return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'ERROR_MESSAGE_PASSWORD_DO_NOT_MATCH' , false , true ) ; } } if ( ! $ sOldPass || ! $ oUser -> isSamePassword ( $ sOldPass ) ) { $ oUtilsView = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) ; return $ oUtilsView -> addErrorToDisplay ( 'ERROR_MESSAGE_CURRENT_PASSWORD_INVALID' , false , true ) ; } $ oUser -> setPassword ( $ sNewPass ) ; if ( $ oUser -> save ( ) ) { $ this -> _blPasswordChanged = true ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> deleteUserCookie ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ) ; } }
changes current user password
37,161
public function getVendorPageUrl ( $ vendor , $ pageNumber , $ languageId = null , $ isFixed = null ) { if ( ! isset ( $ languageId ) ) { $ languageId = $ vendor -> getLanguage ( ) ; } $ stdUrl = $ vendor -> getBaseStdLink ( $ languageId ) ; $ parameters = null ; $ stdUrl = $ this -> _trimUrl ( $ stdUrl , $ languageId ) ; $ seoUrl = $ this -> getVendorUri ( $ vendor , $ languageId ) ; if ( $ isFixed === null ) { $ isFixed = $ this -> _isFixed ( 'oxvendor' , $ vendor -> getId ( ) , $ languageId ) ; } return $ this -> assembleFullPageUrl ( $ vendor , 'oxvendor' , $ stdUrl , $ seoUrl , $ pageNumber , $ parameters , $ languageId , $ isFixed ) ; }
Returns vendor SEO url for specified page
37,162
public function getVendorUrl ( $ vendor , $ languageId = null ) { if ( ! isset ( $ languageId ) ) { $ languageId = $ vendor -> getLanguage ( ) ; } return $ this -> _getFullUrl ( $ this -> getVendorUri ( $ vendor , $ languageId ) , $ languageId ) ; }
Encodes vendor category URLs into SEO format .
37,163
public function onDeleteVendor ( $ vendor ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ vendorId = $ vendor -> getId ( ) ; $ database -> execute ( "delete from oxseo where oxobjectid = ? and oxtype = 'oxvendor'" , [ $ vendorId ] ) ; $ database -> execute ( "delete from oxobject2seodata where oxobjectid = ?" , [ $ vendorId ] ) ; $ database -> execute ( "delete from oxseohistory where oxobjectid = ?" , [ $ vendorId ] ) ; }
Deletes Vendor seo entry
37,164
protected function _getAltUri ( $ vendorId , $ languageId ) { $ seoUrl = null ; $ vendor = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Vendor :: class ) ; if ( $ vendor -> loadInLang ( $ languageId , $ vendorId ) ) { $ seoUrl = $ this -> getVendorUri ( $ vendor , $ languageId , true ) ; } return $ seoUrl ; }
Returns alternative uri used while updating seo .
37,165
public function addToSet ( ) { $ aChosenSets = $ this -> _getActionIds ( 'oxdelivery.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sDeliveryViewName = $ this -> _getViewName ( 'oxdelivery' ) ; $ aChosenSets = $ this -> _getAll ( $ this -> _addFilter ( "select $sDeliveryViewName.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aChosenSets ) ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; foreach ( $ aChosenSets as $ sChosenSet ) { $ sID = $ database -> getOne ( "select oxid from oxdel2delset where oxdelid = " . $ database -> quote ( $ sChosenSet ) . " and oxdelsetid = " . $ database -> quote ( $ soxId ) ) ; if ( ! isset ( $ sID ) || ! $ sID ) { $ oDel2delset = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oDel2delset -> init ( 'oxdel2delset' ) ; $ oDel2delset -> oxdel2delset__oxdelid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenSet ) ; $ oDel2delset -> oxdel2delset__oxdelsetid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oDel2delset -> save ( ) ; } } } }
Adds this delivery cost to these sets
37,166
public function getReviewAndRatingItemsCount ( ) { $ user = $ this -> getUser ( ) ; $ count = 0 ; if ( $ user ) { $ count = $ this -> getContainer ( ) -> get ( UserReviewAndRatingBridgeInterface :: class ) -> getReviewAndRatingListCount ( $ user -> getId ( ) ) ; } return $ count ; }
Get the total number of reviews for the active user .
37,167
protected function _getComponentNames ( ) { if ( self :: $ _aCollectedComponentNames === null ) { self :: $ _aCollectedComponentNames = array_merge ( $ this -> _aComponentNames , $ this -> _aUserComponentNames ) ; if ( ( $ userComponentNames = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aUserComponentNames' ) ) ) { self :: $ _aCollectedComponentNames = array_merge ( self :: $ _aCollectedComponentNames , $ userComponentNames ) ; } if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( '_force_no_basket_cmp' ) ) { unset ( self :: $ _aCollectedComponentNames [ 'oxcmp_basket' ] ) ; } } reset ( self :: $ _aCollectedComponentNames ) ; return self :: $ _aCollectedComponentNames ; }
Returns component names .
37,168
protected function _processRequest ( ) { $ utils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; if ( ! isSearchEngineUrl ( ) && $ utils -> seoIsActive ( ) && ( $ requestUrl = getRequestUrl ( ) ) ) { if ( $ this -> _canRedirect ( ) && ( $ redirectUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getSeoEncoder ( ) -> fetchSeoUrl ( $ requestUrl ) ) ) { $ utils -> redirect ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getCurrentShopUrl ( ) . $ redirectUrl , false , 301 ) ; } elseif ( VIEW_INDEXSTATE_INDEX == $ this -> noIndex ( ) ) { $ this -> _forceNoIndex ( ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blSeoLogging' ) ) { $ shopId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ languageId = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ id = md5 ( strtolower ( $ requestUrl ) . $ shopId . $ languageId ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ database -> execute ( "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang ) values ( ?, ?, ?, ? ) " , [ $ requestUrl , $ id , $ shopId , $ languageId ] ) ; } } } }
In non admin mode checks if request was NOT processed by seo handler . If NOT then tries to load alternative SEO url and if url is available - redirects to it . If no alternative path was found - 404 header is emitted and page is rendered
37,169
public function getViewId ( ) { if ( isset ( $ this -> _sViewId ) ) { return $ this -> _sViewId ; } return $ this -> _sViewId = $ this -> generateViewId ( ) ; }
If current view ID is not set - forms and returns view ID according to language and currency .
37,170
protected function generateViewId ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ viewId = $ this -> generateViewIdBase ( ) ; $ viewId .= "|" . ( ( int ) $ this -> _blForceNoIndex ) . '|' . ( ( int ) $ this -> isRootCatChanged ( ) ) ; if ( $ config -> isSsl ( ) ) { $ viewId .= "|ssl" ; } if ( function_exists ( 'customGetViewId' ) ) { $ externalViewId = customGetViewId ( ) ; if ( $ externalViewId !== null ) { $ viewId .= '|' . md5 ( serialize ( $ externalViewId ) ) ; } } return $ viewId ; }
Generates current view id .
37,171
protected function generateViewIdBase ( ) { $ languageId = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ currencyId = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopCurrency ( ) ; return "ox|$languageId|$currencyId" ; }
Generates base for view id .
37,172
public function getComponent ( $ name ) { if ( isset ( $ name ) && isset ( $ this -> _oaComponents [ $ name ] ) ) { return $ this -> _oaComponents [ $ name ] ; } }
Get component object
37,173
public function getListType ( ) { if ( $ this -> _sListType == null ) { if ( $ listType = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'listtype' ) ) { $ this -> _sListType = $ listType ; } elseif ( $ listType = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getGlobalParameter ( 'listtype' ) ) { $ this -> _sListType = $ listType ; } } return $ this -> _sListType ; }
Get list type
37,174
public function getListDisplayType ( ) { if ( $ this -> _sListDisplayType == null ) { $ this -> _sListDisplayType = $ this -> getCustomListDisplayType ( ) ; if ( ! $ this -> _sListDisplayType ) { $ this -> _sListDisplayType = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sDefaultListDisplayType' ) ; } $ this -> _sListDisplayType = in_array ( ( string ) $ this -> _sListDisplayType , $ this -> _aListDisplayTypes ) ? $ this -> _sListDisplayType : 'infogrid' ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'ldtype' ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'ldtype' , $ this -> _sListDisplayType ) ; } } return $ this -> _sListDisplayType ; }
Returns list type
37,175
public function getCustomListDisplayType ( ) { if ( $ this -> _sCustomListDisplayType == null ) { $ this -> _sCustomListDisplayType = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'ldtype' ) ; if ( ! $ this -> _sCustomListDisplayType ) { $ this -> _sCustomListDisplayType = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'ldtype' ) ; } } return $ this -> _sCustomListDisplayType ; }
Returns changed default list type
37,176
public function setListType ( $ type ) { $ this -> _sListType = $ type ; \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> setGlobalParameter ( 'listtype' , $ type ) ; }
List type setter
37,177
public function loadCurrency ( ) { if ( $ this -> _blLoadCurrency == null ) { $ this -> _blLoadCurrency = false ; if ( $ loadCurrency = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'bl_perfLoadCurrency' ) ) { $ this -> _blLoadCurrency = $ loadCurrency ; } } return $ this -> _blLoadCurrency ; }
Returns currency switching option
37,178
public function dontShowEmptyCategories ( ) { if ( $ this -> _blDontShowEmptyCats == null ) { $ this -> _blDontShowEmptyCats = false ; if ( $ dontShowEmptyCats = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blDontShowEmptyCategories' ) ) { $ this -> _blDontShowEmptyCats = $ dontShowEmptyCats ; } } return $ this -> _blDontShowEmptyCats ; }
Returns true if empty categories are not loaded
37,179
public function isLanguageLoaded ( ) { if ( $ this -> _blLoadLanguage == null ) { $ this -> _blLoadLanguage = false ; if ( $ loadLanguage = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'bl_perfLoadLanguages' ) ) { $ this -> _blLoadLanguage = $ loadLanguage ; } } return $ this -> _blLoadLanguage ; }
Returns if language should be loaded
37,180
public function getTopNavigationCatCnt ( ) { if ( $ this -> _iTopCatNavItmCnt == null ) { $ topCategoryNavigationItemsCount = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iTopNaviCatCount' ) ; $ this -> _iTopCatNavItmCnt = $ topCategoryNavigationItemsCount ? $ topCategoryNavigationItemsCount : 5 ; } return $ this -> _iTopCatNavItmCnt ; }
Returns item count in top navigation of categories
37,181
public function addRssFeed ( $ title , $ url , $ key = null ) { if ( ! is_array ( $ this -> _aRssLinks ) ) { $ this -> _aRssLinks = [ ] ; } $ url = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> prepareUrlForNoSession ( $ url ) ; if ( $ key === null ) { $ this -> _aRssLinks [ ] = [ 'title' => $ title , 'link' => $ url ] ; } else { $ this -> _aRssLinks [ $ key ] = [ 'title' => $ title , 'link' => $ url ] ; } }
addRssFeed adds link to rss
37,182
public function getSavedSorting ( $ sortIdent ) { $ sorting = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'aSorting' ) ; if ( isset ( $ sorting [ $ sortIdent ] ) ) { return $ sorting [ $ sortIdent ] ; } }
Returns sorting variable from session
37,183
public function getListOrderBy ( ) { $ columns = explode ( '.' , $ this -> _sListOrderBy ) ; if ( is_array ( $ columns ) && count ( $ columns ) > 1 ) { return $ columns [ 1 ] ; } return $ this -> _sListOrderBy ; }
Template variable getter . Returns string after the list is ordered by
37,184
public function getMetaKeywords ( ) { if ( $ this -> _sMetaKeywords === null ) { $ this -> _sMetaKeywords = false ; if ( ( $ keywords = $ this -> _getMetaFromSeo ( 'oxkeywords' ) ) ) { $ this -> _sMetaKeywords = $ keywords ; } elseif ( ( $ keywords = $ this -> _getMetaFromContent ( $ this -> _sMetaKeywordsIdent ) ) ) { $ this -> _sMetaKeywords = $ this -> _prepareMetaKeyword ( $ keywords , false ) ; } else { $ this -> _sMetaKeywords = $ this -> _prepareMetaKeyword ( false , true ) ; } } return $ this -> _sMetaKeywords ; }
Template variable getter . Returns meta keywords
37,185
public function getCompareItemCount ( ) { if ( $ this -> _iCompItemsCnt === null ) { $ items = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'aFiltcompproducts' ) ; $ this -> _iCompItemsCnt = is_array ( $ items ) ? count ( $ items ) : 0 ; } return $ this -> _iCompItemsCnt ; }
Template variable getter . Returns comparison article list count .
37,186
public function noIndex ( ) { if ( $ this -> _blForceNoIndex ) { $ this -> _iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW ; } elseif ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'cur' ) ) { $ this -> _iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW ; } elseif ( 0 < \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Core \ Request :: class ) -> getRequestParameter ( 'pgNr' ) ) { $ this -> _iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW ; } else { switch ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'fnc' ) ) { case 'tocomparelist' : case 'tobasket' : $ this -> _iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW ; break ; } } return $ this -> _iViewIndexState ; }
Marks that current view is marked as no index no follow and article details links must contain no follow tags
37,187
protected function _setNrOfArtPerPage ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ numberOfCategoryArticles = $ config -> getConfigParam ( 'iNrofCatArticles' ) ; $ numberOfCategoryArticles = ( $ numberOfCategoryArticles ) ? $ numberOfCategoryArticles : 10 ; switch ( $ this -> getListDisplayType ( ) ) { case 'grid' : $ numbersOfCategoryArticles = $ config -> getConfigParam ( 'aNrofCatArticlesInGrid' ) ; break ; case 'line' : case 'infogrid' : default : $ numbersOfCategoryArticles = $ config -> getConfigParam ( 'aNrofCatArticles' ) ; } if ( ! is_array ( $ numbersOfCategoryArticles ) || ! isset ( $ numbersOfCategoryArticles [ 0 ] ) ) { $ numbersOfCategoryArticles = [ $ numberOfCategoryArticles ] ; $ config -> setConfigParam ( 'aNrofCatArticles' , $ numbersOfCategoryArticles ) ; } else { $ numberOfCategoryArticles = $ numbersOfCategoryArticles [ 0 ] ; } $ viewConfig = $ this -> getViewConfig ( ) ; $ session = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) ; if ( ( $ articlesPerPage = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( '_artperpage' ) ) ) { $ numberOfCategoryArticles = ( in_array ( $ articlesPerPage , $ numbersOfCategoryArticles ) ) ? $ articlesPerPage : $ numberOfCategoryArticles ; $ viewConfig -> setViewConfigParam ( 'iartPerPage' , $ numberOfCategoryArticles ) ; $ session -> setVariable ( '_artperpage' , $ numberOfCategoryArticles ) ; } elseif ( ( $ sessArtPerPage = $ session -> getVariable ( '_artperpage' ) ) && is_numeric ( $ sessArtPerPage ) ) { $ numberOfCategoryArticles = ( in_array ( $ sessArtPerPage , $ numbersOfCategoryArticles ) ) ? $ sessArtPerPage : $ numberOfCategoryArticles ; $ viewConfig -> setViewConfigParam ( 'iartPerPage' , $ numberOfCategoryArticles ) ; $ session -> setVariable ( '_artperpage' , $ numberOfCategoryArticles ) ; } else { $ viewConfig -> setViewConfigParam ( 'iartPerPage' , $ numberOfCategoryArticles ) ; } $ config -> setConfigParam ( 'iNrofCatArticles' , $ numberOfCategoryArticles ) ; }
Sets number of articles per page to config value
37,188
protected function _prepareMetaDescription ( $ meta , $ length = 1024 , $ removeDuplicatedWords = false ) { if ( $ meta ) { $ stringModifier = getStr ( ) ; if ( $ length != - 1 ) { $ doubleLength = ( $ length * 2 ) ; $ meta = $ stringModifier -> substr ( $ meta , 0 , $ doubleLength ) ; } $ meta = $ stringModifier -> html_entity_decode ( $ meta ) ; $ meta = $ stringModifier -> strip_tags ( $ meta ) ; $ meta = $ stringModifier -> cleanStr ( $ meta ) ; if ( $ removeDuplicatedWords ) { $ meta = $ this -> _removeDuplicatedWords ( $ meta , \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aSkipTags' ) ) ; } $ meta = str_replace ( ' ,' , ',' , $ meta ) ; $ pattern = [ "/,[\s\+\-\*]*,/" , "/\s+,/" ] ; $ meta = $ stringModifier -> preg_replace ( $ pattern , ',' , $ meta ) ; $ meta = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsString ( ) -> minimizeTruncateString ( $ meta , $ length ) ; $ meta = $ stringModifier -> htmlspecialchars ( $ meta ) ; return trim ( $ meta ) ; } }
Returns current view meta description data
37,189
public function setItemSorting ( $ sortIdent , $ sortBy , $ sortDir = null ) { $ sorting = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'aSorting' ) ; $ sorting [ $ sortIdent ] [ 'sortby' ] = $ sortBy ; $ sorting [ $ sortIdent ] [ 'sortdir' ] = $ sortDir ? $ sortDir : null ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'aSorting' , $ sorting ) ; }
Sets sorting item config
37,190
public function getSorting ( $ sortIdent ) { $ sorting = null ; if ( $ sorting = $ this -> getUserSelectedSorting ( ) ) { $ this -> setItemSorting ( $ sortIdent , $ sorting [ 'sortby' ] , $ sorting [ 'sortdir' ] ) ; } elseif ( ! $ sorting = $ this -> getSavedSorting ( $ sortIdent ) ) { $ sorting = $ this -> getDefaultSorting ( ) ; } if ( $ sorting ) { $ this -> setListOrderBy ( $ sorting [ 'sortby' ] ) ; $ this -> setListOrderDirection ( $ sorting [ 'sortdir' ] ) ; } return $ sorting ; }
Returns sorting config for current item
37,191
public function getSortingSql ( $ ident ) { $ sorting = $ this -> getSorting ( $ ident ) ; if ( is_array ( $ sorting ) ) { $ sortBy = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteIdentifier ( $ sorting [ 'sortby' ] ) ; $ sortDir = isset ( $ sorting [ 'sortdir' ] ) ? $ sorting [ 'sortdir' ] : '' ; $ sortString = trim ( $ sortBy . ' ' . $ sortDir ) ; return $ sortString ; } }
Returns part of SQL query with sorting params
37,192
public function getPageTitle ( ) { $ titleParts = [ ] ; $ titleParts [ ] = $ this -> getTitlePrefix ( ) ; $ titleParts [ ] = $ this -> getTitle ( ) ; $ titleParts [ ] = $ this -> getTitleSuffix ( ) ; $ titleParts [ ] = $ this -> getTitlePageSuffix ( ) ; $ titleParts = array_filter ( $ titleParts ) ; return implode ( ' | ' , $ titleParts ) ; }
Returns full page title
37,193
public function getBaseLink ( $ languageId = null ) { if ( ! isset ( $ languageId ) ) { $ languageId = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; } $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) ) { if ( $ displayObj = $ this -> _getSubject ( $ languageId ) ) { $ url = $ displayObj -> getLink ( $ languageId ) ; } else { $ encoder = \ OxidEsales \ Eshop \ Core \ Registry :: getSeoEncoder ( ) ; $ constructedUrl = $ config -> getShopHomeUrl ( $ languageId ) . $ this -> _getSeoRequestParams ( ) ; $ url = $ encoder -> getStaticUrl ( $ constructedUrl , $ languageId ) ; } } if ( ! $ url ) { $ constructedUrl = $ config -> getShopCurrentURL ( $ languageId ) . $ this -> _getRequestParams ( ) ; $ url = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> processUrl ( $ constructedUrl , true , null , $ languageId ) ; } return $ url ; }
Get base link of current view
37,194
public function getLink ( $ languageId = null ) { return $ this -> _addPageNrParam ( $ this -> getBaseLink ( $ languageId ) , $ this -> getActPage ( ) , $ languageId ) ; }
Get link of current view . In url its include also page number if it is list page
37,195
protected function _getSeoRequestParams ( ) { $ class = $ this -> getClassName ( ) ; $ function = $ this -> getFncName ( ) ; $ forbiddenFunctions = [ 'tobasket' , 'login_noredirect' , 'addVoucher' ] ; if ( in_array ( $ function , $ forbiddenFunctions ) ) { $ function = '' ; } $ url = "cl={$class}" ; if ( $ function ) { $ url .= "&amp;fnc={$function}" ; } if ( $ value = basename ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'page' ) ) ) { $ url .= "&amp;page={$value}" ; } if ( $ value = basename ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'tpl' ) ) ) { $ url .= "&amp;tpl={$value}" ; } if ( $ value = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxloadid' ) ) { $ url .= "&amp;oxloadid={$value}" ; } $ pageNumber = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'pgNr' ) ; if ( $ pageNumber > 0 ) { $ url .= "&amp;pgNr={$pageNumber}" ; } return $ url ; }
collects _GET parameters used by eShop SEO and returns uri
37,196
public function getSortColumns ( ) { if ( $ this -> _aSortColumns === null ) { $ this -> setSortColumns ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aSortCols' ) ) ; } return $ this -> _aSortColumns ; }
Template variable getter . Returns sorting columns
37,197
public function getActiveRecommList ( ) { if ( $ this -> _oActiveRecommList === null ) { $ this -> _oActiveRecommList = false ; if ( $ recommendationListId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'recommid' ) ) { $ this -> _oActiveRecommList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ RecommendationList :: class ) ; $ this -> _oActiveRecommList -> load ( $ recommendationListId ) ; } } return $ this -> _oActiveRecommList ; }
Template variable getter . Returns active recommendation lists
37,198
public function generatePageNavigationUrl ( ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopHomeUrl ( ) . $ this -> _getRequestParams ( false ) ; }
Generates URL for page navigation
37,199
protected function _addPageNrParam ( $ url , $ page , $ languageId = null ) { if ( $ page ) { if ( ( strpos ( $ url , 'pgNr=' ) ) ) { $ url = preg_replace ( '/pgNr=[0-9]*/' , 'pgNr=' . $ page , $ url ) ; } else { $ url .= ( ( strpos ( $ url , '?' ) === false ) ? '?' : '&amp;' ) . 'pgNr=' . $ page ; } } else { $ url = preg_replace ( '/pgNr=[0-9]*/' , '' , $ url ) ; $ url = preg_replace ( '/\&amp\;\&amp\;/' , '&amp;' , $ url ) ; $ url = preg_replace ( '/\?\&amp\;/' , '?' , $ url ) ; $ url = preg_replace ( '/\&amp\;$/' , '' , $ url ) ; } return $ url ; }
Adds page number parameter to url and returns modified url if page number 0 drops from url