idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
36,800 | private function mapRatings ( $ ratingsData ) { $ ratings = new ArrayCollection ( ) ; foreach ( $ ratingsData as $ ratingData ) { $ rating = new Rating ( ) ; $ ratings -> add ( $ this -> mapper -> map ( $ rating , $ ratingData ) ) ; } return $ ratings ; } | Maps rating data from database to Ratings Collection . |
36,801 | public function _unserializeConfVar ( $ sType , $ sName , $ sValue ) { $ oStr = getStr ( ) ; $ mData = null ; switch ( $ sType ) { case "bool" : $ mData = ( $ sValue == "true" || $ sValue == "1" ) ; break ; case "str" : case "select" : case "num" : case "int" : $ mData = $ oStr -> htmlentities ( $ sValue ) ; if ( in_array ( $ sName , $ this -> _aParseFloat ) ) { $ mData = str_replace ( ',' , '.' , $ mData ) ; } break ; case "arr" : if ( in_array ( $ sName , $ this -> _aSkipMultiline ) ) { $ mData = unserialize ( $ sValue ) ; } else { $ mData = $ oStr -> htmlentities ( $ this -> _arrayToMultiline ( unserialize ( $ sValue ) ) ) ; } break ; case "aarr" : if ( in_array ( $ sName , $ this -> _aSkipMultiline ) ) { $ mData = unserialize ( $ sValue ) ; } else { $ mData = $ oStr -> htmlentities ( $ this -> _aarrayToMultiline ( unserialize ( $ sValue ) ) ) ; } break ; } return $ mData ; } | Unserialize config var depending on it s type |
36,802 | protected function _multilineToArray ( $ sMultiline ) { $ aArr = explode ( "\n" , $ sMultiline ) ; if ( is_array ( $ aArr ) ) { foreach ( $ aArr as $ sKey => $ sVal ) { $ aArr [ $ sKey ] = trim ( $ sVal ) ; if ( $ aArr [ $ sKey ] == "" ) { unset ( $ aArr [ $ sKey ] ) ; } } return $ aArr ; } } | Converts Multiline text to simple array . Returns this array . |
36,803 | protected function _aarrayToMultiline ( $ aInput ) { if ( is_array ( $ aInput ) ) { $ sMultiline = '' ; foreach ( $ aInput as $ sKey => $ sVal ) { if ( $ sMultiline ) { $ sMultiline .= "\n" ; } $ sMultiline .= $ sKey . " => " . $ sVal ; } return $ sMultiline ; } } | Converts associative array to multiline text . Returns this text . |
36,804 | protected function _multilineToAarray ( $ sMultiline ) { $ oStr = getStr ( ) ; $ aArr = [ ] ; $ aLines = explode ( "\n" , $ sMultiline ) ; foreach ( $ aLines as $ sLine ) { $ sLine = trim ( $ sLine ) ; if ( $ sLine != "" && $ oStr -> preg_match ( "/(.+)=>(.+)/" , $ sLine , $ aRegs ) ) { $ sKey = trim ( $ aRegs [ 1 ] ) ; $ sVal = trim ( $ aRegs [ 2 ] ) ; if ( $ sKey != "" && $ sVal != "" ) { $ aArr [ $ sKey ] = $ sVal ; } } } return $ aArr ; } | Converts Multiline text to associative array . Returns this array . |
36,805 | public function getDirectoryPath ( ) { $ editionsPath = VENDOR_PATH . static :: EDITIONS_DIRECTORY ; $ path = getShopBasePath ( ) ; if ( $ this -> getEditionSelector ( ) -> isEnterprise ( ) ) { $ path = $ editionsPath . '/' . static :: ENTERPRISE_DIRECTORY ; } elseif ( $ this -> getEditionSelector ( ) -> isProfessional ( ) ) { $ path = $ editionsPath . '/' . static :: PROFESSIONAL_DIRECTORY ; } return realpath ( $ path ) . DIRECTORY_SEPARATOR ; } | Returns path to edition directory . If no additional editions are found returns base path . |
36,806 | public function removeDiscUser ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aRemoveGroups = $ this -> _getActionIds ( 'oxobject2discount.oxid' ) ; if ( $ oConfig -> getRequestParameter ( 'all' ) ) { $ sQ = $ this -> _addFilter ( "delete oxobject2discount.* " . $ this -> _getQuery ( ) ) ; \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> Execute ( $ sQ ) ; } elseif ( $ aRemoveGroups && is_array ( $ aRemoveGroups ) ) { $ sQ = "delete from oxobject2discount where oxobject2discount.oxid in (" . implode ( ", " , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aRemoveGroups ) ) . ") " ; \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> Execute ( $ sQ ) ; } } | Removes user from discount config |
36,807 | public function addDiscUser ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aChosenUsr = $ this -> _getActionIds ( 'oxuser.oxid' ) ; $ soxId = $ oConfig -> getRequestParameter ( 'synchoxid' ) ; if ( $ oConfig -> getRequestParameter ( 'all' ) ) { $ sUserTable = $ this -> _getViewName ( 'oxuser' ) ; $ aChosenUsr = $ this -> _getAll ( $ this -> _addFilter ( "select $sUserTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aChosenUsr ) ) { foreach ( $ aChosenUsr as $ sChosenUsr ) { $ oObject2Discount = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oObject2Discount -> init ( 'oxobject2discount' ) ; $ oObject2Discount -> oxobject2discount__oxdiscountid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oObject2Discount -> oxobject2discount__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenUsr ) ; $ oObject2Discount -> oxobject2discount__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxuser" ) ; $ oObject2Discount -> save ( ) ; } } } | Adds user to discount config |
36,808 | public function offsetSet ( $ offset , $ oBase ) { if ( isset ( $ offset ) ) { $ this -> _aArray [ $ offset ] = & $ oBase ; } else { $ sLongFieldName = $ this -> _getFieldLongName ( 'oxid' ) ; if ( isset ( $ oBase -> $ sLongFieldName -> value ) ) { $ sOxid = $ oBase -> $ sLongFieldName -> value ; $ this -> _aArray [ $ sOxid ] = & $ oBase ; } else { $ this -> _aArray [ ] = & $ oBase ; } } } | offsetSet for SPL |
36,809 | public function offsetUnset ( $ offset ) { if ( strcmp ( $ offset , $ this -> key ( ) ) === 0 ) { $ this -> _blRemovedActive = true ; } unset ( $ this -> _aArray [ $ offset ] ) ; } | offsetUnset for SPL |
36,810 | public function rewind ( ) { $ this -> _blRemovedActive = false ; $ this -> _blValid = ( false !== reset ( $ this -> _aArray ) ) ; } | rewind for SPL |
36,811 | public function next ( ) { if ( $ this -> _blRemovedActive === true && current ( $ this -> _aArray ) ) { $ oVar = $ this -> prev ( ) ; } else { $ oVar = next ( $ this -> _aArray ) ; } $ this -> _blValid = ( false !== $ oVar ) ; } | next for SPL |
36,812 | public function init ( $ sObjectName , $ sCoreTable = null ) { $ this -> _sObjectsInListName = $ sObjectName ; if ( $ sCoreTable ) { $ this -> _sCoreTable = $ sCoreTable ; } } | Inits list table name and object name . |
36,813 | public function getBaseObject ( ) { if ( ! $ this -> _oBaseObject ) { $ this -> _oBaseObject = oxNew ( $ this -> _sObjectsInListName ) ; $ this -> _oBaseObject -> setInList ( ) ; $ this -> _oBaseObject -> init ( $ this -> _sCoreTable ) ; } return $ this -> _oBaseObject ; } | Initializes or returns existing list template object . |
36,814 | public function selectString ( $ sql , array $ parameters = [ ] ) { $ this -> clear ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; if ( $ this -> _aSqlLimit [ 0 ] || $ this -> _aSqlLimit [ 1 ] ) { $ rs = $ oDb -> selectLimit ( $ sql , $ this -> _aSqlLimit [ 1 ] , max ( 0 , $ this -> _aSqlLimit [ 0 ] ) , $ parameters ) ; } else { $ rs = $ oDb -> select ( $ sql , $ parameters ) ; } if ( $ rs != false && $ rs -> count ( ) > 0 ) { $ oSaved = clone $ this -> getBaseObject ( ) ; while ( ! $ rs -> EOF ) { $ oListObject = clone $ oSaved ; $ this -> _assignElement ( $ oListObject , $ rs -> fields ) ; $ this -> add ( $ oListObject ) ; $ rs -> fetchRow ( ) ; } } } | Convert results of the given select statement into objects and store them in _aArray . |
36,815 | public function add ( $ oObject ) { if ( $ oObject -> getId ( ) ) { $ this -> _aArray [ $ oObject -> getId ( ) ] = $ oObject ; } else { $ this -> _aArray [ ] = $ oObject ; } } | Add an entry to object array . |
36,816 | public function assignArray ( $ aData ) { $ this -> clear ( ) ; if ( count ( $ aData ) ) { $ oSaved = clone $ this -> getBaseObject ( ) ; foreach ( $ aData as $ aItem ) { $ oListObject = clone $ oSaved ; $ this -> _assignElement ( $ oListObject , $ aItem ) ; if ( $ oListObject -> getId ( ) ) { $ this -> _aArray [ $ oListObject -> getId ( ) ] = $ oListObject ; } else { $ this -> _aArray [ ] = $ oListObject ; } } } } | Assign data from array to list |
36,817 | public function containsFieldValue ( $ oVal , $ sFieldName ) { $ sFieldName = $ this -> _getFieldLongName ( $ sFieldName ) ; foreach ( $ this -> _aArray as $ obj ) { if ( $ obj -> { $ sFieldName } -> value == $ oVal ) { return true ; } } return false ; } | Function checks if there is at least one object in the list which has the given value in the given field |
36,818 | public function getList ( ) { $ oListObject = $ this -> getBaseObject ( ) ; $ sFieldList = $ oListObject -> getSelectFields ( ) ; $ sQ = "select $sFieldList from " . $ oListObject -> getViewName ( ) ; if ( $ sActiveSnippet = $ oListObject -> getSqlActiveSnippet ( ) ) { $ sQ .= " where $sActiveSnippet " ; } $ this -> selectString ( $ sQ ) ; return $ this ; } | Generic function for loading the list |
36,819 | public function getLanguage ( ) { $ oSession = $ this -> getInstance ( "Session" ) ; $ oUtils = $ this -> getInstance ( "Utilities" ) ; $ iLanguage = $ oUtils -> getRequestVar ( "setup_lang" , "post" ) ; if ( isset ( $ iLanguage ) ) { $ oSession -> setSessionParam ( 'setup_lang' , $ iLanguage ) ; $ iLanguageSubmit = $ oUtils -> getRequestVar ( "setup_lang_submit" , "post" ) ; if ( isset ( $ iLanguageSubmit ) ) { $ _GET [ 'istep' ] = $ _POST [ 'istep' ] = $ this -> getInstance ( "Setup" ) -> getStep ( 'STEP_WELCOME' ) ; } } elseif ( $ oSession -> getSessionParam ( 'setup_lang' ) === null ) { $ aLangs = [ 'en' , 'de' ] ; $ sBrowserLang = strtolower ( substr ( $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] , 0 , 2 ) ) ; $ sBrowserLang = ( in_array ( $ sBrowserLang , $ aLangs ) ) ? $ sBrowserLang : $ aLangs [ 0 ] ; $ oSession -> setSessionParam ( 'setup_lang' , $ sBrowserLang ) ; } return $ oSession -> getSessionParam ( 'setup_lang' ) ; } | Returns setup interface language id |
36,820 | public function getText ( $ sTextIdent ) { if ( $ this -> _aLangData === null ) { $ this -> _aLangData = [ ] ; $ sLangFilePath = getShopBasePath ( ) . EditionPathProvider :: SETUP_DIRECTORY . '/' . ucfirst ( $ this -> getLanguage ( ) ) . '/lang.php' ; if ( file_exists ( $ sLangFilePath ) && is_readable ( $ sLangFilePath ) ) { $ aLang = [ ] ; include $ sLangFilePath ; $ this -> _aLangData = array_merge ( $ aLang , $ this -> getAdditionalMessages ( ) ) ; } } return isset ( $ this -> _aLangData [ $ sTextIdent ] ) ? $ this -> _aLangData [ $ sTextIdent ] : null ; } | Translates passed index |
36,821 | public function init ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; $ user -> loadAdminUser ( ) ; if ( ( $ user -> oxuser__oxrights -> value == 'malladmin' || $ user -> oxuser__oxrights -> value == $ config -> getShopId ( ) ) ) { $ this -> isInitialized = true ; $ this -> userId = $ user -> getId ( ) ; } else { throw new Exception ( self :: ERROR_USER_NO_RIGHTS ) ; } return $ this -> isInitialized ; } | Init parameters needed for import . Creates Objects checks Rights etc . |
36,822 | public function getImportObject ( $ type ) { $ this -> importType = $ type ; $ result = null ; try { $ importType = $ this -> getImportType ( ) ; $ result = $ this -> createImportObject ( $ importType ) ; } catch ( Exception $ e ) { } return $ result ; } | Get import object according import type . |
36,823 | public function importFile ( $ importFilePath = null ) { $ this -> returnMessage = '' ; $ this -> importFilePath = $ importFilePath ; try { $ this -> init ( ) ; } catch ( Exception $ ex ) { return $ this -> returnMessage = 'ERPGENIMPORT_ERROR_USER_NO_RIGHTS' ; } $ file = @ fopen ( $ this -> importFilePath , 'r' ) ; if ( isset ( $ file ) && $ file ) { $ data = [ ] ; while ( ( $ row = fgetcsv ( $ file , $ this -> maxLineLength , $ this -> getCsvFieldsTerminator ( ) , $ this -> getCsvFieldsEncolser ( ) ) ) !== false ) { $ data [ ] = $ this -> csvTextConvert ( $ row , false ) ; } if ( $ this -> csvContainsHeader ) { array_shift ( $ data ) ; } try { $ this -> importData ( $ data ) ; } catch ( Exception $ ex ) { echo $ ex -> getMessage ( ) ; $ this -> returnMessage = 'ERPGENIMPORT_ERROR_DURING_IMPORT' ; } } else { $ this -> returnMessage = 'ERPGENIMPORT_ERROR_WRONG_FILE' ; } @ fclose ( $ file ) ; return $ this -> returnMessage ; } | Main import method whole import of all types via a given csv file is done here . |
36,824 | public function importData ( $ data ) { foreach ( $ data as $ key => $ row ) { if ( $ row ) { try { $ success = $ this -> importOne ( $ row ) ; $ errorMessage = '' ; } catch ( Exception $ e ) { $ success = false ; $ errorMessage = $ e -> getMessage ( ) ; } $ this -> statistics [ $ key ] = [ 'r' => $ success , 'm' => $ errorMessage ] ; } } $ this -> afterImport ( $ data ) ; } | Performs import action . |
36,825 | public function getImportObjectsList ( ) { $ importObjects = [ ] ; foreach ( $ this -> objects as $ sKey => $ importType ) { $ type = $ this -> createImportObject ( $ importType ) ; $ importObjects [ $ sKey ] = $ type -> getBaseTableName ( ) ; } return $ importObjects ; } | Returns allowed for import objects list . |
36,826 | protected function afterImport ( $ data ) { $ statistics = $ this -> getStatistics ( ) ; $ dataForRetry = [ ] ; foreach ( $ statistics as $ key => $ value ) { if ( $ value [ 'r' ] == false ) { $ this -> returnMessage .= "File[" . $ this -> importFilePath . "] - dataset number: $key - Error: " . $ value [ 'm' ] . " ---<br> " . PHP_EOL ; $ dataForRetry [ $ key ] = $ data [ $ key ] ; } } if ( ! empty ( $ dataForRetry ) && ( ! $ this -> retried || count ( $ dataForRetry ) != count ( $ data ) ) ) { $ this -> retried = true ; $ this -> returnMessage = '' ; $ this -> importData ( $ dataForRetry ) ; } } | Performs after import actions . If any error occurred during import tries to run import again and marks retried as true . If after running import second time all of the records failed stops . |
36,827 | protected function getImportType ( ) { $ type = $ this -> importType ; if ( strlen ( $ type ) != 1 || ! array_key_exists ( $ type , $ this -> objects ) ) { throw new Exception ( 'Error unknown command: ' . $ type ) ; } else { return $ this -> objects [ $ type ] ; } } | Gets import object type according type prefix . |
36,828 | protected function mapFields ( $ data ) { $ result = [ ] ; $ index = 0 ; foreach ( $ this -> csvFileFieldsOrder as $ value ) { if ( ! empty ( $ value ) ) { if ( strtolower ( $ data [ $ index ] ) == 'null' ) { $ result [ $ value ] = null ; } else { $ result [ $ value ] = $ data [ $ index ] ; } } $ index ++ ; } return $ result ; } | Maps numeric array to assoc . Array |
36,829 | protected function csvTextConvert ( $ text , $ mode ) { $ search = [ chr ( 13 ) , chr ( 10 ) , '\'' , '"' ] ; $ replace = [ ' ' , ' ' , ''' , '"' ] ; if ( $ mode ) { $ text = str_replace ( $ search , $ replace , $ text ) ; } else { $ text = str_replace ( $ replace , $ search , $ text ) ; } return $ text ; } | Parses and replaces special chars . |
36,830 | protected function getCsvFieldsTerminator ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ fieldTerminator = $ config -> getConfigParam ( 'sGiCsvFieldTerminator' ) ; if ( ! $ fieldTerminator ) { $ fieldTerminator = $ config -> getConfigParam ( 'sCSVSign' ) ; } if ( ! $ fieldTerminator ) { $ fieldTerminator = $ this -> defaultStringTerminator ; } return $ fieldTerminator ; } | Set csv field terminator symbol . |
36,831 | protected function getCsvFieldsEncolser ( ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ fieldEncloser = $ config -> getConfigParam ( 'sGiCsvFieldEncloser' ) ) { return $ fieldEncloser ; } return $ this -> defaultStringEncloser ; } | Get csv field encloser symbol . |
36,832 | public function buildWhere ( ) { $ this -> _aWhere = parent :: buildWhere ( ) ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'malladmin' ) ) { $ this -> _aWhere [ getViewName ( "oxshops" ) . ".oxid" ] = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "actshop" ) ; } return $ this -> _aWhere ; } | Sets SQL WHERE condition . Returns array of conditions . |
36,833 | public function render ( ) { parent :: render ( ) ; if ( ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blEnableDownloads' ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'EXCEPTION_DISABLED_DOWNLOADABLE_PRODUCTS' ) ; } $ oArticle = $ this -> getArticle ( ) ; if ( $ oArticle -> oxarticles__oxparentid -> value ) { $ oParentArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ oParentArticle -> load ( $ oArticle -> oxarticles__oxparentid -> value ) ; $ oArticle -> oxarticles__oxisdownloadable = new \ OxidEsales \ Eshop \ Core \ Field ( $ oParentArticle -> oxarticles__oxisdownloadable -> value ) ; $ this -> _aViewData [ "oxparentid" ] = $ oArticle -> oxarticles__oxparentid -> value ; } return $ this -> _sThisTemplate ; } | Collects available article axtended parameters passes them to Smarty engine and returns tamplate file name article_extend . tpl . |
36,834 | public function getArticle ( $ blReset = false ) { if ( $ this -> _oArticle !== null && ! $ blReset ) { return $ this -> _oArticle ; } $ sProductId = $ this -> getEditObjectId ( ) ; $ oProduct = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ oProduct -> load ( $ sProductId ) ; return $ this -> _oArticle = $ oProduct ; } | Returns current oxarticle object |
36,835 | public function upload ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> isDemoShop ( ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ExceptionToDisplay :: class ) ; $ oEx -> setMessage ( 'ARTICLE_EXTEND_UPLOADISDISABLED' ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ oEx , false ) ; return ; } $ soxId = $ this -> getEditObjectId ( ) ; $ aParams = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "newfile" ) ; $ aParams = $ this -> _processOptions ( $ aParams ) ; $ aNewFile = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getUploadedFile ( "newArticleFile" ) ; $ oArticleFile = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ File :: class ) ; $ oArticleFile -> assign ( $ aParams ) ; if ( ! $ aNewFile [ 'name' ] && ! $ oArticleFile -> oxfiles__oxfilename -> value ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'EXCEPTION_NOFILE' ) ; } if ( $ aNewFile [ 'name' ] ) { $ oArticleFile -> oxfiles__oxfilename = new \ OxidEsales \ Eshop \ Core \ Field ( $ aNewFile [ 'name' ] , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; try { $ oArticleFile -> processFile ( 'newArticleFile' ) ; } catch ( Exception $ e ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ e -> getMessage ( ) ) ; } } if ( ! $ oArticleFile -> isUnderDownloadFolder ( ) ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'EXCEPTION_NOFILE' ) ; } $ oArticleFile -> oxfiles__oxartid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ oArticleFile -> save ( ) ; } | Creates new oxFile object and stores newly uploaded file |
36,836 | public function deletefile ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ myConfig -> isDemoShop ( ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ExceptionToDisplay :: class ) ; $ oEx -> setMessage ( 'ARTICLE_EXTEND_UPLOADISDISABLED' ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ oEx , false ) ; return ; } $ sArticleId = $ this -> getEditObjectId ( ) ; $ sArticleFileId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'fileid' ) ; $ oArticleFile = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ File :: class ) ; $ oArticleFile -> load ( $ sArticleFileId ) ; if ( $ oArticleFile -> hasValidDownloads ( ) ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'EXCEPTION_DELETING_VALID_FILE' ) ; } if ( $ oArticleFile -> oxfiles__oxartid -> value == $ sArticleId ) { $ oArticleFile -> delete ( ) ; } } | Deletes article file from fileid parameter and checks if this file belongs to current article . |
36,837 | protected function _processOptions ( $ aParams ) { if ( ! is_array ( $ aParams ) ) { $ aParams = [ ] ; } if ( ! isset ( $ aParams [ "oxfiles__oxdownloadexptime" ] ) || $ aParams [ "oxfiles__oxdownloadexptime" ] == "" ) { $ aParams [ "oxfiles__oxdownloadexptime" ] = - 1 ; } if ( ! isset ( $ aParams [ "oxfiles__oxlinkexptime" ] ) || $ aParams [ "oxfiles__oxlinkexptime" ] == "" ) { $ aParams [ "oxfiles__oxlinkexptime" ] = - 1 ; } if ( ! isset ( $ aParams [ "oxfiles__oxmaxunregdownloads" ] ) || $ aParams [ "oxfiles__oxmaxunregdownloads" ] == "" ) { $ aParams [ "oxfiles__oxmaxunregdownloads" ] = - 1 ; } if ( ! isset ( $ aParams [ "oxfiles__oxmaxdownloads" ] ) || $ aParams [ "oxfiles__oxmaxdownloads" ] == "" ) { $ aParams [ "oxfiles__oxmaxdownloads" ] = - 1 ; } return $ aParams ; } | Process config options . If value is not set save as - 1 to database |
36,838 | public function getHistoryArticles ( ) { if ( $ aArticlesIds = $ this -> getSession ( ) -> getVariable ( 'aHistoryArticles' ) ) { return $ aArticlesIds ; } elseif ( $ sArticlesIds = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> getOxCookie ( 'aHistoryArticles' ) ) { return explode ( '|' , $ sArticlesIds ) ; } } | Get history article id s from session or cookie . |
36,839 | public function setHistoryArticles ( $ aArticlesIds ) { if ( $ this -> getSession ( ) -> getId ( ) ) { \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'aHistoryArticles' , $ aArticlesIds ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> setOxCookie ( 'aHistoryArticles' , '' ) ; } else { \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsServer ( ) -> setOxCookie ( 'aHistoryArticles' , implode ( '|' , $ aArticlesIds ) ) ; } } | Set history article id s to session or cookie |
36,840 | public function sortByIds ( $ aIds ) { $ this -> _aOrderMap = array_flip ( $ aIds ) ; uksort ( $ this -> _aArray , [ $ this , '_sortByOrderMapCallback' ] ) ; } | sort this list by given order . |
36,841 | protected function _sortByOrderMapCallback ( $ key1 , $ key2 ) { if ( isset ( $ this -> _aOrderMap [ $ key1 ] ) ) { if ( isset ( $ this -> _aOrderMap [ $ key2 ] ) ) { $ iDiff = $ this -> _aOrderMap [ $ key2 ] - $ this -> _aOrderMap [ $ key1 ] ; if ( $ iDiff > 0 ) { return - 1 ; } elseif ( $ iDiff < 0 ) { return 1 ; } else { return 0 ; } } else { return - 1 ; } } elseif ( isset ( $ this -> _aOrderMap [ $ key2 ] ) ) { return 1 ; } else { return 0 ; } } | callback function only used from sortByIds |
36,842 | public function loadNewestArticles ( $ iLimit = null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ myConfig -> getConfigParam ( 'bl_perfLoadPriceForAddList' ) ) { $ this -> getBaseObject ( ) -> disablePriceLoad ( ) ; } $ this -> _aArray = [ ] ; switch ( $ myConfig -> getConfigParam ( 'iNewestArticlesMode' ) ) { case 0 : break ; case 1 : $ this -> loadActionArticles ( 'oxnewest' , $ iLimit ) ; break ; case 2 : $ sArticleTable = getViewName ( 'oxarticles' ) ; if ( $ myConfig -> getConfigParam ( 'blNewArtByInsert' ) ) { $ sType = 'oxinsert' ; } else { $ sType = 'oxtimestamp' ; } $ sSelect = "select * from $sArticleTable " ; $ sSelect .= "where oxparentid = '' and " . $ this -> getBaseObject ( ) -> getSqlActiveSnippet ( ) . " and oxissearch = 1 order by $sType desc " ; if ( ! ( $ iLimit = ( int ) $ iLimit ) ) { $ iLimit = $ myConfig -> getConfigParam ( 'iNrofNewcomerArticles' ) ; } $ sSelect .= "limit " . $ iLimit ; $ this -> selectString ( $ sSelect ) ; break ; } } | Loads newest shops articles from DB . |
36,843 | public function loadTop5Articles ( $ iLimit = null ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ myConfig -> getConfigParam ( 'bl_perfLoadPriceForAddList' ) ) { $ this -> getBaseObject ( ) -> disablePriceLoad ( ) ; } switch ( $ myConfig -> getConfigParam ( 'iTop5Mode' ) ) { case 0 : break ; case 1 : $ this -> loadActionArticles ( 'oxtop5' , $ iLimit ) ; break ; case 2 : $ sArticleTable = getViewName ( 'oxarticles' ) ; $ sLimit = ( $ iLimit > 0 ) ? "limit " . $ iLimit : 'limit 5' ; $ sSelect = "select * from $sArticleTable " ; $ sSelect .= "where " . $ this -> getBaseObject ( ) -> getSqlActiveSnippet ( ) . " and $sArticleTable.oxissearch = 1 " ; $ sSelect .= "and $sArticleTable.oxparentid = '' and $sArticleTable.oxsoldamount>0 " ; $ sSelect .= "order by $sArticleTable.oxsoldamount desc $sLimit" ; $ this -> selectString ( $ sSelect ) ; break ; } } | Load top 5 articles |
36,844 | public function loadActionArticles ( $ sActionID , $ iLimit = null ) { if ( ! trim ( $ sActionID ) ) { return ; } $ sShopID = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopId ( ) ; $ sActionID = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( strtolower ( $ sActionID ) ) ; $ oBaseObject = $ this -> getBaseObject ( ) ; $ sArticleTable = $ oBaseObject -> getViewName ( ) ; $ sArticleFields = $ oBaseObject -> getSelectFields ( ) ; $ oBase = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Actions :: class ) ; $ sActiveSql = $ oBase -> getSqlActiveSnippet ( ) ; $ sViewName = $ oBase -> getViewName ( ) ; $ sLimit = ( $ iLimit > 0 ) ? "limit " . $ iLimit : '' ; $ sSelect = "select $sArticleFields from oxactions2article left join $sArticleTable on $sArticleTable.oxid = oxactions2article.oxartid left join $sViewName on $sViewName.oxid = oxactions2article.oxactionid where oxactions2article.oxshopid = '$sShopID' and oxactions2article.oxactionid = $sActionID and $sActiveSql and $sArticleTable.oxid is not null and " . $ oBaseObject -> getSqlActiveSnippet ( ) . " order by oxactions2article.oxsort $sLimit" ; $ this -> selectString ( $ sSelect ) ; } | Loads shop AktionArticles . |
36,845 | public function loadArticleCrossSell ( $ sArticleId ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! $ myConfig -> getConfigParam ( 'bl_perfLoadCrossselling' ) ) { return null ; } $ oBaseObject = $ this -> getBaseObject ( ) ; $ sArticleTable = $ oBaseObject -> getViewName ( ) ; $ sArticleId = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sArticleId ) ; $ sSelect = "SELECT $sArticleTable.* FROM $sArticleTable INNER JOIN oxobject2article ON oxobject2article.oxobjectid=$sArticleTable.oxid " ; $ sSelect .= "WHERE oxobject2article.oxarticlenid = $sArticleId " ; $ sSelect .= " AND " . $ oBaseObject -> getSqlActiveSnippet ( ) ; if ( $ myConfig -> getConfigParam ( 'blBidirectCross' ) ) { $ sSelect = " ( SELECT $sArticleTable.* FROM $sArticleTable INNER JOIN oxobject2article AS O2A1 on ( O2A1.oxobjectid = $sArticleTable.oxid AND O2A1.oxarticlenid = $sArticleId ) WHERE 1 AND " . $ oBaseObject -> getSqlActiveSnippet ( ) . " AND ($sArticleTable.oxid != $sArticleId) ) UNION ( SELECT $sArticleTable.* FROM $sArticleTable INNER JOIN oxobject2article AS O2A2 ON ( O2A2.oxarticlenid = $sArticleTable.oxid AND O2A2.oxobjectid = $sArticleId ) WHERE 1 AND " . $ oBaseObject -> getSqlActiveSnippet ( ) . " AND ($sArticleTable.oxid != $sArticleId) )" ; } $ this -> setSqlLimit ( 0 , $ myConfig -> getConfigParam ( 'iNrofCrossellArticles' ) ) ; $ this -> selectString ( $ sSelect ) ; } | Loads article cross selling |
36,846 | public function loadCategoryArticles ( $ sCatId , $ aSessionFilter , $ iLimit = null ) { $ sArticleFields = $ this -> getBaseObject ( ) -> getSelectFields ( ) ; $ sSelect = $ this -> _getCategorySelect ( $ sArticleFields , $ sCatId , $ aSessionFilter ) ; $ iArticleCount = null ; if ( $ aSessionFilter ) { $ iArticleCount = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getOne ( $ this -> _getCategoryCountSelect ( $ sCatId , $ aSessionFilter ) ) ; } if ( $ iLimit = ( int ) $ iLimit ) { $ sSelect .= " LIMIT $iLimit" ; } $ this -> selectString ( $ sSelect ) ; if ( $ iArticleCount !== null ) { return $ iArticleCount ; } return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsCount ( ) -> getCatArticleCount ( $ sCatId ) ; } | Loads articles for the give Category |
36,847 | public function loadRecommArticles ( $ sRecommId , $ sArticlesFilter = null ) { $ sSelect = $ this -> _getArticleSelect ( $ sRecommId , $ sArticlesFilter ) ; $ this -> selectString ( $ sSelect ) ; } | Loads articles for the recommlist |
36,848 | public function loadRecommArticleIds ( $ sRecommId , $ sArticlesFilter ) { $ sSelect = $ this -> _getArticleSelect ( $ sRecommId , $ sArticlesFilter ) ; $ sArtView = getViewName ( 'oxarticles' ) ; $ sPartial = substr ( $ sSelect , strpos ( $ sSelect , ' from ' ) ) ; $ sSelect = "select distinct $sArtView.oxid $sPartial " ; $ this -> _createIdListFromSql ( $ sSelect ) ; } | Loads only ID s and create Fake objects . |
36,849 | protected function _getArticleSelect ( $ sRecommId , $ sArticlesFilter = null ) { $ sRecommId = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sRecommId ) ; $ sArtView = getViewName ( 'oxarticles' ) ; $ sSelect = "select distinct $sArtView.*, oxobject2list.oxdesc from oxobject2list " ; $ sSelect .= "left join $sArtView on oxobject2list.oxobjectid = $sArtView.oxid " ; $ sSelect .= "where (oxobject2list.oxlistid = $sRecommId) " . $ sArticlesFilter ; return $ sSelect ; } | Returns the appropriate SQL select |
36,850 | public function loadPriceIds ( $ dPriceFrom , $ dPriceTo ) { $ sSelect = $ this -> _getPriceSelect ( $ dPriceFrom , $ dPriceTo ) ; $ this -> _createIdListFromSql ( $ sSelect ) ; } | Loads Id list of appropriate price products |
36,851 | public function loadIds ( $ aIds ) { if ( ! count ( $ aIds ) ) { $ this -> clear ( ) ; return ; } $ oBaseObject = $ this -> getBaseObject ( ) ; $ sArticleTable = $ oBaseObject -> getViewName ( ) ; $ sArticleFields = $ oBaseObject -> getSelectFields ( ) ; $ oxIdsSql = implode ( ',' , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aIds ) ) ; $ sSelect = "select $sArticleFields from $sArticleTable " ; $ sSelect .= "where $sArticleTable.oxid in ( " . $ oxIdsSql . " ) and " ; $ sSelect .= $ oBaseObject -> getSqlActiveSnippet ( ) ; $ this -> selectString ( $ sSelect ) ; } | Load the list by article ids |
36,852 | public function loadOrderArticles ( $ aOrders ) { if ( ! count ( $ aOrders ) ) { $ this -> clear ( ) ; return ; } foreach ( $ aOrders as $ iKey => $ oOrder ) { $ aOrdersIds [ ] = $ oOrder -> getId ( ) ; } $ oBaseObject = $ this -> getBaseObject ( ) ; $ sArticleTable = $ oBaseObject -> getViewName ( ) ; $ sArticleFields = $ oBaseObject -> getSelectFields ( ) ; $ sArticleFields = str_replace ( "`$sArticleTable`.`oxid`" , "`oxorderarticles`.`oxartid` AS `oxid`" , $ sArticleFields ) ; $ sSelect = "SELECT $sArticleFields FROM oxorderarticles " ; $ sSelect .= "left join $sArticleTable on oxorderarticles.oxartid = $sArticleTable.oxid " ; $ sSelect .= "WHERE oxorderarticles.oxorderid IN ( '" . implode ( "','" , $ aOrdersIds ) . "' ) " ; $ sSelect .= "order by $sArticleTable.oxid " ; $ this -> selectString ( $ sSelect ) ; $ sNow = date ( 'Y-m-d H:i:s' ) ; foreach ( $ this as $ oArticle ) { if ( ! $ oArticle -> oxarticles__oxactive -> value && ( $ oArticle -> oxarticles__oxactivefrom -> value > $ sNow || $ oArticle -> oxarticles__oxactiveto -> value < $ sNow ) ) { $ oArticle -> setBuyableState ( false ) ; } } } | Loads the article list by orders ids |
36,853 | public function loadStockRemindProducts ( $ aBasketContents ) { if ( is_array ( $ aBasketContents ) && count ( $ aBasketContents ) ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; foreach ( $ aBasketContents as $ oBasketItem ) { $ aArtIds [ ] = $ oDb -> quote ( $ oBasketItem -> getProductId ( ) ) ; } $ oBaseObject = $ this -> getBaseObject ( ) ; $ sFieldNames = $ oBaseObject -> getSelectFields ( ) ; $ sTable = $ oBaseObject -> getViewName ( ) ; $ sQ = "select {$sFieldNames} from {$sTable} where {$sTable}.oxid in ( " . implode ( "," , $ aArtIds ) . " ) and oxremindactive = '1' and oxstock <= oxremindamount" ; $ this -> selectString ( $ sQ ) ; if ( $ this -> count ( ) ) { $ sQ = "update {$sTable} set oxremindactive = '2' where {$sTable}.oxid in ( " . implode ( "," , $ aArtIds ) . " ) and oxremindactive = '1' and oxstock <= oxremindamount" ; $ oDb -> execute ( $ sQ ) ; } } } | Loads list of low stock state products |
36,854 | public function renewPriceUpdateTime ( ) { $ iTimeToUpdate = $ this -> fetchNextUpdateTime ( ) ; $ iCurrUpdateTime = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ iNextUpdateTime = $ iCurrUpdateTime + 3600 * 24 ; if ( ! $ iTimeToUpdate || $ iTimeToUpdate > $ iNextUpdateTime ) { $ iTimeToUpdate = $ iNextUpdateTime ; } \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> saveShopConfVar ( "num" , "iTimeToUpdatePrices" , $ iTimeToUpdate ) ; return $ iTimeToUpdate ; } | Calculates updates and returns next price renew time |
36,855 | protected function _createIdListFromSql ( $ sSql ) { $ rs = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) -> select ( $ sSql ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { while ( ! $ rs -> EOF ) { $ rs -> fields = array_change_key_case ( $ rs -> fields , CASE_LOWER ) ; $ this [ $ rs -> fields [ 'oxid' ] ] = $ rs -> fields [ 'oxid' ] ; $ rs -> fetchRow ( ) ; } } } | fills the list simply with keys of the oxid and the position as value for the given sql |
36,856 | protected function _getFilterIdsSql ( $ sCatId , $ aFilter ) { $ sO2CView = getViewName ( 'oxobject2category' ) ; $ sO2AView = getViewName ( 'oxobject2attribute' ) ; $ sFilter = '' ; $ iCnt = 0 ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; foreach ( $ aFilter as $ sAttrId => $ sValue ) { if ( $ sValue ) { if ( $ sFilter ) { $ sFilter .= ' or ' ; } $ sValue = $ oDb -> quote ( $ sValue ) ; $ sAttrId = $ oDb -> quote ( $ sAttrId ) ; $ sFilter .= "( oa.oxattrid = {$sAttrId} and oa.oxvalue = {$sValue} )" ; $ iCnt ++ ; } } if ( $ sFilter ) { $ sFilter = "WHERE $sFilter " ; } $ sFilterSelect = "select oc.oxobjectid as oxobjectid, count(*) as cnt from " ; $ sFilterSelect .= "(SELECT * FROM $sO2CView WHERE $sO2CView.oxcatnid = '$sCatId' GROUP BY $sO2CView.oxobjectid, $sO2CView.oxcatnid) as oc " ; $ sFilterSelect .= "INNER JOIN $sO2AView as oa ON ( oa.oxobjectid = oc.oxobjectid ) " ; return $ sFilterSelect . "{$sFilter} GROUP BY oa.oxobjectid HAVING cnt = $iCnt " ; } | Returns sql to fetch ids of articles fitting current filter |
36,857 | protected function _getCategorySelect ( $ sFields , $ sCatId , $ aSessionFilter ) { $ sArticleTable = getViewName ( 'oxarticles' ) ; $ sO2CView = getViewName ( 'oxobject2category' ) ; $ sSorting = '' ; if ( $ this -> _sCustomSorting ) { $ sSorting = " {$this->_sCustomSorting} , " ; } $ sFilterSql = '' ; $ iLang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> getBaseLanguage ( ) ; if ( $ aSessionFilter && isset ( $ aSessionFilter [ $ sCatId ] [ $ iLang ] ) ) { $ sFilterSql = $ this -> _getFilterSql ( $ sCatId , $ aSessionFilter [ $ sCatId ] [ $ iLang ] ) ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = "SELECT $sFields, $sArticleTable.oxtimestamp FROM $sO2CView as oc left join $sArticleTable ON $sArticleTable.oxid = oc.oxobjectid WHERE " . $ this -> getBaseObject ( ) -> getSqlActiveSnippet ( ) . " and $sArticleTable.oxparentid = '' and oc.oxcatnid = " . $ oDb -> quote ( $ sCatId ) . " $sFilterSql ORDER BY $sSorting oc.oxpos, oc.oxobjectid " ; return $ sSelect ; } | Creates SQL Statement to load Articles etc . |
36,858 | protected function _getPriceSelect ( $ dPriceFrom , $ dPriceTo ) { $ oBaseObject = $ this -> getBaseObject ( ) ; $ sArticleTable = $ oBaseObject -> getViewName ( ) ; $ sSelectFields = $ oBaseObject -> getSelectFields ( ) ; $ sSelect = "select {$sSelectFields} from {$sArticleTable} where oxvarminprice >= 0 " ; $ sSelect .= $ dPriceTo ? "and oxvarminprice <= " . ( double ) $ dPriceTo . " " : " " ; $ sSelect .= $ dPriceFrom ? "and oxvarminprice >= " . ( double ) $ dPriceFrom . " " : " " ; $ sSelect .= " and " . $ oBaseObject -> getSqlActiveSnippet ( ) . " and {$sArticleTable}.oxissearch = 1" ; if ( ! $ this -> _sCustomSorting ) { $ sSelect .= " order by {$sArticleTable}.oxvarminprice asc , {$sArticleTable}.oxid" ; } else { $ sSelect .= " order by {$this->_sCustomSorting}, {$sArticleTable}.oxid " ; } return $ sSelect ; } | Builds SQL for selecting articles by price |
36,859 | protected function _getVendorSelect ( $ sVendorId ) { $ sArticleTable = getViewName ( 'oxarticles' ) ; $ oBaseObject = $ this -> getBaseObject ( ) ; $ sFieldNames = $ oBaseObject -> getSelectFields ( ) ; $ sSelect = "select $sFieldNames from $sArticleTable " ; $ sSelect .= "where $sArticleTable.oxvendorid = " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( $ sVendorId ) . " " ; $ sSelect .= " and " . $ oBaseObject -> getSqlActiveSnippet ( ) . " and $sArticleTable.oxparentid = '' " ; if ( $ this -> _sCustomSorting ) { $ sSelect .= " ORDER BY {$this->_sCustomSorting} " ; } return $ sSelect ; } | Builds vendor select SQL statement |
36,860 | protected function _canUpdatePrices ( ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ blCan = false ; if ( ! $ oConfig -> getConfigParam ( "blUseCron" ) ) { $ iTimeToUpdate = $ oConfig -> getConfigParam ( "iTimeToUpdatePrices" ) ; if ( ! $ iTimeToUpdate || $ iTimeToUpdate <= \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ) { $ blCan = true ; } } return $ blCan ; } | Checks if price update can be executed - current time > next price update time |
36,861 | protected function fetchNextUpdateTime ( ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = $ this -> getQueryToFetchNextUpdateTime ( ) ; $ iTimeToUpdate = $ database -> getOne ( sprintf ( $ sQ , "`oxarticles`" ) ) ; return $ iTimeToUpdate ; } | Method fetches next update time for renewing price update time . |
36,862 | protected function updateOxArticles ( $ sCurrUpdateTime , $ oDb ) { $ sQ = $ this -> getQueryToUpdateOxArticle ( $ sCurrUpdateTime ) ; $ blUpdated = $ oDb -> execute ( sprintf ( $ sQ , "`oxarticles`" ) ) ; return $ blUpdated ; } | Updates article . |
36,863 | protected function getSearchTableName ( $ table , $ field ) { $ searchTable = $ table ; if ( $ field == 'oxlongdesc' ) { $ searchTable = Registry :: get ( \ OxidEsales \ Eshop \ Core \ TableViewNameGenerator :: class ) -> getViewName ( 'oxartextends' ) ; } return $ searchTable ; } | Get search table name . Needed in case of searching for data in table oxartextends or its views . |
36,864 | protected function _getSmarty ( ) { if ( $ this -> _oSmarty === null ) { $ this -> _oSmarty = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> getSmarty ( ) ; } $ this -> _oSmarty -> assign ( "oEmailView" , $ this ) ; return $ this -> _oSmarty ; } | Smarty instance getter assigns this oxEmail instance to oEmailView variable |
36,865 | protected function _setSmtpProtocol ( $ url ) { $ protocol = '' ; $ smtpHost = $ url ; $ match = [ ] ; if ( Str :: getStr ( ) -> preg_match ( '@^([0-9a-z]+://)?(.*)$@i' , $ url , $ match ) ) { if ( $ match [ 1 ] ) { if ( ( $ match [ 1 ] == 'ssl://' ) || ( $ match [ 1 ] == 'tls://' ) ) { $ this -> set ( "SMTPSecure" , substr ( $ match [ 1 ] , 0 , 3 ) ) ; } else { $ protocol = $ match [ 1 ] ; } } $ smtpHost = $ match [ 2 ] ; } return $ protocol . $ smtpHost ; } | Sets smtp parameters depending on the protocol used returns smtp url which should be used for fsockopen |
36,866 | public function setSmtp ( $ shop = null ) { $ myConfig = Registry :: getConfig ( ) ; $ shop = ( $ shop ) ? $ shop : $ this -> _getShop ( ) ; $ smtpUrl = $ this -> _setSmtpProtocol ( $ shop -> oxshops__oxsmtp -> value ) ; if ( ! $ this -> _isValidSmtpHost ( $ smtpUrl ) ) { $ this -> setMailer ( "mail" ) ; return ; } $ this -> setHost ( $ smtpUrl ) ; $ this -> setMailer ( "smtp" ) ; if ( $ shop -> oxshops__oxsmtpuser -> value ) { $ this -> _setSmtpAuthInfo ( $ shop -> oxshops__oxsmtpuser -> value , $ shop -> oxshops__oxsmtppwd -> value ) ; } if ( $ myConfig -> getConfigParam ( 'iDebug' ) == 6 ) { $ this -> _setSmtpDebug ( true ) ; } } | Sets SMTP mailer parameters such as user name password location . |
36,867 | public function sendOrderEmailToUser ( $ order , $ subject = null ) { $ order = $ this -> _addUserInfoOrderEMail ( $ order ) ; $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ user = $ order -> getOrderUser ( ) ; $ this -> setUser ( $ user ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "order" , $ order ) ; $ this -> setViewData ( "blShowReviewLink" , $ this -> shouldProductReviewLinksBeIncluded ( ) ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sOrderUserTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sOrderUserPlainTemplate ) ) ; if ( $ subject === null ) { if ( $ smarty -> template_exists ( $ this -> _sOrderUserSubjectTemplate ) ) { $ subject = $ smarty -> fetch ( $ this -> _sOrderUserSubjectTemplate ) ; } else { $ subject = $ shop -> oxshops__oxordersubject -> getRawValue ( ) . " (#" . $ order -> oxorder__oxordernr -> value . ")" ; } } $ this -> setSubject ( $ subject ) ; $ fullName = $ user -> oxuser__oxfname -> getRawValue ( ) . " " . $ user -> oxuser__oxlname -> getRawValue ( ) ; $ this -> setRecipient ( $ user -> oxuser__oxusername -> value , $ fullName ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends ordering mail to user . Returns true on success . |
36,868 | public function sendOrderEmailToOwner ( $ order , $ subject = null ) { $ config = Registry :: getConfig ( ) ; $ shop = $ this -> _getShop ( ) ; $ this -> _clearMailer ( ) ; $ order = $ this -> _addUserInfoOrderEMail ( $ order ) ; $ user = $ order -> getOrderUser ( ) ; $ this -> setUser ( $ user ) ; $ this -> setFrom ( $ shop -> oxshops__oxowneremail -> value ) ; $ language = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ orderLanguage = $ language -> getObjectTplLanguage ( ) ; if ( $ shop -> getLanguage ( ) != $ orderLanguage ) { $ shop = $ this -> _getShop ( $ orderLanguage ) ; } $ this -> setSmtp ( $ shop ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "order" , $ order ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ config -> getTemplatePath ( $ this -> _sOrderOwnerTemplate , false ) ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ config -> getTemplatePath ( $ this -> _sOrderOwnerPlainTemplate , false ) ) ) ; if ( $ subject === null ) { if ( $ smarty -> template_exists ( $ this -> _sOrderOwnerSubjectTemplate ) ) { $ subject = $ smarty -> fetch ( $ this -> _sOrderOwnerSubjectTemplate ) ; } else { $ subject = $ shop -> oxshops__oxordersubject -> getRawValue ( ) . " (#" . $ order -> oxorder__oxordernr -> value . ")" ; } } $ this -> setSubject ( $ subject ) ; $ this -> setRecipient ( $ shop -> oxshops__oxowneremail -> value , $ language -> translateString ( "order" ) ) ; if ( $ user -> oxuser__oxusername -> value != "admin" ) { $ fullName = $ user -> oxuser__oxfname -> getRawValue ( ) . " " . $ user -> oxuser__oxlname -> getRawValue ( ) ; $ this -> setReplyTo ( $ user -> oxuser__oxusername -> value , $ fullName ) ; } $ result = $ this -> send ( ) ; $ this -> onOrderEmailToOwnerSent ( $ user , $ order ) ; if ( $ config -> getConfigParam ( 'iDebug' ) == 6 ) { \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> showMessageAndExit ( "" ) ; } return $ result ; } | Sets mailer additional settings and sends ordering mail to shop owner . Returns true on success . |
36,869 | protected function onOrderEmailToOwnerSent ( $ user , $ order ) { $ remark = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Remark :: class ) ; $ remark -> oxremark__oxtext = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> getAltBody ( ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ remark -> oxremark__oxparentid = new \ OxidEsales \ Eshop \ Core \ Field ( $ user -> getId ( ) , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ remark -> oxremark__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "o" , \ OxidEsales \ Eshop \ Core \ Field :: T_RAW ) ; $ remark -> save ( ) ; } | Method is called when order email is sent to owner . |
36,870 | public function sendForgotPwdEmail ( $ emailAddress , $ subject = null ) { $ result = false ; $ shop = $ this -> _addForgotPwdEmail ( $ this -> _getShop ( ) ) ; $ oxid = $ this -> getUserIdByUserName ( $ emailAddress , $ shop -> getId ( ) ) ; $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ oxid && $ user -> load ( $ oxid ) ) { $ smarty = $ this -> _getSmarty ( ) ; $ this -> setUser ( $ user ) ; $ this -> _processViewArray ( ) ; $ this -> _setMailParams ( $ shop ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sForgotPwdTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sForgotPwdTemplatePlain ) ) ; $ this -> setSubject ( ( $ subject !== null ) ? $ subject : $ shop -> oxshops__oxforgotpwdsubject -> getRawValue ( ) ) ; $ fullName = $ user -> oxuser__oxfname -> getRawValue ( ) . " " . $ user -> oxuser__oxlname -> getRawValue ( ) ; $ recipientAddress = $ user -> oxuser__oxusername -> getRawValue ( ) ; $ this -> setRecipient ( $ recipientAddress , $ fullName ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; if ( ! $ this -> send ( ) ) { $ result = - 1 ; } else { $ result = true ; } } return $ result ; } | Sets mailer additional settings and sends forgot password mail to user . Returns true on success . |
36,871 | public function sendContactMail ( $ emailAddress = null , $ subject = null , $ message = null ) { $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ this -> setBody ( $ message ) ; $ this -> setSubject ( $ subject ) ; $ this -> setRecipient ( $ shop -> oxshops__oxinfoemail -> value , "" ) ; $ this -> setFrom ( $ shop -> oxshops__oxowneremail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setReplyTo ( $ emailAddress , "" ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends contact info mail to user . Returns true on success . |
36,872 | public function sendNewsletterDbOptInMail ( $ user , $ subject = null ) { $ user = $ this -> _addNewsletterDbOptInMail ( $ user ) ; $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ smarty = $ this -> _getSmarty ( ) ; $ confirmCode = md5 ( $ user -> oxuser__oxusername -> value . $ user -> oxuser__oxpasssalt -> value ) ; $ this -> setViewData ( "subscribeLink" , $ this -> _getNewsSubsLink ( $ user -> oxuser__oxid -> value , $ confirmCode ) ) ; $ this -> setUser ( $ user ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sNewsletterOptInTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sNewsletterOptInTemplatePlain ) ) ; $ this -> setSubject ( ( $ subject !== null ) ? $ subject : \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( "NEWSLETTER" ) . " " . $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ fullName = $ user -> oxuser__oxfname -> getRawValue ( ) . " " . $ user -> oxuser__oxlname -> getRawValue ( ) ; $ this -> setRecipient ( $ user -> oxuser__oxusername -> value , $ fullName ) ; $ this -> setFrom ( $ shop -> oxshops__oxinfoemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxinfoemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends NewsletterDBOptInMail mail to user . Returns true on success . |
36,873 | protected function _getNewsSubsLink ( $ id , $ confirmCode = null ) { $ myConfig = Registry :: getConfig ( ) ; $ actShopLang = $ myConfig -> getActiveShop ( ) -> getLanguage ( ) ; $ url = $ myConfig -> getShopHomeUrl ( ) . 'cl=newsletter&fnc=addme&uid=' . $ id ; $ url .= '&lang=' . $ actShopLang ; $ url .= ( $ confirmCode ) ? '&confirm=' . $ confirmCode : "" ; return $ url ; } | Returns newsletter subscription link |
36,874 | public function sendNewsletterMail ( $ newsLetter , $ user , $ subject = null ) { $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ body = $ newsLetter -> getHtmlText ( ) ; if ( ! empty ( $ body ) ) { $ this -> setBody ( $ body ) ; $ this -> setAltBody ( $ newsLetter -> getPlainText ( ) ) ; } else { $ this -> isHTML ( false ) ; $ this -> setBody ( $ newsLetter -> getPlainText ( ) ) ; } $ this -> setSubject ( ( $ subject !== null ) ? $ subject : $ newsLetter -> oxnewsletter__oxtitle -> getRawValue ( ) ) ; $ fullName = $ user -> oxuser__oxfname -> getRawValue ( ) . " " . $ user -> oxuser__oxlname -> getRawValue ( ) ; $ this -> setRecipient ( $ user -> oxuser__oxusername -> value , $ fullName ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends newsletter mail to user . Returns true on success . |
36,875 | public function sendSuggestMail ( $ user , $ product ) { $ myConfig = Registry :: getConfig ( ) ; $ currLang = $ myConfig -> getActiveShop ( ) -> getLanguage ( ) ; $ shop = $ this -> _getShop ( $ currLang ) ; if ( $ product -> getLanguage ( ) != $ currLang ) { $ product -> setLanguage ( $ currLang ) ; $ product -> load ( $ product -> getId ( ) ) ; } $ this -> setFrom ( $ shop -> oxshops__oxinfoemail -> value ) ; $ this -> setSmtp ( ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "product" , $ product ) ; $ this -> setUser ( $ user ) ; $ articleUrl = $ product -> getLink ( ) ; if ( $ myConfig -> getActiveView ( ) -> isActive ( 'Invitations' ) && $ activeUser = $ shop -> getUser ( ) ) { $ articleUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> appendParamSeparator ( $ articleUrl ) ; $ articleUrl .= "su=" . $ activeUser -> getId ( ) ; } $ this -> setViewData ( "sArticleUrl" , $ articleUrl ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sSuggestTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sSuggestTemplatePlain ) ) ; $ this -> setSubject ( $ user -> send_subject ) ; $ this -> setRecipient ( $ user -> rec_email , $ user -> rec_name ) ; $ this -> setReplyTo ( $ user -> send_email , $ user -> send_name ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends SuggestMail mail to user . Returns true on success . |
36,876 | public function sendInviteMail ( $ user ) { $ myConfig = Registry :: getConfig ( ) ; $ currLang = $ myConfig -> getActiveShop ( ) -> getLanguage ( ) ; $ shop = $ this -> _getShop ( $ currLang ) ; $ this -> setFrom ( $ user -> send_email , $ user -> send_name ) ; $ this -> setSmtp ( ) ; $ smarty = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> getSmarty ( ) ; $ this -> setUser ( $ user ) ; $ homeUrl = $ this -> getViewConfig ( ) -> getHomeLink ( ) ; if ( $ myConfig -> getActiveView ( ) -> isActive ( 'Invitations' ) && $ activeUser = $ shop -> getUser ( ) ) { $ homeUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> appendParamSeparator ( $ homeUrl ) ; $ homeUrl .= "su=" . $ activeUser -> getId ( ) ; } if ( is_array ( $ user -> rec_email ) && count ( $ user -> rec_email ) > 0 ) { foreach ( $ user -> rec_email as $ email ) { if ( ! empty ( $ email ) ) { $ registerUrl = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> appendParamSeparator ( $ homeUrl ) ; $ registerUrl .= "re=" . md5 ( $ email ) ; $ this -> setViewData ( "sHomeUrl" , $ registerUrl ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sInviteTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sInviteTemplatePlain ) ) ; $ this -> setSubject ( $ user -> send_subject ) ; $ this -> setRecipient ( $ email ) ; $ this -> setReplyTo ( $ user -> send_email , $ user -> send_name ) ; $ this -> send ( ) ; $ this -> clearAllRecipients ( ) ; } } return true ; } return false ; } | Sets mailer additional settings and sends InviteMail mail to user . Returns true on success . |
36,877 | public function sendSendedNowMail ( $ order , $ subject = null ) { $ myConfig = Registry :: getConfig ( ) ; $ orderLang = ( int ) ( isset ( $ order -> oxorder__oxlang -> value ) ? $ order -> oxorder__oxlang -> value : 0 ) ; $ shop = $ this -> _getShop ( $ orderLang ) ; $ this -> _setMailParams ( $ shop ) ; $ lang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "order" , $ order ) ; $ this -> setViewData ( "shopTemplateDir" , $ myConfig -> getTemplateDir ( false ) ) ; if ( $ myConfig -> getConfigParam ( 'bl_perfLoadReviews' , false ) ) { $ this -> setViewData ( "blShowReviewLink" , true ) ; $ user = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; $ this -> setViewData ( "reviewuserhash" , $ user -> getReviewUserHash ( $ order -> oxorder__oxuserid -> value ) ) ; } else { $ this -> setViewData ( "blShowReviewLink" , false ) ; } $ this -> _processViewArray ( ) ; $ store [ 'INCLUDE_ANY' ] = $ smarty -> security_settings [ 'INCLUDE_ANY' ] ; $ oldTplLang = $ lang -> getTplLanguage ( ) ; $ oldBaseLang = $ lang -> getBaseLanguage ( ) ; $ lang -> setTplLanguage ( $ orderLang ) ; $ lang -> setBaseLanguage ( $ orderLang ) ; $ smarty -> security_settings [ 'INCLUDE_ANY' ] = true ; $ myConfig -> setAdminMode ( false ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sSenedNowTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sSenedNowTemplatePlain ) ) ; $ myConfig -> setAdminMode ( true ) ; $ lang -> setTplLanguage ( $ oldTplLang ) ; $ lang -> setBaseLanguage ( $ oldBaseLang ) ; $ smarty -> security_settings [ 'INCLUDE_ANY' ] = $ store [ 'INCLUDE_ANY' ] ; $ this -> setSubject ( ( $ subject !== null ) ? $ subject : $ shop -> oxshops__oxsendednowsubject -> getRawValue ( ) ) ; $ fullName = $ order -> oxorder__oxbillfname -> getRawValue ( ) . " " . $ order -> oxorder__oxbilllname -> getRawValue ( ) ; $ this -> setRecipient ( $ order -> oxorder__oxbillemail -> value , $ fullName ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends SendedNowMail mail to user . Returns true on success . |
36,878 | public function sendBackupMail ( $ attFiles , $ attPath , $ emailAddress , $ subject , $ message , & $ status , & $ error ) { $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ this -> setBody ( $ message ) ; $ this -> setSubject ( $ subject ) ; $ this -> setRecipient ( $ shop -> oxshops__oxinfoemail -> value , "" ) ; $ emailAddress = $ emailAddress ? $ emailAddress : $ shop -> oxshops__oxowneremail -> value ; $ this -> setFrom ( $ emailAddress , "" ) ; $ this -> setReplyTo ( $ emailAddress , "" ) ; $ attashSucc = true ; $ attPath = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> normalizeDir ( $ attPath ) ; foreach ( $ attFiles as $ num => $ attFile ) { $ fullPath = $ attPath . $ attFile ; if ( @ is_readable ( $ fullPath ) && @ is_file ( $ fullPath ) ) { $ attashSucc = $ this -> addAttachment ( $ fullPath , $ attFile ) ; } else { $ attashSucc = false ; $ error [ ] = [ 5 , $ attFile ] ; } } if ( ! $ attashSucc ) { $ error [ ] = [ 4 , "" ] ; $ this -> clearAttachments ( ) ; return false ; } $ status [ ] = 3 ; $ send = $ this -> send ( ) ; $ this -> clearAttachments ( ) ; return $ send ; } | Sets mailer additional settings and sends backup data to user . Returns true on success . |
36,879 | public function sendEmail ( $ to , $ subject , $ body ) { $ this -> _setMailParams ( ) ; if ( is_array ( $ to ) ) { foreach ( $ to as $ address ) { $ this -> setRecipient ( $ address , "" ) ; $ this -> setReplyTo ( $ address , "" ) ; } } else { $ this -> setRecipient ( $ to , "" ) ; $ this -> setReplyTo ( $ to , "" ) ; } $ this -> isHTML ( false ) ; $ this -> setSubject ( $ subject ) ; $ this -> setBody ( $ body ) ; return $ this -> send ( ) ; } | Basic wrapper for email message sending with default parameters from the oxBaseShop . Returns true on success . |
36,880 | public function sendStockReminder ( $ basketContents , $ subject = null ) { $ send = false ; $ articleList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ArticleList :: class ) ; $ articleList -> loadStockRemindProducts ( $ basketContents ) ; if ( $ articleList -> count ( ) ) { $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ lang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "articles" , $ articleList ) ; $ this -> _processViewArray ( ) ; $ this -> setRecipient ( $ shop -> oxshops__oxowneremail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setFrom ( $ shop -> oxshops__oxowneremail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setBody ( $ smarty -> fetch ( Registry :: getConfig ( ) -> getTemplatePath ( $ this -> _sReminderMailTemplate , false ) ) ) ; $ this -> setAltBody ( "" ) ; $ this -> setSubject ( ( $ subject !== null ) ? $ subject : $ lang -> translateString ( 'STOCK_LOW' ) ) ; $ send = $ this -> send ( ) ; } return $ send ; } | Sends reminder email to shop owner . |
36,881 | public function sendWishlistMail ( $ params ) { $ this -> _clearMailer ( ) ; $ this -> setFrom ( $ params -> send_email , $ params -> send_name ) ; $ this -> setSmtp ( ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setUser ( $ params ) ; $ this -> _processViewArray ( ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sWishListTemplate ) ) ; $ this -> setAltBody ( $ smarty -> fetch ( $ this -> _sWishListTemplatePlain ) ) ; $ this -> setSubject ( $ params -> send_subject ) ; $ this -> setRecipient ( $ params -> rec_email , $ params -> rec_name ) ; $ this -> setReplyTo ( $ params -> send_email , $ params -> send_name ) ; return $ this -> send ( ) ; } | Sets mailer additional settings and sends WishlistMail mail to user . Returns true on success . |
36,882 | public function sendPriceAlarmNotification ( $ params , $ alarm , $ subject = null ) { $ this -> _clearMailer ( ) ; $ shop = $ this -> _getShop ( ) ; $ this -> _setMailParams ( $ shop ) ; $ alarmLang = $ alarm -> oxpricealarm__oxlang -> value ; $ article = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Article :: class ) ; $ article -> loadInLang ( $ alarmLang , $ params [ 'aid' ] ) ; $ lang = \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "product" , $ article ) ; $ this -> setViewData ( "email" , $ params [ 'email' ] ) ; $ this -> setViewData ( "bidprice" , $ lang -> formatCurrency ( $ alarm -> oxpricealarm__oxprice -> value ) ) ; $ this -> _processViewArray ( ) ; $ this -> setRecipient ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setSubject ( ( $ subject !== null ) ? $ subject : $ lang -> translateString ( 'PRICE_ALERT_FOR_PRODUCT' , $ alarmLang ) . " " . $ article -> oxarticles__oxtitle -> getRawValue ( ) ) ; $ this -> setBody ( $ smarty -> fetch ( $ this -> _sOwnerPricealarmTemplate ) ) ; $ this -> setFrom ( $ params [ 'email' ] , "" ) ; $ this -> setReplyTo ( $ params [ 'email' ] , "" ) ; return $ this -> send ( ) ; } | Sends a notification to the shop owner that price alarm was subscribed . Returns true on success . |
36,883 | public function sendPricealarmToCustomer ( $ recipient , $ alarm , $ body = null , $ returnMailBody = null ) { $ this -> _clearMailer ( ) ; $ shop = $ this -> _getShop ( ) ; if ( $ shop -> getId ( ) != $ alarm -> oxpricealarm__oxshopid -> value ) { $ shop = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Shop :: class ) ; $ shop -> load ( $ alarm -> oxpricealarm__oxshopid -> value ) ; $ this -> setShop ( $ shop ) ; } $ this -> _setMailParams ( $ shop ) ; $ smarty = $ this -> _getSmarty ( ) ; $ this -> setViewData ( "product" , $ alarm -> getArticle ( ) ) ; $ this -> setViewData ( "oPriceAlarm" , $ alarm ) ; $ this -> setViewData ( "bidprice" , $ alarm -> getFProposedPrice ( ) ) ; $ this -> setViewData ( "currency" , $ alarm -> getPriceAlarmCurrency ( ) ) ; $ this -> _processViewArray ( ) ; $ this -> setRecipient ( $ recipient , $ recipient ) ; $ this -> setSubject ( $ shop -> oxshops__oxname -> value ) ; if ( $ body === null ) { $ body = $ smarty -> fetch ( $ this -> _sPricealamrCustomerTemplate ) ; } $ this -> setBody ( $ body ) ; $ this -> addAddress ( $ recipient , $ recipient ) ; $ this -> setReplyTo ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; if ( $ returnMailBody ) { return $ this -> getBody ( ) ; } else { return $ this -> send ( ) ; } } | Sends price alarm to customer . Returns true on success . |
36,884 | public function setAltBody ( $ altBody = null , $ clearSid = true ) { if ( $ clearSid ) { $ altBody = $ this -> _clearSidFromBody ( $ altBody ) ; } $ altBody = str_replace ( [ '&' , '"' , ''' , '<' , '>' ] , [ '&' , '"' , "'" , '<' , '>' ] , $ altBody ) ; $ this -> set ( "AltBody" , $ altBody ) ; } | Sets text - only body of the message . If second parameter is set to true performs search for sid removes it and adds shop id to string . |
36,885 | public function setRecipient ( $ address = null , $ name = null ) { try { $ address = $ this -> idnToAscii ( $ address ) ; parent :: addAddress ( $ address , $ name ) ; $ this -> _aRecipients [ ] = [ $ address , $ name ] ; } catch ( Exception $ exception ) { } } | Sets mail recipient to recipients array |
36,886 | public function headerLine ( $ name , $ value ) { if ( stripos ( $ name , 'X-' ) !== false ) { return null ; } return parent :: headerLine ( $ name , $ value ) ; } | Inherited phpMailer function adding a header to email message . We override it to skip X - Mailer header . |
36,887 | protected function _setMailParams ( $ shop = null ) { $ this -> _clearMailer ( ) ; if ( ! $ shop ) { $ shop = $ this -> _getShop ( ) ; } $ this -> setFrom ( $ shop -> oxshops__oxorderemail -> value , $ shop -> oxshops__oxname -> getRawValue ( ) ) ; $ this -> setSmtp ( $ shop ) ; } | Set mail From FromName SMTP values |
36,888 | protected function _getShop ( $ langId = null , $ shopId = null ) { if ( $ langId === null && $ shopId === null ) { if ( isset ( $ this -> _oShop ) ) { return $ this -> _oShop ; } else { return $ this -> _oShop = Registry :: getConfig ( ) -> getActiveShop ( ) ; } } $ myConfig = Registry :: getConfig ( ) ; $ shop = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Shop :: class ) ; if ( $ shopId !== null ) { $ shop -> setShopId ( $ shopId ) ; } if ( $ langId !== null ) { $ shop -> setLanguage ( $ langId ) ; } $ shop -> load ( $ myConfig -> getShopId ( ) ) ; return $ shop ; } | Get active shop and set global params for it If is set language parameter load shop in given language |
36,889 | protected function _setSmtpAuthInfo ( $ userName = null , $ userPassword = null ) { $ this -> set ( "SMTPAuth" , true ) ; $ this -> set ( "Username" , $ userName ) ; $ this -> set ( "Password" , $ userPassword ) ; } | Sets smtp authentification parameters . |
36,890 | protected function _sendMail ( ) { $ result = false ; try { $ result = parent :: send ( ) ; } catch ( Exception $ exception ) { $ ex = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException :: class ) ; $ ex -> setMessage ( $ exception -> getMessage ( ) ) ; if ( $ this -> isDebugModeEnabled ( ) ) { throw $ ex ; } else { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> error ( $ ex -> getMessage ( ) , [ $ ex ] ) ; } } return $ result ; } | Sends email via phpmailer . |
36,891 | protected function _processViewArray ( ) { $ smarty = $ this -> _getSmarty ( ) ; $ outputProcessor = oxNew ( \ OxidEsales \ Eshop \ Core \ Output :: class ) ; foreach ( $ this -> _aViewData as $ key => $ value ) { $ smarty -> assign ( $ key , $ value ) ; } $ newSmartyArray = $ outputProcessor -> processViewArray ( $ smarty -> get_template_vars ( ) , "oxemail" ) ; foreach ( $ newSmartyArray as $ key => $ val ) { $ smarty -> assign ( $ key , $ val ) ; } } | Process view data array through oxOutput processor |
36,892 | public function getCharset ( ) { if ( ! $ this -> _sCharSet ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getLang ( ) -> translateString ( "charset" ) ; } else { return $ this -> CharSet ; } } | Get mail charset |
36,893 | public function getOrderFileList ( $ orderId ) { $ orderFileList = oxNew ( OrderFileList :: class ) ; $ orderFileList -> loadOrderFiles ( $ orderId ) ; if ( count ( $ orderFileList ) > 0 ) { return $ orderFileList ; } return false ; } | Get order files |
36,894 | private function idnToAscii ( $ idn ) { if ( function_exists ( 'idn_to_ascii' ) ) { if ( defined ( 'INTL_IDNA_VARIANT_UTS46' ) ) { return idn_to_ascii ( $ idn , 0 , INTL_IDNA_VARIANT_UTS46 ) ; } return idn_to_ascii ( $ idn ) ; } return $ idn ; } | Convert domain name to IDNA ASCII form . |
36,895 | public function findTranslationPath ( $ language , $ admin , $ modulePath ) { $ fullPath = $ this -> getModulesDirectory ( ) . $ modulePath ; if ( $ this -> hasUppercaseApplicationDirectory ( $ fullPath ) ) { $ fullPath .= '/Application' ; } else { if ( $ this -> hasLowercaseApplicationDirectory ( $ fullPath ) ) { $ fullPath .= '/application' ; } } $ fullPath .= ( $ admin ) ? '/views/admin/' : '/translations/' ; $ fullPath .= $ language ; return $ fullPath ; } | Find the full path of the translation in the given module . |
36,896 | public function allowRating ( $ sUserId , $ sType , $ sObjectId ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( $ iRatingLogsTimeout = $ myConfig -> getConfigParam ( 'iRatingLogsTimeout' ) ) { $ sExpDate = date ( 'Y-m-d H:i:s' , \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) - $ iRatingLogsTimeout * 24 * 60 * 60 ) ; $ oDb -> execute ( "delete from oxratings where oxtimestamp < '$sExpDate'" ) ; } $ sSelect = "select oxid from oxratings where oxuserid = " . $ oDb -> quote ( $ sUserId ) . " and oxtype=" . $ oDb -> quote ( $ sType ) . " and oxobjectid = " . $ oDb -> quote ( $ sObjectId ) ; if ( $ oDb -> getOne ( $ sSelect ) ) { return false ; } return true ; } | Checks if user can rate product . |
36,897 | public function getRatingAverage ( $ sObjectId , $ sType , $ aIncludedObjectsIds = null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQuerySnipet = " AND `oxobjectid` = " . $ oDb -> quote ( $ sObjectId ) ; if ( is_array ( $ aIncludedObjectsIds ) && count ( $ aIncludedObjectsIds ) > 0 ) { $ sQuerySnipet = " AND ( `oxobjectid` = " . $ oDb -> quote ( $ sObjectId ) . " OR `oxobjectid` in ('" . implode ( "', '" , $ aIncludedObjectsIds ) . "') )" ; } $ sSelect = " SELECT AVG(`oxrating`) FROM `oxreviews` WHERE `oxrating` > 0 AND `oxtype` = " . $ oDb -> quote ( $ sType ) . $ sQuerySnipet . " LIMIT 1" ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; if ( $ fRating = $ database -> getOne ( $ sSelect ) ) { $ fRating = round ( $ fRating , 1 ) ; } return $ fRating ; } | calculates and return objects rating |
36,898 | public function getRatingCount ( $ sObjectId , $ sType , $ aIncludedObjectsIds = null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQuerySnipet = " AND `oxobjectid` = " . $ oDb -> quote ( $ sObjectId ) ; if ( is_array ( $ aIncludedObjectsIds ) && count ( $ aIncludedObjectsIds ) > 0 ) { $ sQuerySnipet = " AND ( `oxobjectid` = " . $ oDb -> quote ( $ sObjectId ) . " OR `oxobjectid` in ('" . implode ( "', '" , $ aIncludedObjectsIds ) . "') )" ; } $ sSelect = " SELECT COUNT(*) FROM `oxreviews` WHERE `oxrating` > 0 AND `oxtype` = " . $ oDb -> quote ( $ sType ) . $ sQuerySnipet . " LIMIT 1" ; $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ iCount = $ masterDb -> getOne ( $ sSelect ) ; return $ iCount ; } | calculates and return objects rating count |
36,899 | public function setModuleVariable ( $ name , $ value ) { if ( is_null ( $ value ) ) { self :: $ moduleVariables = null ; } else { self :: $ moduleVariables [ $ name ] = $ value ; } $ this -> getFileCache ( ) -> setToCache ( $ name , $ value ) ; } | Sets module information variable . The variable is set statically and is not saved for future . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.