idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
37,200
public function generatePageNavigation ( $ positionCount = 0 ) { startProfile ( 'generatePageNavigation' ) ; $ pageNavigation = new StdClass ( ) ; $ pageNavigation -> NrOfPages = $ this -> _iCntPages ; $ activePage = $ this -> getActPage ( ) ; $ pageNavigation -> actPage = $ activePage + 1 ; $ url = $ this -> generatePageNavigationUrl ( ) ; if ( $ positionCount == 0 || ( $ positionCount >= $ pageNavigation -> NrOfPages ) ) { $ startNo = 2 ; $ finishNo = $ pageNavigation -> NrOfPages ; } else { $ tmpVal = $ positionCount - 3 ; $ tmpVal2 = floor ( ( $ positionCount - 4 ) / 2 ) ; if ( $ pageNavigation -> actPage <= $ tmpVal ) { $ startNo = 2 ; $ finishNo = $ tmpVal + 1 ; } elseif ( $ pageNavigation -> actPage >= $ pageNavigation -> NrOfPages - $ tmpVal + 1 ) { $ startNo = $ pageNavigation -> NrOfPages - $ tmpVal ; $ finishNo = $ pageNavigation -> NrOfPages - 1 ; } else { $ startNo = $ pageNavigation -> actPage - $ tmpVal2 ; $ finishNo = $ pageNavigation -> actPage + $ tmpVal2 ; } } if ( $ activePage > 0 ) { $ pageNavigation -> previousPage = $ this -> _addPageNrParam ( $ url , $ activePage - 1 ) ; } if ( $ activePage < $ pageNavigation -> NrOfPages - 1 ) { $ pageNavigation -> nextPage = $ this -> _addPageNrParam ( $ url , $ activePage + 1 ) ; } if ( $ pageNavigation -> NrOfPages > 1 ) { for ( $ i = 1 ; $ i < $ pageNavigation -> NrOfPages + 1 ; $ i ++ ) { if ( $ i == 1 || $ i == $ pageNavigation -> NrOfPages || ( $ i >= $ startNo && $ i <= $ finishNo ) ) { $ page = new stdClass ( ) ; $ page -> url = $ this -> _addPageNrParam ( $ url , $ i - 1 ) ; $ page -> selected = ( $ i == $ pageNavigation -> actPage ) ? 1 : 0 ; $ pageNavigation -> changePage [ $ i ] = $ page ; } } $ pageNavigation -> firstpage = $ this -> _addPageNrParam ( $ url , 0 ) ; $ pageNavigation -> lastpage = $ this -> _addPageNrParam ( $ url , $ pageNavigation -> NrOfPages - 1 ) ; } stopProfile ( 'generatePageNavigation' ) ; return $ pageNavigation ; }
Generates variables for page navigation
37,201
public function getActPage ( ) { if ( $ this -> _iActPage === null ) { $ this -> _iActPage = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'pgNr' ) ; $ this -> _iActPage = ( $ this -> _iActPage < 0 ) ? 0 : $ this -> _iActPage ; } return $ this -> _iActPage ; }
Active page getter
37,202
public function getActVendor ( ) { if ( $ this -> _oActVendor === null ) { $ this -> _oActVendor = false ; $ vendorId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'cnid' ) ; $ vendorId = $ vendorId ? str_replace ( 'v_' , '' , $ vendorId ) : $ vendorId ; $ vendor = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Vendor :: class ) ; if ( $ vendor -> load ( $ vendorId ) ) { $ this -> _oActVendor = $ vendor ; } } return $ this -> _oActVendor ; }
Returns active vendor set by categories component ; if vendor is not set by component - will create vendor object and will try to load by id passed by request
37,203
public function getActManufacturer ( ) { if ( $ this -> _oActManufacturer === null ) { $ this -> _oActManufacturer = false ; $ manufacturerId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'mnid' ) ; $ manufacturer = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Manufacturer :: class ) ; if ( $ manufacturer -> load ( $ manufacturerId ) ) { $ this -> _oActManufacturer = $ manufacturer ; } } return $ this -> _oActManufacturer ; }
Returns active Manufacturer set by categories component ; if Manufacturer is not set by component - will create Manufacturer object and will try to load by id passed by request
37,204
public function getActSearch ( ) { if ( $ this -> _oActSearch === null ) { $ this -> _oActSearch = new stdClass ( ) ; $ url = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopHomeUrl ( ) ; $ this -> _oActSearch -> link = "{$url}cl=search" ; } return $ this -> _oActSearch ; }
Returns fake object which is used to mount navigation info
37,205
public function getMinOrderPrice ( ) { if ( $ this -> _sMinOrderPrice === null && $ this -> isLowOrderPrice ( ) ) { $ minOrderPrice = \ OxidEsales \ Eshop \ Core \ Price :: getPriceInActCurrency ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iMinOrderPrice' ) ) ; $ this -> _sMinOrderPrice = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> formatCurrency ( $ minOrderPrice ) ; } return $ this -> _sMinOrderPrice ; }
Template variable getter . Returns formatted min order price value
37,206
protected function _canRedirect ( ) { foreach ( $ this -> _aBlockRedirectParams as $ param ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( $ param ) !== null ) { return false ; } } return true ; }
Checks if current request parameters does not block SEO redirection process
37,207
public function getVendorId ( ) { if ( $ this -> _sVendorId === null ) { $ this -> _sVendorId = false ; if ( ( $ vendor = $ this -> getActVendor ( ) ) ) { $ this -> _sVendorId = $ vendor -> getId ( ) ; } } return $ this -> _sVendorId ; }
Template variable getter . Returns vendor id
37,208
public function getManufacturerId ( ) { if ( $ this -> _sManufacturerId === null ) { $ this -> _sManufacturerId = false ; if ( ( $ manufacturer = $ this -> getActManufacturer ( ) ) ) { $ this -> _sManufacturerId = $ manufacturer -> getId ( ) ; } } return $ this -> _sManufacturerId ; }
Template variable getter . Returns Manufacturer id
37,209
public function getContentByIdent ( $ ident ) { if ( ! isset ( $ this -> _aContents [ $ ident ] ) ) { $ this -> _aContents [ $ ident ] = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Content :: class ) ; $ this -> _aContents [ $ ident ] -> loadByIdent ( $ ident ) ; } return $ this -> _aContents [ $ ident ] ; }
Loads and returns oxContent object requested by its ident
37,210
public function getMustFillFields ( ) { if ( $ this -> _aMustFillFields === null ) { $ this -> _aMustFillFields = false ; $ mustFillFields = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'aMustFillFields' ) ; if ( is_array ( $ mustFillFields ) ) { $ this -> _aMustFillFields = array_flip ( $ mustFillFields ) ; } } return $ this -> _aMustFillFields ; }
Returns array of fields which must be filled during registration
37,211
public function getFormId ( ) { if ( $ this -> _sFormId === null ) { $ this -> _sFormId = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) -> generateUId ( ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'sessionuformid' , $ this -> _sFormId ) ; } return $ this -> _sFormId ; }
Form id getter . This id used to prevent double review entry submit
37,212
public function canAcceptFormData ( ) { if ( $ this -> _blCanAcceptFormData === null ) { $ this -> _blCanAcceptFormData = false ; $ formId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "uformid" ) ; $ sessionFormId = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "sessionuformid" ) ; if ( $ formId && $ formId === $ sessionFormId ) { $ this -> _blCanAcceptFormData = true ; } $ this -> getFormId ( ) ; } return $ this -> _blCanAcceptFormData ; }
Checks if session form id matches with request form id
37,213
public function getPromoFinishedList ( ) { if ( isset ( $ this -> _oPromoFinishedList ) ) { return $ this -> _oPromoFinishedList ; } $ this -> _oPromoFinishedList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ActionList :: class ) ; $ this -> _oPromoFinishedList -> loadFinishedByCount ( 2 ) ; return $ this -> _oPromoFinishedList ; }
return last finished promotion list
37,214
public function getPromoCurrentList ( ) { if ( isset ( $ this -> _oPromoCurrentList ) ) { return $ this -> _oPromoCurrentList ; } $ this -> _oPromoCurrentList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ActionList :: class ) ; $ this -> _oPromoCurrentList -> loadCurrent ( ) ; return $ this -> _oPromoCurrentList ; }
return current promotion list
37,215
public function getPromoFutureList ( ) { if ( isset ( $ this -> _oPromoFutureList ) ) { return $ this -> _oPromoFutureList ; } $ this -> _oPromoFutureList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ActionList :: class ) ; $ this -> _oPromoFutureList -> loadFutureByCount ( 2 ) ; return $ this -> _oPromoFutureList ; }
return future promotion list
37,216
public function getShowPromotionList ( ) { if ( isset ( $ this -> _blShowPromotions ) ) { return $ this -> _blShowPromotions ; } $ this -> _blShowPromotions = false ; if ( oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ActionList :: class ) -> areAnyActivePromotions ( ) ) { $ this -> _blShowPromotions = ( count ( $ this -> getPromoFinishedList ( ) ) + count ( $ this -> getPromoCurrentList ( ) ) + count ( $ this -> getPromoFutureList ( ) ) ) > 0 ; } return $ this -> _blShowPromotions ; }
should promotions list be shown?
37,217
public function isEnabledPrivateSales ( ) { if ( $ this -> _blEnabledPrivateSales === null ) { $ this -> _blEnabledPrivateSales = ( bool ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blPsLoginEnabled' ) ; if ( $ this -> _blEnabledPrivateSales && ( $ canPreview = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> canPreview ( ) ) !== null ) { $ this -> _blEnabledPrivateSales = ! $ canPreview ; } } return $ this -> _blEnabledPrivateSales ; }
Checks if private sales is on
37,218
public function getInvoiceAddress ( ) { if ( $ this -> _aInvoiceAddress == null ) { $ invoiceAddress = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'invadr' ) ; if ( $ invoiceAddress ) { $ this -> _aInvoiceAddress = $ invoiceAddress ; } } return $ this -> _aInvoiceAddress ; }
Template variable getter . Returns user address
37,219
public function getDeliveryAddress ( ) { if ( $ this -> _aDeliveryAddress == null ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ config -> getRequestParameter ( 'reloadaddress' ) ) { $ this -> _aDeliveryAddress = $ config -> getRequestParameter ( 'deladr' ) ; } } return $ this -> _aDeliveryAddress ; }
Template variable getter . Returns user delivery address
37,220
public function getActiveUsername ( ) { if ( $ this -> _sActiveUsername == null ) { $ this -> _sActiveUsername = false ; $ username = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'lgn_usr' ) ; if ( $ username ) { $ this -> _sActiveUsername = $ username ; } elseif ( $ user = $ this -> getUser ( ) ) { $ this -> _sActiveUsername = $ user -> oxuser__oxusername -> value ; } } return $ this -> _sActiveUsername ; }
Template variable getter . Returns logged in user name
37,221
public function getWishlistName ( ) { if ( $ this -> getUser ( ) ) { $ wishId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'wishid' ) ; $ userId = ( $ wishId ) ? $ wishId : \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'wishid' ) ; if ( $ userId ) { $ wishUser = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ wishUser -> load ( $ userId ) ) { return $ wishUser ; } } } return false ; }
Template variable getter . Returns user name of searched wishlist
37,222
public function getCompareItemsCnt ( ) { $ compareController = oxNew ( \ OxidEsales \ Eshop \ Application \ Controller \ CompareController :: class ) ; return $ compareController -> getCompareItemsCnt ( ) ; }
Template variable getter . Returns article list count in comparison .
37,223
protected function _setParams ( $ blPerfLoadAktion = false ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oShop = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Shop :: class ) ; $ oShop -> load ( $ myConfig -> getShopId ( ) ) ; $ oView = oxNew ( \ OxidEsales \ Eshop \ Application \ Controller \ FrontendController :: class ) ; $ oShop = $ oView -> addGlobalParams ( $ oShop ) ; $ oView -> addTplParam ( 'myshop' , $ oShop ) ; $ oView -> addTplParam ( 'shop' , $ oShop ) ; $ oView -> addTplParam ( 'oViewConf' , $ oShop ) ; $ oView -> addTplParam ( 'oView' , $ oView ) ; $ oView -> addTplParam ( 'mycurrency' , $ myConfig -> getActShopCurrencyObject ( ) ) ; $ oView -> addTplParam ( 'myuser' , $ this -> _oUser ) ; $ this -> _assignProducts ( $ oView , $ blPerfLoadAktion ) ; $ aInput [ ] = [ $ this -> getId ( ) . 'html' , $ this -> oxnewsletter__oxtemplate -> value ] ; $ aInput [ ] = [ $ this -> getId ( ) . 'plain' , $ this -> oxnewsletter__oxplaintemplate -> value ] ; $ aRes = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> parseThroughSmarty ( $ aInput , null , $ oView , true ) ; $ this -> _sHtmlText = $ aRes [ 0 ] ; $ this -> _sPlainText = $ aRes [ 1 ] ; }
Assigns to Smarty oxuser object add newsletter products adds products which fit to the last order of this user generates HTML and plaintext format newsletters .
37,224
public function validateBasketAmount ( $ amount ) { $ amount = str_replace ( ',' , '.' , $ amount ) ; if ( ! is_numeric ( $ amount ) || $ amount < 0 ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ArticleInputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'ERROR_MESSAGE_INPUT_INVALIDAMOUNT' ) ) ; throw $ exception ; } if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blAllowUnevenAmounts' ) ) { $ amount = round ( ( string ) $ amount ) ; } return $ amount ; }
Validates basket amount .
37,225
public function checkPassword ( $ user , $ newPassword , $ confirmationPassword , $ shouldCheckPasswordLength = false ) { if ( $ shouldCheckPasswordLength && getStr ( ) -> strlen ( $ newPassword ) == 0 ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'ERROR_MESSAGE_INPUT_EMPTYPASS' ) ) ; return $ this -> addValidationError ( "oxuser__oxpassword" , $ exception ) ; } if ( $ shouldCheckPasswordLength && getStr ( ) -> strlen ( $ newPassword ) < $ this -> getPasswordLength ( ) ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'ERROR_MESSAGE_PASSWORD_TOO_SHORT' ) ) ; return $ this -> addValidationError ( "oxuser__oxpassword" , $ exception ) ; } if ( $ newPassword != $ confirmationPassword ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ UserException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'ERROR_MESSAGE_PASSWORD_DO_NOT_MATCH' ) ) ; return $ this -> addValidationError ( "oxuser__oxpassword" , $ exception ) ; } }
Checking if user password is fine . In case of error exception is thrown
37,226
public function checkRequiredFields ( $ user , $ billingAddress , $ deliveryAddress ) { $ requiredAddressFields = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ RequiredAddressFields :: class ) ; $ fieldsValidator = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ RequiredFieldsValidator :: class ) ; $ user = oxNew ( User :: class ) ; $ billingAddress = $ this -> _setFields ( $ user , $ billingAddress ) ; $ fieldsValidator -> setRequiredFields ( $ requiredAddressFields -> getBillingFields ( ) ) ; $ fieldsValidator -> validateFields ( $ billingAddress ) ; $ invalidFields = $ fieldsValidator -> getInvalidFields ( ) ; if ( ! empty ( $ deliveryAddress ) ) { $ deliveryAddress = $ this -> _setFields ( oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Address :: class ) , $ deliveryAddress ) ; $ fieldsValidator -> setRequiredFields ( $ requiredAddressFields -> getDeliveryFields ( ) ) ; $ fieldsValidator -> validateFields ( $ deliveryAddress ) ; $ invalidFields = array_merge ( $ invalidFields , $ fieldsValidator -> getInvalidFields ( ) ) ; } foreach ( $ invalidFields as $ sField ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'ERROR_MESSAGE_INPUT_NOTALLFIELDS' ) ) ; $ this -> addValidationError ( $ sField , $ exception ) ; } }
Checking if all required fields were filled . In case of error exception is thrown
37,227
private function _setFields ( $ object , $ fields ) { $ fields = is_array ( $ fields ) ? $ fields : [ ] ; foreach ( $ fields as $ sKey => $ sValue ) { $ object -> $ sKey = oxNew ( 'oxField' , $ sValue ) ; } return $ object ; }
Creates oxAddress object from given array .
37,228
public function checkVatId ( $ user , $ invAddress ) { if ( $ this -> _hasRequiredParametersForVatInCheck ( $ invAddress ) ) { $ country = $ this -> _getCountry ( $ invAddress [ 'oxuser__oxcountryid' ] ) ; if ( $ country && $ country -> isInEU ( ) ) { $ vatInValidator = $ this -> getCompanyVatInValidator ( $ country ) ; $ oVatIn = oxNew ( 'oxCompanyVatIn' , $ invAddress [ 'oxuser__oxustid' ] ) ; if ( ! $ vatInValidator -> validate ( $ oVatIn ) ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'VAT_MESSAGE_' . $ vatInValidator -> getError ( ) ) ) ; return $ this -> addValidationError ( "oxuser__oxustid" , $ exception ) ; } } } elseif ( $ invAddress [ 'oxuser__oxustid' ] && ! $ invAddress [ 'oxuser__oxcompany' ] ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ InputException :: class ) ; $ exception -> setMessage ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'VAT_MESSAGE_COMPANY_MISSING' ) ) ; return $ this -> addValidationError ( "oxuser__oxcompany" , $ exception ) ; } }
Checks if user passed VAT id is valid . Exception is thrown if id is not valid .
37,229
protected function _getCountry ( $ countryId ) { $ country = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Country :: class ) ; $ country -> load ( $ countryId ) ; return $ country ; }
Load and return Country object .
37,230
public function validatePaymentInputData ( $ paymentId , & $ dynamicValue ) { $ validationResult = true ; switch ( $ paymentId ) { case 'oxidcreditcard' : $ validationResult = false ; $ idAllCreditCardInformationSet = $ this -> _isAllBankInformationSet ( $ this -> _aRequiredCCFields , $ dynamicValue ) ; $ doesCreditCardTypeExist = in_array ( $ dynamicValue [ 'kktype' ] , $ this -> _aPossibleCCType ) ; if ( $ idAllCreditCardInformationSet && $ doesCreditCardTypeExist ) { $ cardValidator = oxNew ( \ OxidEsales \ Eshop \ Core \ CreditCardValidator :: class ) ; $ validationResult = $ cardValidator -> isValidCard ( $ dynamicValue [ 'kknumber' ] , $ dynamicValue [ 'kktype' ] , $ dynamicValue [ 'kkmonth' ] . substr ( $ dynamicValue [ 'kkyear' ] , 2 , 2 ) ) ; } break ; case "oxiddebitnote" : $ validationResult = false ; if ( $ this -> _isAllBankInformationSet ( $ this -> _aRequiredDCFields , $ dynamicValue ) ) { $ validationResult = $ this -> _validateDebitNote ( $ dynamicValue ) ; } break ; } return $ validationResult ; }
Validates payment input data for credit card and debit note .
37,231
protected function _validateDebitNote ( $ debitInformation ) { $ debitInformation = $ this -> _cleanDebitInformation ( $ debitInformation ) ; $ bankCode = $ debitInformation [ 'lsblz' ] ; $ accountNumber = $ debitInformation [ 'lsktonr' ] ; $ sepaValidator = oxNew ( SepaValidator :: class ) ; if ( $ sepaValidator -> isValidBIC ( $ bankCode ) ) { $ validateResult = true ; if ( ! $ sepaValidator -> isValidIBAN ( $ accountNumber ) ) { $ validateResult = self :: INVALID_ACCOUNT_NUMBER ; } } else { $ validateResult = self :: INVALID_BANK_CODE ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blSkipDebitOldBankInfo' ) ) { $ validateResult = $ this -> _validateOldDebitInfo ( $ debitInformation ) ; } } return $ validateResult ; }
Validates debit note .
37,232
protected function _validateOldDebitInfo ( $ debitInfo ) { $ stringHelper = getStr ( ) ; $ debitInfo = $ this -> _fixAccountNumber ( $ debitInfo ) ; $ validationResult = true ; if ( ! $ stringHelper -> preg_match ( "/^\d{5,8}$/" , $ debitInfo [ 'lsblz' ] ) ) { $ validationResult = self :: INVALID_BANK_CODE ; } if ( true === $ validationResult && ! $ stringHelper -> preg_match ( "/^\d{10,12}$/" , $ debitInfo [ 'lsktonr' ] ) ) { $ validationResult = self :: INVALID_ACCOUNT_NUMBER ; } return $ validationResult ; }
Validates old debit info .
37,233
protected function _fixAccountNumber ( $ debitInfo ) { $ oStr = getStr ( ) ; if ( $ oStr -> strlen ( $ debitInfo [ 'lsktonr' ] ) < 10 ) { $ sNewNum = str_repeat ( '0' , 10 - $ oStr -> strlen ( $ debitInfo [ 'lsktonr' ] ) ) . $ debitInfo [ 'lsktonr' ] ; $ debitInfo [ 'lsktonr' ] = $ sNewNum ; } return $ debitInfo ; }
If account number is shorter than 10 add zeros in front of number .
37,234
protected function _isAllBankInformationSet ( $ requiredFields , $ bankInformation ) { $ isSet = true ; foreach ( $ requiredFields as $ fieldName ) { if ( ! isset ( $ bankInformation [ $ fieldName ] ) || ! trim ( $ bankInformation [ $ fieldName ] ) ) { $ isSet = false ; break ; } } return $ isSet ; }
Checks if all bank information is set .
37,235
public function getCompanyVatInValidator ( $ country ) { if ( is_null ( $ this -> _oCompanyVatInValidator ) ) { $ vatInValidator = oxNew ( 'oxCompanyVatInValidator' , $ country ) ; $ validator = oxNew ( \ OxidEsales \ Eshop \ Core \ CompanyVatInCountryChecker :: class ) ; $ vatInValidator -> addChecker ( $ validator ) ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( "blVatIdCheckDisabled" ) ) { $ onlineValidator = oxNew ( \ OxidEsales \ Eshop \ Core \ OnlineVatIdCheck :: class ) ; $ vatInValidator -> addChecker ( $ onlineValidator ) ; } $ this -> setCompanyVatInValidator ( $ vatInValidator ) ; } return $ this -> _oCompanyVatInValidator ; }
Return VAT IN validator .
37,236
protected function _getShopUrlMap ( ) { if ( isset ( self :: $ urlMap ) ) { return self :: $ urlMap ; } $ aMap = $ this -> getVariablesCache ( ) -> getFromCache ( "urlMap" ) ; if ( ! is_null ( $ aMap ) ) { self :: $ urlMap = $ aMap ; return $ aMap ; } $ aMap = [ ] ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sConfKey = $ this -> _getConfKey ( ) ; $ sSelect = "SELECT oxshopid, oxvarname, DECODE( oxvarvalue , " . $ oDb -> quote ( $ sConfKey ) . " ) as oxvarvalue " . "FROM oxconfig WHERE oxvarname in ('aLanguageURLs','sMallShopURL','sMallSSLShopURL')" ; $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ oRs = $ masterDb -> select ( $ sSelect , false ) ; if ( $ oRs && $ oRs -> count ( ) > 0 ) { while ( ! $ oRs -> EOF ) { $ iShp = ( int ) $ oRs -> fields [ 0 ] ; $ sVar = $ oRs -> fields [ 1 ] ; $ sURL = $ oRs -> fields [ 2 ] ; if ( $ sVar == 'aLanguageURLs' ) { $ aUrls = unserialize ( $ sURL ) ; if ( is_array ( $ aUrls ) && count ( $ aUrls ) ) { $ aUrls = array_filter ( $ aUrls ) ; $ aUrls = array_fill_keys ( $ aUrls , $ iShp ) ; $ aMap = array_merge ( $ aMap , $ aUrls ) ; } } elseif ( $ sURL ) { $ aMap [ $ sURL ] = $ iShp ; } $ oRs -> fetchRow ( ) ; } } $ this -> getVariablesCache ( ) -> setToCache ( "urlMap" , $ aMap ) ; self :: $ urlMap = $ aMap ; return $ aMap ; }
Returns shop url to id map from config .
37,237
public function load ( $ sOxId ) { $ sSelect = 'select oxid, oxuserid, oxpaymentsid, DECODE( oxvalue, "' . $ this -> getPaymentKey ( ) . '" ) as oxvalue from oxuserpayments where oxid = ' . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sOxId ) ; return $ this -> assignRecord ( $ sSelect ) ; }
Loads user payment object
37,238
protected function _insert ( ) { if ( ! $ this -> getStoreCreditCardInfo ( ) && $ this -> oxuserpayments__oxpaymentsid -> value == 'oxidcreditcard' ) { return true ; } if ( $ sValue = $ this -> oxuserpayments__oxvalue -> value ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sEncodedValue = $ database -> getOne ( "select encode( " . $ database -> quote ( $ sValue ) . ", '" . $ this -> getPaymentKey ( ) . "' )" ) ; $ this -> oxuserpayments__oxvalue -> setValue ( $ sEncodedValue ) ; } $ blRet = parent :: _insert ( ) ; if ( $ sEncodedValue ) { $ this -> oxuserpayments__oxvalue -> setValue ( $ sValue ) ; } return $ blRet ; }
Inserts payment information to DB . Returns insert status .
37,239
protected function _update ( ) { if ( $ sValue = $ this -> oxuserpayments__oxvalue -> value ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sEncodedValue = $ database -> getOne ( "select encode( " . $ database -> quote ( $ sValue ) . ", '" . $ this -> getPaymentKey ( ) . "' )" ) ; $ this -> oxuserpayments__oxvalue -> setValue ( $ sEncodedValue ) ; } $ blRet = parent :: _update ( ) ; if ( $ sEncodedValue ) { $ this -> oxuserpayments__oxvalue -> setValue ( $ sValue ) ; } return $ blRet ; }
Updates payment record in DB . Returns update status .
37,240
public function getPaymentByPaymentType ( $ oUser = null , $ sPaymentType = null ) { $ blGet = false ; if ( $ oUser && $ sPaymentType != null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = 'select oxpaymentid from oxorder where oxpaymenttype=' . $ oDb -> quote ( $ sPaymentType ) . ' and oxuserid=' . $ oDb -> quote ( $ oUser -> getId ( ) ) . ' order by oxorderdate desc' ; if ( ( $ sOxId = $ oDb -> getOne ( $ sQ ) ) ) { $ blGet = $ this -> load ( $ sOxId ) ; } } return $ blGet ; }
Get user payment by payment id
37,241
public function getCurrentStep ( ) { if ( $ this -> _iCurrStep === null ) { if ( ( $ this -> _iCurrStep = $ this -> getInstance ( "Utilities" ) -> getRequestVar ( "istep" ) ) === null ) { $ this -> _iCurrStep = $ this -> getStep ( 'STEP_SYSTEMREQ' ) ; } $ this -> _iCurrStep = ( int ) $ this -> _iCurrStep ; } return $ this -> _iCurrStep ; }
Returns current setup step index
37,242
public function alreadySetUp ( ) { $ blSetUp = false ; $ sConfig = join ( "" , file ( getShopBasePath ( ) . "config.inc.php" ) ) ; if ( strpos ( $ sConfig , "<dbHost>" ) === false ) { $ blSetUp = true ; } return $ blSetUp ; }
Checks if config file is alleady filled with data
37,243
public function deleteSetupDirectory ( ) { $ blDeleteSetupDirectory = true ; $ sConfig = join ( "" , file ( getShopBasePath ( ) . "config.inc.php" ) ) ; if ( strpos ( $ sConfig , "this->blDelSetupDir = false;" ) !== false ) { $ blDeleteSetupDirectory = false ; } return $ blDeleteSetupDirectory ; }
Decides if leave or delete Setup directory dependent from configuration .
37,244
public function getStep ( $ sStepId ) { $ steps = $ this -> getSteps ( ) ; return isset ( $ steps [ $ sStepId ] ) ? $ steps [ $ sStepId ] : null ; }
Returns setup step index
37,245
public static function getStr ( ) { if ( ! isset ( self :: $ _oHandler ) ) { self :: $ _oHandler = oxNew ( \ OxidEsales \ Eshop \ Core \ Str :: class ) -> _getStrHandler ( ) ; } return self :: $ _oHandler ; }
Static method initializing new string handler or returning the existing one .
37,246
public function getItemDiscountProductTitle ( ) { $ sTitle = false ; $ sOxId = $ this -> getEditObjectId ( ) ; if ( isset ( $ sOxId ) && $ sOxId != "-1" ) { $ sViewName = getViewName ( "oxarticles" , $ this -> _iEditLang ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "select concat( $sViewName.oxartnum, ' ', $sViewName.oxtitle ) from oxdiscount left join $sViewName on $sViewName.oxid=oxdiscount.oxitmartid where oxdiscount.oxitmartid != '' and oxdiscount.oxid=" . $ database -> quote ( $ sOxId ) ; $ sTitle = $ database -> getOne ( $ sQ ) ; } return $ sTitle ? $ sTitle : " -- " ; }
Returns item discount product title
37,247
public function save ( ) { parent :: save ( ) ; $ sOxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ oDiscount = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Discount :: class ) ; if ( $ sOxId != "-1" ) { $ oDiscount -> load ( $ sOxId ) ; } else { $ aParams [ 'oxdiscount__oxid' ] = null ; } if ( ! isset ( $ aParams [ 'oxdiscount__oxactive' ] ) ) { $ aParams [ 'oxdiscount__oxactive' ] = 0 ; } if ( $ oDiscount -> isDerived ( ) ) { return ; } $ oDiscount -> setLanguage ( 0 ) ; $ oDiscount -> assign ( $ aParams ) ; $ oDiscount -> setLanguage ( $ this -> _iEditLang ) ; $ oDiscount = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> processFiles ( $ oDiscount ) ; try { $ oDiscount -> save ( ) ; } catch ( \ oxInputException $ exception ) { $ newException = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ExceptionToDisplay :: class ) ; $ newException -> setMessage ( $ exception -> getMessage ( ) ) ; $ this -> addTplParam ( 'discount_title' , $ aParams [ 'oxdiscount__oxtitle' ] ) ; if ( false !== strpos ( $ exception -> getMessage ( ) , 'DISCOUNT_ERROR_OXSORT' ) ) { $ messageArgument = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'DISCOUNT_MAIN_SORT' , \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getTplLanguage ( ) , true ) ; $ newException -> setMessageArgs ( $ messageArgument ) ; } \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ newException ) ; return ; } $ this -> setEditObjectId ( $ oDiscount -> getId ( ) ) ; }
Saves changed selected discount parameters .
37,248
public function saveinnlang ( ) { parent :: save ( ) ; $ sOxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "editval" ) ; $ oAttr = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Discount :: class ) ; if ( $ sOxId != "-1" ) { $ oAttr -> load ( $ sOxId ) ; } else { $ aParams [ 'oxdiscount__oxid' ] = null ; } if ( ! isset ( $ aParams [ 'oxdiscount__oxactive' ] ) ) { $ aParams [ 'oxdiscount__oxactive' ] = 0 ; } if ( $ oAttr -> isDerived ( ) ) { return ; } $ oAttr -> setLanguage ( 0 ) ; $ oAttr -> assign ( $ aParams ) ; $ oAttr -> setLanguage ( $ this -> _iEditLang ) ; $ oAttr = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> processFiles ( $ oAttr ) ; $ oAttr -> save ( ) ; $ this -> setEditObjectId ( $ oAttr -> getId ( ) ) ; }
Saves changed selected discount parameters in different language .
37,249
public function getManufacturerPageUrl ( $ manufacturer , $ pageNumber , $ languageId = null , $ isFixed = null ) { if ( ! isset ( $ languageId ) ) { $ languageId = $ manufacturer -> getLanguage ( ) ; } $ stdUrl = $ manufacturer -> getBaseStdLink ( $ languageId ) ; $ parameters = null ; $ stdUrl = $ this -> _trimUrl ( $ stdUrl , $ languageId ) ; $ seoUrl = $ this -> getManufacturerUri ( $ manufacturer , $ languageId ) ; if ( $ isFixed === null ) { $ isFixed = $ this -> _isFixed ( 'oxmanufacturer' , $ manufacturer -> getId ( ) , $ languageId ) ; } return $ this -> assembleFullPageUrl ( $ manufacturer , 'oxmanufacturer' , $ stdUrl , $ seoUrl , $ pageNumber , $ parameters , $ languageId , $ isFixed ) ; }
Returns Manufacturer SEO url for specified page
37,250
public function getManufacturerUrl ( $ oManufacturer , $ iLang = null ) { if ( ! isset ( $ iLang ) ) { $ iLang = $ oManufacturer -> getLanguage ( ) ; } return $ this -> _getFullUrl ( $ this -> getManufacturerUri ( $ oManufacturer , $ iLang ) , $ iLang ) ; }
Encodes manufacturer category URLs into SEO format
37,251
public function onDeleteManufacturer ( $ oManufacturer ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sIdQuoted = $ oDb -> quote ( $ oManufacturer -> getId ( ) ) ; $ oDb -> execute ( "delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxmanufacturer'" ) ; $ oDb -> execute ( "delete from oxobject2seodata where oxobjectid = $sIdQuoted" ) ; $ oDb -> execute ( "delete from oxseohistory where oxobjectid = $sIdQuoted" ) ; }
Deletes manufacturer seo entry
37,252
public function addSel ( ) { $ aAddSel = $ this -> _getActionIds ( 'oxselectlist.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sSLViewName = $ this -> _getViewName ( 'oxselectlist' ) ; $ aAddSel = $ this -> _getAll ( $ this -> _addFilter ( "select $sSLViewName.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aAddSel ) ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; foreach ( $ aAddSel as $ sAdd ) { $ oNew = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNew -> init ( "oxobject2selectlist" ) ; $ sObjectIdField = 'oxobject2selectlist__oxobjectid' ; $ sSelectetionIdField = 'oxobject2selectlist__oxselnid' ; $ sOxSortField = 'oxobject2selectlist__oxsort' ; $ oNew -> $ sObjectIdField = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oNew -> $ sSelectetionIdField = new \ OxidEsales \ Eshop \ Core \ Field ( $ sAdd ) ; $ sSql = "select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = {$database->quote($soxId)} " ; $ oNew -> $ sOxSortField = new \ OxidEsales \ Eshop \ Core \ Field ( ( int ) $ database -> getOne ( $ sSql ) ) ; $ oNew -> save ( ) ; } $ this -> onArticleSelectionListChange ( $ soxId ) ; } }
Adds selection lists to article .
37,253
public function import ( $ data ) { if ( isset ( $ data [ 'OXID' ] ) ) { $ this -> checkIdField ( $ data [ 'OXID' ] ) ; } return parent :: import ( $ data ) ; }
Imports article . Returns import status .
37,254
protected function postSaveObject ( $ shopObject , $ data ) { $ articleId = $ shopObject -> getId ( ) ; $ shopObject -> onChange ( null , $ articleId , $ articleId ) ; return $ articleId ; }
Post saving hook . can finish transactions if needed or ajust related data .
37,255
public function getMainProduct ( ) { if ( $ this -> _oMainSearchProduct === null && ( $ sArtNum = $ this -> getSearchProductArtNr ( ) ) ) { $ this -> _oMainSearchProduct = false ; $ sArtId = null ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ sTable = getViewName ( "oxarticles" ) ; $ sQ = "select oxid, oxparentid from $sTable where oxartnum = " . $ oDb -> quote ( $ sArtNum ) . " limit 1" ; $ rs = $ oDb -> select ( $ sQ ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { $ sArtId = $ rs -> fields [ 'OXPARENTID' ] ? $ rs -> fields [ 'OXPARENTID' ] : $ rs -> fields [ 'OXID' ] ; $ oProduct = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ oProduct -> load ( $ sArtId ) ) { $ this -> _oMainSearchProduct = $ oProduct ; } } } return $ this -> _oMainSearchProduct ; }
Returns product found by search . If product is variant - returns parent object
37,256
public function getProductList ( ) { if ( $ this -> _oSearchProductList === null ) { $ this -> _oSearchProductList = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ ListModel :: class ) ; if ( $ oMainSearchProduct = $ this -> getMainProduct ( ) ) { $ this -> _oSearchProductList -> offsetSet ( $ oMainSearchProduct -> getId ( ) , $ oMainSearchProduct ) ; foreach ( $ oMainSearchProduct -> getVariants ( ) as $ oVariant ) { $ this -> _oSearchProductList -> offsetSet ( $ oVariant -> getId ( ) , $ oVariant ) ; } } } return $ this -> _oSearchProductList ; }
Returns product list containing searchable product or its parent and its variants
37,257
public function addThisArticle ( ) { $ sOxid = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'aid' ) ; $ dAmount = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'am' ) ; $ oProduct = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; if ( $ sOxid && $ dAmount && $ oProduct -> load ( $ sOxid ) ) { $ sOrderId = $ this -> getEditObjectId ( ) ; $ oOrder = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Order :: class ) ; if ( $ sOrderId && $ oOrder -> load ( $ sOrderId ) ) { $ oOrderArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderArticle :: class ) ; $ oOrderArticle -> oxorderarticles__oxartid = new \ OxidEsales \ Eshop \ Core \ Field ( $ oProduct -> getId ( ) ) ; $ oOrderArticle -> oxorderarticles__oxartnum = new \ OxidEsales \ Eshop \ Core \ Field ( $ oProduct -> oxarticles__oxartnum -> value ) ; $ oOrderArticle -> oxorderarticles__oxamount = new \ OxidEsales \ Eshop \ Core \ Field ( $ dAmount ) ; $ oOrderArticle -> oxorderarticles__oxselvariant = new \ OxidEsales \ Eshop \ Core \ Field ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sel' ) ) ; $ oOrder -> recalculateOrder ( [ $ oOrderArticle ] ) ; } } }
Adds article to order list .
37,258
public function deleteThisArticle ( ) { $ sOrderArtId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sArtID' ) ; $ sOrderId = $ this -> getEditObjectId ( ) ; $ oOrderArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderArticle :: class ) ; $ oOrder = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Order :: class ) ; if ( $ oOrderArticle -> load ( $ sOrderArtId ) && $ oOrder -> load ( $ sOrderId ) ) { $ oOrderArticle -> delete ( ) ; $ oOrder -> recalculateOrder ( ) ; } }
Removes article from order list .
37,259
public function storno ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sOrderArtId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sArtID' ) ; $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderArticle :: class ) ; $ oArticle -> load ( $ sOrderArtId ) ; if ( $ oArticle -> oxorderarticles__oxstorno -> value == 1 ) { $ oArticle -> oxorderarticles__oxstorno -> setValue ( 0 ) ; $ sStockSign = - 1 ; } else { $ oArticle -> oxorderarticles__oxstorno -> setValue ( 1 ) ; $ sStockSign = 1 ; } if ( $ myConfig -> getConfigParam ( 'blUseStock' ) ) { $ oArticle -> updateArticleStock ( $ oArticle -> oxorderarticles__oxamount -> value * $ sStockSign , $ myConfig -> getConfigParam ( 'blAllowNegativeStock' ) ) ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "update oxorderarticles set oxstorno = " . $ oDb -> quote ( $ oArticle -> oxorderarticles__oxstorno -> value ) . " where oxid = " . $ oDb -> quote ( $ sOrderArtId ) ; $ oDb -> execute ( $ sQ ) ; $ sQ = "select oxartid from oxorderarticles where oxid = " . $ oDb -> quote ( $ sOrderArtId ) ; if ( ( $ sArtId = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sQ ) ) ) { $ oOrder = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Order :: class ) ; if ( $ oOrder -> load ( $ this -> getEditObjectId ( ) ) ) { $ oOrder -> recalculateOrder ( ) ; } } }
Cancels order item
37,260
public function updateOrder ( ) { $ aOrderArticles = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'aOrderArticles' ) ; $ oOrder = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Order :: class ) ; if ( is_array ( $ aOrderArticles ) && $ oOrder -> load ( $ this -> getEditObjectId ( ) ) ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oOrderArticles = $ oOrder -> getOrderArticles ( true ) ; $ blUseStock = $ myConfig -> getConfigParam ( 'blUseStock' ) ; foreach ( $ oOrderArticles as $ oOrderArticle ) { $ sItemId = $ oOrderArticle -> getId ( ) ; if ( isset ( $ aOrderArticles [ $ sItemId ] ) ) { if ( $ blUseStock ) { $ oOrderArticle -> setNewAmount ( $ aOrderArticles [ $ sItemId ] [ 'oxamount' ] ) ; } else { $ oOrderArticle -> assign ( $ aOrderArticles [ $ sItemId ] ) ; $ oOrderArticle -> save ( ) ; } } } $ oOrder -> recalculateOrder ( ) ; } }
Updates order articles stock and recalculates order
37,261
protected function countActivePriceAlerts ( ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ shopId = $ config -> getShopId ( ) ; $ activeAlarmsQuery = "SELECT oxprice, oxartid FROM oxpricealarm WHERE oxsended = '000-00-00 00:00:00' AND oxshopid = '$shopId'" ; $ result = $ database -> select ( $ activeAlarmsQuery ) ; $ count = 0 ; while ( $ result != false && ! $ result -> EOF ) { $ alarmPrice = $ result -> fields [ 'oxprice' ] ; $ article = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ article -> load ( $ result -> fields [ 'oxartid' ] ) ; if ( $ article -> getPrice ( ) -> getBruttoPrice ( ) <= $ alarmPrice ) { $ count ++ ; } $ result -> fetchRow ( ) ; } return $ count ; }
Counts active price alerts and returns this number .
37,262
protected function sendPriceChangeNotifications ( $ start , $ limit ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ shopId = $ config -> getShopId ( ) ; $ alarmsQuery = "SELECT oxid, oxemail, oxartid, oxprice FROM oxpricealarm WHERE oxsended = '000-00-00 00:00:00' AND oxshopid = '$shopId'" ; $ result = $ database -> selectLimit ( $ alarmsQuery , $ limit , $ start ) ; while ( $ result != false && ! $ result -> EOF ) { $ article = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ article -> load ( $ result -> fields [ 'oxartid' ] ) ; if ( $ article -> getPrice ( ) -> getBruttoPrice ( ) <= $ result -> fields [ 'oxprice' ] ) { $ this -> sendeMail ( $ result -> fields [ 'oxemail' ] , $ result -> fields [ 'oxartid' ] , $ result -> fields [ 'oxid' ] , $ result -> fields [ 'oxprice' ] ) ; } $ result -> fetchRow ( ) ; } }
Sends price alert notifications about changed article prices .
37,263
public function sendeMail ( $ emailAddress , $ productID , $ priceAlarmId , $ bidPrice ) { $ alarm = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ PriceAlarm :: class ) ; $ alarm -> load ( $ priceAlarmId ) ; $ language = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ languageId = ( int ) $ alarm -> oxpricealarm__oxlang -> value ; $ oldLanguageId = $ language -> getTplLanguage ( ) ; $ language -> setTplLanguage ( $ languageId ) ; $ email = oxNew ( \ OxidEsales \ Eshop \ Core \ Email :: class ) ; $ success = ( int ) $ email -> sendPricealarmToCustomer ( $ emailAddress , $ alarm ) ; $ language -> setTplLanguage ( $ oldLanguageId ) ; if ( $ success ) { $ alarm -> oxpricealarm__oxsended = new \ OxidEsales \ Eshop \ Core \ Field ( date ( "Y-m-d H:i:s" ) ) ; $ alarm -> save ( ) ; } }
Creates and sends email with price alarm information .
37,264
public function getFieldList ( $ dVat = null ) { if ( $ this -> _aFieldList == null && $ this -> oxselectlist__oxvaldesc -> value ) { $ this -> _aFieldList = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> assignValuesFromText ( $ this -> oxselectlist__oxvaldesc -> value , $ dVat ) ; foreach ( $ this -> _aFieldList as $ sKey => $ oField ) { $ this -> _aFieldList [ $ sKey ] -> name = getStr ( ) -> strip_tags ( $ this -> _aFieldList [ $ sKey ] -> name ) ; } } return $ this -> _aFieldList ; }
Returns select list value list .
37,265
public function getSelections ( ) { if ( $ this -> _aList === null && $ this -> oxselectlist__oxvaldesc -> value ) { $ this -> _aList = false ; $ aList = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> assignValuesFromText ( $ this -> oxselectlist__oxvaldesc -> getRawValue ( ) , $ this -> getVat ( ) ) ; foreach ( $ aList as $ sKey => $ oField ) { if ( $ oField -> name ) { $ this -> _aList [ $ sKey ] = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Selection :: class , getStr ( ) -> strip_tags ( $ oField -> name ) , $ sKey , false , $ this -> _aList === false ? true : false ) ; } } } return $ this -> _aList ; }
Returns array of oxSelection s
37,266
public function getActiveSelection ( ) { if ( $ this -> _oActiveSelection === null ) { if ( ( $ aSelections = $ this -> getSelections ( ) ) ) { $ this -> _oActiveSelection = reset ( $ aSelections ) ; } } return $ this -> _oActiveSelection ; }
Returns active selection object
37,267
public function setActiveSelectionByIndex ( $ iIdx ) { if ( ( $ aSelections = $ this -> getSelections ( ) ) ) { $ iSelIdx = 0 ; foreach ( $ aSelections as $ oSelection ) { $ oSelection -> setActiveState ( $ iSelIdx == $ iIdx ) ; if ( $ iSelIdx == $ iIdx ) { $ this -> _oActiveSelection = $ oSelection ; } $ iSelIdx ++ ; } } }
Activates given by index selection
37,268
public function getBruttoPrice ( ) { if ( $ this -> isNettoMode ( ) ) { return $ this -> getNettoPrice ( ) + $ this -> getVatValue ( ) ; } else { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> fRound ( $ this -> _dBrutto ) ; } }
Returns brutto price
37,269
public function getVatValue ( ) { if ( $ this -> isNettoMode ( ) ) { $ dVatValue = $ this -> getNettoPrice ( ) * $ this -> getVat ( ) / 100 ; } else { $ dVatValue = $ this -> getBruttoPrice ( ) * $ this -> getVat ( ) / ( 100 + $ this -> getVat ( ) ) ; } return \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> fRound ( $ dVatValue ) ; }
Returns absolute VAT value
37,270
public function subtractPercent ( $ dValue ) { $ dPrice = $ this -> getPrice ( ) ; $ this -> setPrice ( $ dPrice - self :: percent ( $ dPrice , $ dValue ) ) ; }
Subtracts given percent from price depending on price entering mode and recalculates price
37,271
public function addPrice ( \ OxidEsales \ Eshop \ Core \ Price $ oPrice ) { if ( $ this -> isNettoMode ( ) ) { $ this -> add ( $ oPrice -> getNettoPrice ( ) ) ; } else { $ this -> add ( $ oPrice -> getBruttoPrice ( ) ) ; } }
Adds another oxPrice object and recalculates current method .
37,272
public static function getPriceInActCurrency ( $ dPrice ) { $ oCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getActShopCurrencyObject ( ) ; return ( ( double ) $ dPrice ) * $ oCur -> rate ; }
Returns price multiplied by current currency
37,273
protected function addArticleToDiscount ( $ discountListId , $ articleId ) { $ object2Discount = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ object2Discount -> init ( 'oxobject2discount' ) ; $ object2Discount -> oxobject2discount__oxdiscountid = new \ OxidEsales \ Eshop \ Core \ Field ( $ discountListId ) ; $ object2Discount -> oxobject2discount__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ articleId ) ; $ object2Discount -> oxobject2discount__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxarticles" ) ; $ object2Discount -> save ( ) ; }
Adds article to discount list
37,274
public function delete ( $ sOXID = null ) { if ( ! $ sOXID ) { $ sOXID = $ this -> getId ( ) ; } if ( ! $ this -> canDeleteAttribute ( $ sOXID ) ) { return false ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sOxidQuoted = $ oDb -> quote ( $ sOXID ) ; $ sDelete = "delete from oxobject2attribute where oxattrid = " . $ sOxidQuoted ; $ oDb -> execute ( $ sDelete ) ; $ sDelete = "delete from oxcategory2attribute where oxattrid = " . $ sOxidQuoted ; $ oDb -> execute ( $ sDelete ) ; return parent :: delete ( $ sOXID ) ; }
Removes attributes from articles returns true on success .
37,275
public function assignVarToAttribute ( $ aMDVariants , $ aSelTitle ) { $ myLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ aConfLanguages = $ myLang -> getLanguageIds ( ) ; $ sAttrId = $ this -> _getAttrId ( $ aSelTitle [ 0 ] ) ; if ( ! $ sAttrId ) { $ sAttrId = $ this -> _createAttribute ( $ aSelTitle ) ; } foreach ( $ aMDVariants as $ sVarId => $ oValue ) { if ( strpos ( $ sVarId , "mdvar_" ) === 0 ) { foreach ( $ oValue as $ sId ) { $ sVarId = substr ( $ sVarId , 6 ) ; $ oNewAssign = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNewAssign -> init ( "oxobject2attribute" ) ; $ sNewId = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) -> generateUID ( ) ; if ( $ oNewAssign -> load ( $ sId ) ) { $ oNewAssign -> oxobject2attribute__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sVarId ) ; $ oNewAssign -> setId ( $ sNewId ) ; $ oNewAssign -> save ( ) ; } } } else { $ oNewAssign = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ MultiLanguageModel :: class ) ; $ oNewAssign -> setEnableMultilang ( false ) ; $ oNewAssign -> init ( "oxobject2attribute" ) ; $ oNewAssign -> oxobject2attribute__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sVarId ) ; $ oNewAssign -> oxobject2attribute__oxattrid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sAttrId ) ; foreach ( $ aConfLanguages as $ sKey => $ sLang ) { $ sPrefix = $ myLang -> getLanguageTag ( $ sKey ) ; $ oNewAssign -> { 'oxobject2attribute__oxvalue' . $ sPrefix } = new \ OxidEsales \ Eshop \ Core \ Field ( $ oValue [ $ sKey ] -> name ) ; } $ oNewAssign -> save ( ) ; } } }
Assigns attribute to variant
37,276
protected function _getAttrId ( $ sSelTitle ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDB ( ) ; $ sAttViewName = getViewName ( 'oxattribute' ) ; return $ oDb -> getOne ( "select oxid from $sAttViewName where LOWER(oxtitle) = " . $ oDb -> quote ( getStr ( ) -> strtolower ( $ sSelTitle ) ) ) ; }
Searches for attribute by oxtitle . If exists returns attribute id
37,277
protected function _createAttribute ( $ aSelTitle ) { $ myLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ aConfLanguages = $ myLang -> getLanguageIds ( ) ; $ oAttr = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ MultiLanguageModel :: class ) ; $ oAttr -> setEnableMultilang ( false ) ; $ oAttr -> init ( 'oxattribute' ) ; foreach ( $ aConfLanguages as $ sKey => $ sLang ) { $ sPrefix = $ myLang -> getLanguageTag ( $ sKey ) ; $ oAttr -> { 'oxattribute__oxtitle' . $ sPrefix } = new \ OxidEsales \ Eshop \ Core \ Field ( $ aSelTitle [ $ sKey ] ) ; } $ oAttr -> save ( ) ; return $ oAttr -> getId ( ) ; }
Checks if attribute exists
37,278
public function getAttributeAssigns ( $ sArtId ) { if ( $ sArtId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = "select o2a.oxid from oxobject2attribute as o2a " ; $ sSelect .= "where o2a.oxobjectid = " . $ oDb -> quote ( $ sArtId ) . " order by o2a.oxpos" ; $ aIds = [ ] ; $ rs = $ oDb -> select ( $ sSelect ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { while ( ! $ rs -> EOF ) { $ aIds [ ] = $ rs -> fields [ 0 ] ; $ rs -> fetchRow ( ) ; } } return $ aIds ; } }
Returns all oxobject2attribute Ids of article
37,279
public function subscribe ( ) { if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> checkSessionChallenge ( ) ) { return false ; } $ oUser = $ this -> getUser ( ) ; if ( ! $ oUser ) { return false ; } $ iStatus = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'status' ) ; if ( $ oUser -> setNewsSubscription ( $ iStatus , \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blOrderOptInEmail' ) ) ) { $ this -> _iSubscriptionStatus = ( $ iStatus == 0 && $ iStatus !== null ) ? - 1 : 1 ; } }
Removes or adds user to newsletter group according to current subscription status . Returns true on success .
37,280
protected function getUserId ( ) { $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ user -> loadAdminUser ( ) ) { return $ user -> getId ( ) ; } }
Get currently logged in admin user id
37,281
public function getAddUrlParams ( ) { if ( $ this -> _aAddUrlParams === null ) { $ this -> _aAddUrlParams = $ this -> getBaseAddUrlParams ( ) ; if ( ( $ iCur = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopCurrency ( ) ) ) { $ this -> _aAddUrlParams [ 'cur' ] = $ iCur ; } } return $ this -> _aAddUrlParams ; }
Returns parameters which should be appended to seo or std url .
37,282
public function prepareUrlForNoSession ( $ sUrl ) { $ oStr = getStr ( ) ; $ sUrl = $ oStr -> preg_replace ( '/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\._]+&?(amp;)?/i' , '\1' , $ sUrl ) ; $ sUrl = $ oStr -> preg_replace ( '/(&amp;|\?)$/' , '' , $ sUrl ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) ) { return $ sUrl ; } if ( $ qpos = $ oStr -> strpos ( $ sUrl , '?' ) ) { if ( $ qpos == $ oStr -> strlen ( $ sUrl ) - 1 ) { $ sSep = '' ; } else { $ sSep = '&amp;' ; } } else { $ sSep = '?' ; } if ( ! $ oStr -> preg_match ( '/[&?](amp;)?lang=[0-9]+/i' , $ sUrl ) ) { $ sUrl .= "{$sSep}lang=" . \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; $ sSep = '&amp;' ; } $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ oStr -> preg_match ( '/[&?](amp;)?cur=[0-9]+/i' , $ sUrl ) ) { $ iCur = ( int ) $ oConfig -> getShopCurrency ( ) ; if ( $ iCur ) { $ sUrl .= "{$sSep}cur=" . $ iCur ; } } return $ sUrl ; }
prepareUrlForNoSession adds extra url params making it usable without session also removes sid = xxxx& .
37,283
public function prepareCanonicalUrl ( $ sUrl ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oStr = getStr ( ) ; $ sUrl = $ oStr -> preg_replace ( '/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\._]+&?(amp;)?/i' , '\1' , $ sUrl ) ; $ sUrl = $ oStr -> preg_replace ( '/(&amp;|\?)$/' , '' , $ sUrl ) ; $ sSep = ( $ oStr -> strpos ( $ sUrl , '?' ) === false ) ? '?' : '&amp;' ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) ) { $ iLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; if ( ! $ oStr -> preg_match ( '/[&?](amp;)?lang=[0-9]+/i' , $ sUrl ) && $ iLang != $ oConfig -> getConfigParam ( 'sDefaultLang' ) ) { $ sUrl .= "{$sSep}lang=" . $ iLang ; } } return $ sUrl ; }
Prepares canonical url .
37,284
public function appendUrl ( $ sUrl , $ parametersToAdd , $ blFinalUrl = false , $ allowParameterOverwrite = false ) { $ paramSeparator = self :: PARAMETER_SEPARATOR ; $ finalParameters = $ this -> removeNotSetParameters ( $ parametersToAdd ) ; if ( is_array ( $ finalParameters ) && ! empty ( $ finalParameters ) ) { $ urlWithoutQuery = $ sUrl ; $ separatorPlace = strpos ( $ sUrl , '?' ) ; if ( $ separatorPlace !== false ) { $ urlWithoutQuery = substr ( $ sUrl , 0 , $ separatorPlace ) ; $ urlQueryEscaped = substr ( $ sUrl , $ separatorPlace + 1 ) ; $ urlQuery = str_replace ( $ paramSeparator , '&' , $ urlQueryEscaped ) ; $ finalParameters = $ this -> mergeDuplicatedParameters ( $ finalParameters , $ urlQuery , $ allowParameterOverwrite ) ; } $ sUrl = $ this -> appendParamSeparator ( $ urlWithoutQuery ) ; $ sUrl .= http_build_query ( $ finalParameters , null , $ paramSeparator ) ; } if ( $ sUrl && ! $ blFinalUrl ) { $ sUrl = $ this -> appendParamSeparator ( $ sUrl ) ; } return $ sUrl ; }
Appends url with given parameters .
37,285
public function cleanUrl ( $ sUrl , $ aParams = null ) { $ oStr = getStr ( ) ; if ( is_array ( $ aParams ) ) { foreach ( $ aParams as $ sParam ) { $ sUrl = $ oStr -> preg_replace ( '/(\?|&(amp;)?)' . preg_quote ( $ sParam ) . '=[a-z0-9\.]+&?(amp;)?/i' , '\1' , $ sUrl ) ; } } else { $ sUrl = $ oStr -> preg_replace ( '/(\?|&(amp;)?).+/i' , '\1' , $ sUrl ) ; } return trim ( $ sUrl , "?" ) ; }
Removes any or specified dynamic parameter from given url .
37,286
public function addShopHost ( $ sUrl ) { if ( ! preg_match ( "#^https?://#i" , $ sUrl ) ) { $ sShopUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getSslShopUrl ( ) ; $ sUrl = $ sShopUrl . $ sUrl ; } return $ sUrl ; }
Adds shop host if url does not start with it .
37,287
public function processUrl ( $ sUrl , $ blFinalUrl = true , $ aParams = null , $ iLang = null ) { $ sUrl = $ this -> appendUrl ( $ sUrl , $ aParams , $ blFinalUrl ) ; if ( $ this -> isCurrentShopHost ( $ sUrl ) ) { $ sUrl = $ this -> processShopUrl ( $ sUrl , $ blFinalUrl , $ iLang ) ; } return $ sUrl ; }
Performs base url processing - adds required parameters to given url .
37,288
public function processShopUrl ( $ sUrl , $ blFinalUrl = true , $ iLang = null ) { $ aAddParams = $ this -> getAddUrlParams ( ) ; $ sUrl = $ this -> appendUrl ( $ sUrl , $ aAddParams , $ blFinalUrl ) ; $ sUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> processUrl ( $ sUrl , $ iLang ) ; $ sUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> processUrl ( $ sUrl ) ; if ( $ blFinalUrl ) { $ sUrl = $ this -> rightTrimAmp ( $ sUrl ) ; } return $ sUrl ; }
Adds additional shop url parameters session id language id when needed .
37,289
public function getActiveShopHost ( ) { $ shopUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopUrl ( ) ; return $ this -> extractHost ( $ shopUrl ) ; }
Method returns active shop host .
37,290
public function getActiveShopUrlPath ( ) { $ shopUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopUrl ( ) ; return $ this -> extractUrlPath ( $ shopUrl ) ; }
Method returns shop URL part - path .
37,291
public function isCurrentShopHost ( $ sUrl ) { $ blCurrent = false ; $ sUrlHost = @ parse_url ( $ sUrl , PHP_URL_HOST ) ; if ( is_null ( $ sUrlHost ) ) { $ blCurrent = true ; } else { $ aHosts = $ this -> _getHosts ( ) ; foreach ( $ aHosts as $ sHost ) { if ( $ sHost === $ sUrlHost ) { $ blCurrent = true ; break ; } } } return $ blCurrent ; }
Compares current URL to supplied string .
37,292
private function parseUrlAndAppendSchema ( $ url , $ flag , $ appendScheme = 'http' ) { if ( ! filter_var ( $ url , FILTER_VALIDATE_URL ) ) { $ url = $ appendScheme . '://' . $ url ; } return parse_url ( $ url , $ flag ) ; }
Improved url parsing with parse_url as base and scheme checking improvement in url preprocessing
37,293
public function cleanUrlParams ( $ sUrl , $ sConnector = '&amp;' ) { $ aUrlParts = explode ( '?' , $ sUrl ) ; if ( ! is_array ( $ aUrlParts ) || count ( $ aUrlParts ) != 2 ) { return $ sUrl ; } $ sUrl = $ aUrlParts [ 0 ] ; $ sUrlParams = $ aUrlParts [ 1 ] ; $ oStrUtils = getStr ( ) ; $ sUrlParams = $ oStrUtils -> preg_replace ( [ '@(\&(amp;){1,})@ix' , '@\&{1,}@' , '@\?&@x' ] , [ '&' , '&' , '?' ] , $ sUrlParams ) ; parse_str ( $ sUrlParams , $ aUrlParams ) ; $ sUrl .= '?' . http_build_query ( $ aUrlParams , '' , $ sConnector ) ; $ sUrl = str_replace ( [ '%5B' , '%5D' ] , [ '[' , ']' ] , $ sUrl ) ; return $ sUrl ; }
Remove duplicate GET parameters and clean &amp ; and duplicate & .
37,294
public function getCurrentUrl ( ) { $ oUtilsServer = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) ; $ aServerParams [ "HTTPS" ] = $ oUtilsServer -> getServerVar ( "HTTPS" ) ; $ aServerParams [ "HTTP_X_FORWARDED_PROTO" ] = $ oUtilsServer -> getServerVar ( "HTTP_X_FORWARDED_PROTO" ) ; $ aServerParams [ "HTTP_HOST" ] = $ oUtilsServer -> getServerVar ( "HTTP_HOST" ) ; $ aServerParams [ "REQUEST_URI" ] = $ oUtilsServer -> getServerVar ( "REQUEST_URI" ) ; $ sProtocol = "http://" ; if ( isset ( $ aServerParams [ 'HTTPS' ] ) && ( ( $ aServerParams [ 'HTTPS' ] == 'on' || $ aServerParams [ 'HTTPS' ] == 1 ) ) || ( isset ( $ aServerParams [ 'HTTP_X_FORWARDED_PROTO' ] ) && $ aServerParams [ 'HTTP_X_FORWARDED_PROTO' ] == 'https' ) ) { $ sProtocol = 'https://' ; } return $ sProtocol . $ aServerParams [ 'HTTP_HOST' ] . $ aServerParams [ 'REQUEST_URI' ] ; }
Return current url .
37,295
public function stringToParamsArray ( $ sValue ) { $ sValue = str_replace ( "&amp;" , "&" , $ sValue ) ; $ aNavParams = explode ( "&" , $ sValue ) ; $ aNavParams = array_filter ( $ aNavParams ) ; $ aParams = [ ] ; foreach ( $ aNavParams as $ sValue ) { $ exp = explode ( "=" , $ sValue ) ; $ aParams [ $ exp [ 0 ] ] = $ exp [ 1 ] ; } return $ aParams ; }
Forms parameters array out of a string . Takes & and &amp ; as delimiters . Returns associative array with parameters .
37,296
protected function _getHosts ( ) { if ( $ this -> _aHosts === null ) { $ this -> _aHosts = [ ] ; $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ this -> _addMallHosts ( $ this -> _aHosts ) ; $ this -> _addLanguageHost ( $ oConfig -> getConfigParam ( 'aLanguageURLs' ) , $ this -> _aHosts ) ; $ this -> _addLanguageHost ( $ oConfig -> getConfigParam ( 'aLanguageSSLURLs' ) , $ this -> _aHosts ) ; $ this -> _addHost ( $ oConfig -> getConfigParam ( "sShopURL" ) , $ this -> _aHosts ) ; $ this -> _addHost ( $ oConfig -> getConfigParam ( "sSSLShopURL" ) , $ this -> _aHosts ) ; if ( $ this -> isAdmin ( ) ) { $ this -> _addHost ( $ oConfig -> getConfigParam ( "sAdminSSLURL" ) , $ this -> _aHosts ) ; } } return $ this -> _aHosts ; }
Collects and returns current shop hosts array .
37,297
private function removeNotSetParameters ( $ parametersToAdd ) { if ( is_array ( $ parametersToAdd ) && ! empty ( $ parametersToAdd ) ) { foreach ( $ parametersToAdd as $ key => $ value ) { if ( is_null ( $ value ) ) { unset ( $ parametersToAdd [ $ key ] ) ; } } } return $ parametersToAdd ; }
Removes parameters which are not set .
37,298
public function getShopDetails ( ) { $ aShopDetails = [ 'Date' => date ( \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( 'fullDateFormat' ) , time ( ) ) , 'URL' => $ this -> getShopLink ( ) , 'Edition' => $ this -> getEdition ( ) , 'Version' => $ this -> getVersion ( ) , 'Subshops (Total)' => $ this -> _countRows ( 'oxshops' , true ) , 'Subshops (Active)' => $ this -> _countRows ( 'oxshops' , false ) , 'Categories (Total)' => $ this -> _countRows ( 'oxcategories' , true ) , 'Categories (Active)' => $ this -> _countRows ( 'oxcategories' , false ) , 'Articles (Total)' => $ this -> _countRows ( 'oxarticles' , true ) , 'Articles (Active)' => $ this -> _countRows ( 'oxarticles' , false ) , 'Users (Total)' => $ this -> _countRows ( 'oxuser' , true ) , ] ; return $ aShopDetails ; }
Collects information on the shop like amount of categories articles users
37,299
protected function _countRows ( $ sTable , $ blMode ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sRequest = 'SELECT COUNT(*) FROM ' . $ sTable ; if ( $ blMode == false ) { $ sRequest .= ' WHERE oxactive = 1' ; } $ aRes = $ oDb -> select ( $ sRequest ) -> fields [ 0 ] ; return $ aRes ; }
counts result Rows