idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
37,900
public function setActionArticle ( ) { $ sArticleId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxarticleid' ) ; $ sActionId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxid' ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ oDb -> Execute ( 'delete from oxobject2action ' . 'where oxactionid=' . $ oDb -> quote ( $ sActionId ) . ' and oxclass = "oxarticle"' ) ; $ oObject2Promotion = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oObject2Promotion -> init ( 'oxobject2action' ) ; $ oObject2Promotion -> oxobject2action__oxactionid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sActionId ) ; $ oObject2Promotion -> oxobject2action__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sArticleId ) ; $ oObject2Promotion -> oxobject2action__oxclass = new \ OxidEsales \ Eshop \ Core \ Field ( "oxarticle" ) ; $ oObject2Promotion -> save ( ) ; }
Set article assignment
37,901
protected function getPdoMysqlConnectionParameters ( array $ connectionParameters ) { $ pdoMysqlConnectionParameters = [ 'driver' => 'pdo_mysql' , 'host' => $ connectionParameters [ 'databaseHost' ] , 'dbname' => $ connectionParameters [ 'databaseName' ] , 'user' => $ connectionParameters [ 'databaseUser' ] , 'password' => $ connectionParameters [ 'databasePassword' ] , 'port' => $ connectionParameters [ 'databasePort' ] , ] ; $ this -> addDriverOptions ( $ pdoMysqlConnectionParameters ) ; $ this -> addConnectionCharset ( $ pdoMysqlConnectionParameters , $ connectionParameters [ 'connectionCharset' ] ) ; return $ pdoMysqlConnectionParameters ; }
Get the connection parameters for the doctrine pdo_mysql driver
37,902
protected function addConnectionCharset ( array & $ existingParameters , $ connectionCharset ) { $ sanitizedCharset = trim ( strtolower ( ( string ) $ connectionCharset ) ) ; if ( ! empty ( $ sanitizedCharset ) ) { $ existingParameters [ 'charset' ] = $ sanitizedCharset ; } }
Determine the charset to be used when connecting to the database .
37,903
public function getOne ( $ query , $ parameters = [ ] ) { $ parameters = $ this -> assureParameterIsAnArray ( $ parameters ) ; if ( $ this -> doesStatementProduceOutput ( $ query ) ) { try { return $ this -> getConnection ( ) -> fetchColumn ( $ query , $ parameters ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } } else { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> warning ( 'Given statement does not produce output and was not executed' , [ debug_backtrace ( ) ] ) ; } return false ; }
Get the first value of the first row of the result set of a given sql SELECT or SHOW statement . Returns false for any other statement .
37,904
public function getRow ( $ query , $ parameters = [ ] ) { $ parameters = $ this -> assureParameterIsAnArray ( $ parameters ) ; try { $ resultSet = $ this -> select ( $ query , $ parameters ) ; $ result = $ resultSet -> fields ; } catch ( \ OxidEsales \ Eshop \ Core \ Exception \ DatabaseErrorException $ exception ) { $ this -> logException ( $ exception ) ; $ result = [ ] ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> logException ( $ exception ) ; $ result = [ ] ; } if ( false == $ result ) { $ result = [ ] ; } return $ result ; }
Get an array with the values of the first row of a given sql SELECT or SHOW statement . Returns an empty array for any other statement . The returned value depends on the fetch mode .
37,905
public function quote ( $ value ) { try { $ result = $ this -> getConnection ( ) -> quote ( $ value ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ result ; }
Quote a string or a numeric value in a way that it might be used as a value in a sql statement . Returns false for values that cannot be quoted .
37,906
public function quoteArray ( $ array ) { $ result = [ ] ; foreach ( $ array as $ key => $ item ) { $ result [ $ key ] = $ this -> quote ( $ item ) ; } return $ result ; }
Quote every value in a given array in a way that it might be used as a value in a sql statement and return the result as a new array . Numeric values will be converted to strings which quotes . The keys and their order of the returned array will be the same as of the input array .
37,907
public function setTransactionIsolationLevel ( $ level ) { $ result = false ; $ availableLevels = array_keys ( $ this -> transactionIsolationLevelMap ) ; if ( ! in_array ( strtoupper ( $ level ) , $ availableLevels ) ) { throw new \ InvalidArgumentException ( ) ; } try { if ( in_array ( strtoupper ( $ level ) , $ availableLevels ) ) { $ result = $ this -> execute ( 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $ level ) ; } } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ result ; }
Set the transaction isolation level . Allowed values READ UNCOMMITTED READ COMMITTED REPEATABLE READ and SERIALIZABLE .
37,908
public function select ( $ query , $ parameters = [ ] ) { $ parameters = $ this -> assureParameterIsAnArray ( $ parameters ) ; $ result = null ; try { $ statement = $ this -> getConnection ( ) -> executeQuery ( $ query , $ parameters ) ; $ result = new \ OxidEsales \ Eshop \ Core \ Database \ Adapter \ Doctrine \ ResultSet ( $ statement ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ result ; }
Return the results of a given sql SELECT or SHOW statement as a ResultSet . Throws an exception for any other statement .
37,909
public function selectLimit ( $ query , $ rowCount = - 1 , $ offset = 0 , $ parameters = [ ] ) { if ( ! is_numeric ( $ rowCount ) || ! is_numeric ( $ offset ) ) { trigger_error ( 'Parameters rowCount and offset have to be numeric in DatabaseInterface::selectLimit(). ' . 'Please fix your code as this error may trigger an exception in future versions of OXID eShop.' , E_USER_DEPRECATED ) ; } if ( 0 > $ offset ) { throw new \ InvalidArgumentException ( 'Argument $offset must not be smaller than zero.' ) ; } $ rowCount = ( int ) $ rowCount ; $ offset = ( int ) $ offset ; $ limitClause = '' ; if ( $ rowCount >= 0 && $ offset >= 0 ) { $ limitClause = "LIMIT $rowCount OFFSET $offset" ; } return $ this -> select ( $ query . " $limitClause " , $ parameters ) ; }
Return the results of a given sql SELECT or SHOW statement limited by a LIMIT clause as a ResultSet . Throws an exception for any other statement .
37,910
public function getCol ( $ query , $ parameters = [ ] ) { $ parameters = $ this -> assureParameterIsAnArray ( $ parameters ) ; $ result = [ ] ; try { $ rows = $ this -> getConnection ( ) -> fetchAll ( $ query , $ parameters ) ; foreach ( $ rows as $ row ) { $ columnNames = array_keys ( $ row ) ; $ columnName = $ columnNames [ 0 ] ; $ result [ ] = $ row [ $ columnName ] ; } } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ result ; }
Return the first column of all rows of the results of a given sql SELECT or SHOW statement as an numeric array . Throws an exception for any other statement .
37,911
private function assureParameterIsAnArray ( $ parameter ) { if ( $ parameter && ! is_array ( $ parameter ) ) { throw new \ InvalidArgumentException ( ) ; } if ( ! is_array ( $ parameter ) ) { $ parameter = [ ] ; } return $ parameter ; }
Sanitize the given parameter to be an array . In v5 . 3 . 0 in many places in the code false is passed instead of an empty array .
37,912
private function doesStatementProduceOutput ( $ query ) { $ allowedCommands = [ 'SELECT' , 'EXECUTE' , 'GET' , 'SHOW' , 'CHECKSUM' , 'DESCRIBE' , 'EXPLAIN' , 'HELP' , ] ; $ command = $ this -> getFirstCommandInStatement ( $ query ) ; return in_array ( $ command , $ allowedCommands ) ; }
Return true if the given SQL statement is a statement that may produce any output .
37,913
protected function logException ( \ Exception $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> error ( $ exception -> getMessage ( ) , [ $ exception ] ) ; }
Log a given Exception the log file using the standard eShop logging mechanism . Use this function whenever a exception is caught and not re - thrown .
37,914
public function getAll ( $ query , $ parameters = [ ] ) { $ result = [ ] ; $ statement = null ; $ parameters = $ this -> assureParameterIsAnArray ( $ parameters ) ; try { $ statement = $ this -> getConnection ( ) -> executeQuery ( $ query , $ parameters ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } if ( $ this -> doesStatementProduceOutput ( $ query ) ) { $ result = $ statement -> fetchAll ( ) ; } else { \ OxidEsales \ Eshop \ Core \ Registry :: getLogger ( ) -> warning ( 'Given statement does not produce output and was not executed' , [ debug_backtrace ( ) ] ) ; } return $ result ; }
Get an multi - dimensional array of arrays with the values of the all rows of a given sql SELECT or SHOW statement . Returns an empty array for any other statement .
37,915
public function getLastInsertId ( ) { try { $ lastInsertId = $ this -> getConnection ( ) -> lastInsertId ( ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ lastInsertId ; }
Return string representing the row ID of the last row that was inserted into the database . Returns 0 for tables without autoincrement field .
37,916
public function isRollbackOnly ( ) { try { $ isRollbackOnly = $ this -> connection -> isRollbackOnly ( ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ isRollbackOnly ; }
Return true if the connection is marked rollbackOnly .
37,917
public function isTransactionActive ( ) { try { $ isTransactionActive = $ this -> connection -> isTransactionActive ( ) ; } catch ( DBALException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } catch ( PDOException $ exception ) { $ exception = $ this -> convertException ( $ exception ) ; $ this -> handleException ( $ exception ) ; } return $ isTransactionActive ; }
Checks whether a transaction is currently active .
37,918
protected function getMetaColumnValueByKey ( array $ column , $ key ) { if ( array_key_exists ( 'Field' , $ column ) ) { $ keyMap = [ 'Field' => 'Field' , 'Type' => 'Type' , 'Null' => 'Null' , 'Key' => 'Key' , 'Default' => 'Default' , 'Extra' => 'Extra' , 'Comment' => 'Comment' , 'CharacterSet' => 'CharacterSet' , 'Collation' => 'Collation' , ] ; } else { $ keyMap = [ 'Field' => 0 , 'Type' => 1 , 'Null' => 2 , 'Key' => 3 , 'Default' => 4 , 'Extra' => 5 , 'Comment' => 6 , 'CharacterSet' => 7 , 'Collation' => 8 , ] ; } $ result = $ column [ $ keyMap [ $ key ] ] ; return $ result ; }
Get the value of a meta column key .
37,919
protected function getColumnMaxLengthAndScale ( array $ column , $ assignedType ) { $ maxLength = - 1 ; $ scale = - 1 ; $ mySqlType = $ this -> getMetaColumnValueByKey ( $ column , 'Type' ) ; if ( preg_match ( "/^(.+)\((\d+),(\d+)/" , $ mySqlType , $ matches ) ) { if ( is_numeric ( $ matches [ 2 ] ) ) { $ maxLength = $ matches [ 2 ] ; } if ( is_numeric ( $ matches [ 3 ] ) ) { $ scale = $ matches [ 3 ] ; } } elseif ( preg_match ( "/^(.+)\((\d+)/" , $ mySqlType , $ matches ) ) { if ( is_numeric ( $ matches [ 2 ] ) ) { $ maxLength = $ matches [ 2 ] ; } } elseif ( preg_match ( "/^(enum|set)\((.*)\)$/i" , strtolower ( $ mySqlType ) , $ matches ) ) { if ( $ matches [ 2 ] ) { $ pieces = explode ( "," , $ matches [ 2 ] ) ; $ maxLength = max ( array_map ( "strlen" , $ pieces ) ) - 2 ; if ( $ maxLength <= 0 ) { $ maxLength = 1 ; } } } $ integerTypes = [ 'INTEGER' , 'INT' , 'SMALLINT' , 'TINYINT' , 'MEDIUMINT' , 'BIGINT' ] ; $ fixedPointTypes = [ 'DECIMAL' , 'NUMERIC' ] ; $ floatingPointTypes = [ 'FLOAT' , 'DOUBLE' ] ; $ textTypes = [ 'CHAR' , 'VARCHAR' ] ; $ dateTypes = [ 'YEAR' ] ; $ assignedType = strtoupper ( $ assignedType ) ; if ( ( in_array ( $ assignedType , $ integerTypes ) || in_array ( $ assignedType , $ fixedPointTypes ) || in_array ( $ assignedType , $ floatingPointTypes ) || in_array ( $ assignedType , $ textTypes ) || in_array ( $ assignedType , $ dateTypes ) ) && - 1 == $ maxLength ) { } return [ ( int ) $ maxLength , ( int ) $ scale ] ; }
Get the maximal length of a given column of a given type .
37,920
protected function getFirstCommandInStatement ( $ query ) { $ sqlComments = '@(([\'"]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms' ; $ uncommentedQuery = preg_replace ( $ sqlComments , '$1' , $ query ) ; $ command = strtoupper ( trim ( explode ( ' ' , trim ( $ uncommentedQuery ) ) [ 0 ] ) ) ; return $ command ; }
This method strips SQL comments and whitespaces to find the first effective SQL command in a giver statement
37,921
protected function ensureConnectionIsEstablished ( $ connection ) { if ( ! $ this -> isConnectionEstablished ( $ connection ) ) { $ message = $ this -> createConnectionErrorMessage ( $ connection ) ; throw new ConnectionException ( $ message ) ; } }
Ensure that the given connection is established successful .
37,922
protected function getConnectionFromDriverManager ( ) { $ configuration = new Configuration ( ) ; $ connectionParameters = $ this -> getConnectionParameters ( ) ; return DriverManager :: getConnection ( $ connectionParameters , $ configuration ) ; }
Get the connection from the Doctrine DBAL DriverManager .
37,923
protected function createConnectionErrorMessage ( $ connection ) { $ message = 'Not connected to database. dsn: ' . $ connection -> getDriver ( ) -> getName ( ) . '://' . '****:****@' . $ connection -> getHost ( ) . ':' . $ connection -> getPort ( ) . '/' . $ connection -> getDatabase ( ) ; return $ message ; }
Create the message we want to throw if there was a connection error .
37,924
public function send ( ) { $ contactFormBridge = $ this -> getContainer ( ) -> get ( ContactFormBridgeInterface :: class ) ; $ form = $ contactFormBridge -> getContactForm ( ) ; $ form -> handleRequest ( $ this -> getMappedContactFormRequest ( ) ) ; if ( $ form -> isValid ( ) ) { $ this -> sendContactMail ( $ form -> email -> getValue ( ) , $ form -> subject -> getValue ( ) , $ contactFormBridge -> getContactFormMessage ( $ form ) ) ; } else { foreach ( $ form -> getErrors ( ) as $ error ) { Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ error ) ; } return false ; } }
Composes and sends user written message returns false if some parameters are missing .
37,925
public function getUserData ( ) { if ( $ this -> _oUserData === null ) { $ this -> _oUserData = Registry :: getConfig ( ) -> getRequestParameter ( 'editval' ) ; } return $ this -> _oUserData ; }
Template variable getter . Returns entered user data
37,926
public function getContactSubject ( ) { if ( $ this -> _sContactSubject === null ) { $ this -> _sContactSubject = Registry :: getConfig ( ) -> getRequestParameter ( 'c_subject' ) ; } return $ this -> _sContactSubject ; }
Template variable getter . Returns entered contact subject
37,927
public function getContactMessage ( ) { if ( $ this -> _sContactMessage === null ) { $ this -> _sContactMessage = Registry :: getConfig ( ) -> getRequestParameter ( 'c_message' ) ; } return $ this -> _sContactMessage ; }
Template variable getter . Returns entered message
37,928
private function sendContactMail ( $ email , $ subject , $ message ) { $ mailer = oxNew ( Email :: class ) ; if ( $ mailer -> sendContactMail ( $ email , $ subject , $ message ) ) { $ this -> _blContactSendStatus = 1 ; } else { Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'ERROR_MESSAGE_CHECK_EMAIL' ) ; } }
Send a contact mail .
37,929
protected function _getFilterSelect ( $ sShipSetId , $ dPrice , $ oUser ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sBoni = ( $ oUser && $ oUser -> oxuser__oxboni -> value ) ? $ oUser -> oxuser__oxboni -> value : 0 ; $ sTable = getViewName ( 'oxpayments' ) ; $ sQ = "select {$sTable}.* from ( select distinct {$sTable}.* from {$sTable} " ; $ sQ .= "left join oxobject2group ON oxobject2group.oxobjectid = {$sTable}.oxid " ; $ sQ .= "inner join oxobject2payment ON oxobject2payment.oxobjectid = " . $ oDb -> quote ( $ sShipSetId ) . " and oxobject2payment.oxpaymentid = {$sTable}.oxid " ; $ sQ .= "where {$sTable}.oxactive='1' " ; $ sQ .= " and {$sTable}.oxfromboni <= " . $ oDb -> quote ( $ sBoni ) . " and {$sTable}.oxfromamount <= " . $ oDb -> quote ( $ dPrice ) . " and {$sTable}.oxtoamount >= " . $ oDb -> quote ( $ dPrice ) ; $ sGroupIds = '' ; $ sCountryId = $ this -> getCountryId ( $ oUser ) ; if ( $ oUser ) { foreach ( $ oUser -> getUserGroups ( ) as $ oGroup ) { if ( $ sGroupIds ) { $ sGroupIds .= ', ' ; } $ sGroupIds .= "'" . $ oGroup -> getId ( ) . "'" ; } } $ sGroupTable = getViewName ( 'oxgroups' ) ; $ sCountryTable = getViewName ( 'oxcountry' ) ; $ sCountrySql = $ sCountryId ? "exists( select 1 from oxobject2payment as s1 where s1.oxpaymentid={$sTable}.OXID and s1.oxtype='oxcountry' and s1.OXOBJECTID=" . $ oDb -> quote ( $ sCountryId ) . " limit 1 )" : '0' ; $ sGroupSql = $ sGroupIds ? "exists( select 1 from oxobject2group as s3 where s3.OXOBJECTID={$sTable}.OXID and s3.OXGROUPSID in ( {$sGroupIds} ) limit 1 )" : '0' ; $ sQ .= " order by {$sTable}.oxsort asc ) as $sTable where ( select if( exists( select 1 from oxobject2payment as ss1, $sCountryTable where $sCountryTable.oxid=ss1.oxobjectid and ss1.oxpaymentid={$sTable}.OXID and ss1.oxtype='oxcountry' limit 1 ), {$sCountrySql}, 1) && if( exists( select 1 from oxobject2group as ss3, $sGroupTable where $sGroupTable.oxid=ss3.oxgroupsid and ss3.OXOBJECTID={$sTable}.OXID limit 1 ), {$sGroupSql}, 1) ) order by {$sTable}.oxsort asc " ; return $ sQ ; }
Creates payment list filter SQL to load current state payment list
37,930
public function getCountryId ( $ oUser ) { $ sCountryId = null ; if ( $ oUser ) { $ sCountryId = $ oUser -> getActiveCountry ( ) ; } if ( ! $ sCountryId ) { $ sCountryId = $ this -> _sHomeCountry ; } return $ sCountryId ; }
Returns user country id for for payment selection
37,931
public function getPaymentList ( $ sShipSetId , $ dPrice , $ oUser = null ) { $ this -> selectString ( $ this -> _getFilterSelect ( $ sShipSetId , $ dPrice , $ oUser ) ) ; return $ this -> _aArray ; }
Loads and returns list of user payments .
37,932
public function loadRDFaPaymentList ( $ dPrice = null ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ sTable = getViewName ( 'oxpayments' ) ; $ sQ = "select $sTable.*, oxobject2payment.oxobjectid from $sTable left join (select oxobject2payment.* from oxobject2payment where oxobject2payment.oxtype = 'rdfapayment') as oxobject2payment on oxobject2payment.oxpaymentid=$sTable.oxid " ; $ sQ .= "where $sTable.oxactive = 1 " ; if ( $ dPrice !== null ) { $ sQ .= "and $sTable.oxfromamount <= " . $ oDb -> quote ( $ dPrice ) . " and $sTable.oxtoamount >= " . $ oDb -> quote ( $ dPrice ) ; } $ rs = $ oDb -> select ( $ sQ ) ; if ( $ rs != false && $ rs -> count ( ) > 0 ) { $ oSaved = clone $ this -> getBaseObject ( ) ; while ( ! $ rs -> EOF ) { $ oListObject = clone $ oSaved ; $ this -> _assignElement ( $ oListObject , $ rs -> fields ) ; $ this -> _aArray [ ] = $ oListObject ; $ rs -> fetchRow ( ) ; } } }
Loads payments mapped to a predefined GoodRelations payment method .
37,933
public function removeCatOrderArticle ( ) { $ aRemoveArt = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'oxid' ) ; $ aSkipArt = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'neworder_sess' ) ; if ( is_array ( $ aRemoveArt ) && is_array ( $ aSkipArt ) ) { foreach ( $ aRemoveArt as $ sRem ) { if ( ( $ iKey = array_search ( $ sRem , $ aSkipArt ) ) !== false ) { unset ( $ aSkipArt [ $ iKey ] ) ; } } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'neworder_sess' , $ aSkipArt ) ; $ sArticleTable = $ this -> _getViewName ( 'oxarticles' ) ; $ sO2CView = $ this -> _getViewName ( 'oxobject2category' ) ; $ sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid " ; $ sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid " ; $ sSelect .= "not in ( " . implode ( ", " , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aSkipArt ) ) . " ) " ; echo ( int ) \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sSelect ) ; } }
Removes article from list for sorting in category
37,934
public function addCatOrderArticle ( ) { $ aAddArticle = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; $ aOrdArt = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'neworder_sess' ) ; if ( ! is_array ( $ aOrdArt ) ) { $ aOrdArt = [ ] ; } if ( is_array ( $ aAddArticle ) ) { foreach ( $ aAddArticle as $ sAdd ) { if ( array_search ( $ sAdd , $ aOrdArt ) === false ) { $ aOrdArt [ ] = $ sAdd ; } } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'neworder_sess' , $ aOrdArt ) ; $ sArticleTable = $ this -> _getViewName ( 'oxarticles' ) ; $ sO2CView = $ this -> _getViewName ( 'oxobject2category' ) ; $ sSelect = "select 1 from $sArticleTable left join $sO2CView on $sArticleTable.oxid=$sO2CView.oxobjectid " ; $ sSelect .= "where $sO2CView.oxcatnid = '$soxId' and $sArticleTable.oxparentid = '' and $sArticleTable.oxid " ; $ sSelect .= "not in ( " . implode ( ", " , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aOrdArt ) ) . " ) " ; echo ( int ) \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sSelect ) ; } }
Adds article to list for sorting in category
37,935
public function saveNewOrder ( ) { $ oCategory = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; $ sId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( "oxid" ) ; if ( $ oCategory -> load ( $ sId ) ) { if ( $ oCategory -> isDerived ( ) ) { return ; } $ this -> resetContentCache ( ) ; $ aNewOrder = \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "neworder_sess" ) ; if ( is_array ( $ aNewOrder ) && count ( $ aNewOrder ) ) { $ sO2CView = $ this -> _getViewName ( 'oxobject2category' ) ; $ sSelect = "select * from $sO2CView where $sO2CView.oxcatnid='" . $ oCategory -> getId ( ) . "' and $sO2CView.oxobjectid in (" . implode ( ", " , \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quoteArray ( $ aNewOrder ) ) . " )" ; $ oList = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ ListModel :: class ) ; $ oList -> init ( "oxbase" , "oxobject2category" ) ; $ oList -> selectString ( $ sSelect ) ; foreach ( $ oList as $ oObj ) { if ( ( $ iNewPos = array_search ( $ oObj -> oxobject2category__oxobjectid -> value , $ aNewOrder ) ) !== false ) { $ oObj -> oxobject2category__oxpos -> setValue ( $ iNewPos ) ; $ oObj -> save ( ) ; } } \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'neworder_sess' , null ) ; } $ this -> onCategoryChange ( $ sId ) ; } }
Saves category articles ordering .
37,936
protected function _isValidType ( $ type , $ number ) { if ( isset ( $ this -> _aCardsInfo [ $ type ] ) ) { return preg_match ( $ this -> _aCardsInfo [ $ type ] , $ number ) ; } return true ; }
Checks credit card type . Returns TRUE if card is valid
37,937
protected function _isExpired ( $ date ) { if ( $ date ) { $ years = substr ( $ date , 2 , 2 ) ; $ month = substr ( $ date , 0 , 2 ) ; $ day = date ( "t" , mktime ( 11 , 59 , 59 , $ month , 1 , $ years ) ) ; $ expDate = mktime ( 23 , 59 , 59 , $ month , $ day , $ years ) ; if ( time ( ) > $ expDate ) { return true ; } } return false ; }
Checks credit card expiration date . Returns TRUE if card is not expired
37,938
protected function _isValidNumer ( $ number ) { $ valid = false ; if ( ( $ length = strlen ( $ number ) ) ) { $ modSum = 0 ; $ mod = $ length % 2 ; for ( $ pos = 0 ; $ pos < $ length ; $ pos ++ ) { $ currDigit = ( int ) $ number { $ pos } ; $ addValue = ( ( $ pos % 2 == $ mod ) ? 2 : 1 ) * $ currDigit ; $ modSum += ( $ addValue > 9 ) ? $ addValue - 9 : $ addValue ; } $ valid = ( $ modSum % 10 ) == 0 ; } return $ valid ; }
checks credit card number . Returns TRUE if card number is valid
37,939
public function isValidCard ( $ number , $ type = "" , $ date = "" ) { $ number = preg_replace ( "/[^0-9]/" , "" , $ number ) ; return ( ! $ this -> _isExpired ( $ date ) && $ this -> _isValidType ( $ type , $ number ) && $ this -> _isValidNumer ( $ number ) ) ; }
Checks if provided credit card information is valid . Returns TRUE if valid
37,940
public function getShowNoRegOption ( ) { if ( $ this -> _blShowNoRegOpt === null ) { $ this -> _blShowNoRegOpt = ! \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blOrderDisWithoutReg' ) ; } return $ this -> _blShowNoRegOpt ; }
Template variable getter . Returns reverse option blOrderDisWithoutReg
37,941
public function getLoginOption ( ) { if ( $ this -> _iOption === null ) { $ option = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'option' ) ; if ( $ option == 2 && ! $ this -> getUser ( ) ) { $ option = 0 ; } $ this -> _iOption = $ option ; } return $ this -> _iOption ; }
Template variable getter . Returns user login option
37,942
public function isNewsSubscribed ( ) { if ( $ this -> _blNewsSubscribed === null ) { if ( ( $ isSubscribedToNews = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'blnewssubscribed' ) ) === null ) { $ isSubscribedToNews = false ; } if ( ( $ user = $ this -> getUser ( ) ) ) { $ isSubscribedToNews = $ user -> getNewsSubscription ( ) -> getOptInStatus ( ) ; } $ this -> _blNewsSubscribed = $ isSubscribedToNews ; } if ( is_null ( $ this -> _blNewsSubscribed ) ) { $ this -> _blNewsSubscribed = false ; } return $ this -> _blNewsSubscribed ; }
Template variable getter . Returns if user subscribed for newsletter
37,943
public function isDownloadableProductWarning ( ) { $ basket = $ this -> getSession ( ) -> getBasket ( ) ; if ( $ basket && \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( "blEnableDownloads" ) ) { if ( $ basket -> hasDownloadableProducts ( ) ) { return true ; } } return false ; }
Returns warning message if user want to buy downloadable product without registration .
37,944
protected function _getModuleForConfigVars ( ) { if ( $ this -> _sTheme === null ) { $ this -> _sTheme = $ this -> getEditObjectId ( ) ; } return \ OxidEsales \ Eshop \ Core \ Config :: OXMODULE_THEME_PREFIX . $ this -> _sTheme ; }
return theme filter for config variables
37,945
protected function _loadArticles ( $ oVendor ) { $ sVendorId = $ oVendor -> getId ( ) ; $ iNrOfCatArticles = ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'iNrofCatArticles' ) ; $ iNrOfCatArticles = $ iNrOfCatArticles ? $ iNrOfCatArticles : 1 ; $ oArtList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ ArticleList :: class ) ; $ oArtList -> setSqlLimit ( $ iNrOfCatArticles * $ this -> _getRequestPageNr ( ) , $ iNrOfCatArticles ) ; $ oArtList -> setCustomSorting ( $ this -> getSortingSql ( $ this -> getSortIdent ( ) ) ) ; $ this -> _iAllArtCnt = $ oArtList -> loadVendorArticles ( $ sVendorId , $ oVendor ) ; $ this -> _iCntPages = ceil ( $ this -> _iAllArtCnt / $ iNrOfCatArticles ) ; return [ $ oArtList , $ this -> _iAllArtCnt ] ; }
Loads and returns article list of active vendor .
37,946
public function hasVisibleSubCats ( ) { if ( $ this -> _blVisibleSubCats === null ) { $ this -> _blVisibleSubCats = false ; if ( ( $ this -> _getVendorId ( ) && $ oVendorTree = $ this -> getVendorTree ( ) ) ) { if ( ( $ oVendor = $ this -> getActVendor ( ) ) ) { if ( $ oVendor -> getId ( ) == 'root' ) { $ this -> _blVisibleSubCats = $ oVendorTree -> count ( ) ; $ this -> _oSubCatList = $ oVendorTree ; } } } } return $ this -> _blVisibleSubCats ; }
Returns if vendor has visible sub - cats and load them .
37,947
public function getSubCatList ( ) { if ( $ this -> _oSubCatList === null ) { $ this -> _oSubCatList = [ ] ; if ( $ this -> hasVisibleSubCats ( ) ) { return $ this -> _oSubCatList ; } } return $ this -> _oSubCatList ; }
Returns vendor subcategories
37,948
public function getArticleList ( ) { if ( $ this -> _aArticleList === null ) { $ this -> _aArticleList = [ ] ; if ( ( $ oVendor = $ this -> getActVendor ( ) ) && ( $ oVendor -> getId ( ) != 'root' ) ) { list ( $ aArticleList , $ iAllArtCnt ) = $ this -> _loadArticles ( $ oVendor ) ; if ( $ iAllArtCnt ) { $ this -> _aArticleList = $ aArticleList ; } } } return $ this -> _aArticleList ; }
Get vendor article list
37,949
public function getTitle ( ) { if ( $ this -> _sCatTitle === null ) { $ this -> _sCatTitle = '' ; if ( $ oVendor = $ this -> getActVendor ( ) ) { $ this -> _sCatTitle = $ oVendor -> oxvendor__oxtitle -> value ; } } return $ this -> _sCatTitle ; }
Return vendor title
37,950
public function getActiveCategory ( ) { if ( $ this -> _oActCategory === null ) { $ this -> _oActCategory = false ; if ( ( $ this -> _getVendorId ( ) && $ oVendorTree = $ this -> getVendorTree ( ) ) ) { if ( $ oVendor = $ this -> getActVendor ( ) ) { $ this -> _oActCategory = $ oVendor ; } } } return $ this -> _oActCategory ; }
Template variable getter . Returns active vendor
37,951
public function getVendorTree ( ) { if ( $ this -> _getVendorId ( ) && $ this -> _oVendorTree === null ) { $ oVendorTree = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ VendorList :: class ) ; $ oVendorTree -> buildVendorTree ( 'vendorlist' , $ this -> getActVendor ( ) -> getId ( ) , \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopHomeUrl ( ) ) ; $ this -> _oVendorTree = $ oVendorTree ; } return $ this -> _oVendorTree ; }
Returns vendor tree
37,952
public function oxClone ( $ object ) { $ classVariables = get_object_vars ( $ object ) ; foreach ( $ classVariables as $ name => $ value ) { if ( is_object ( $ object -> $ name ) ) { $ this -> $ name = clone $ object -> $ name ; } else { $ this -> $ name = $ object -> $ name ; } } }
Clone this object - similar to Copy Constructor .
37,953
protected function _setUpdateSeoOnFieldChange ( $ fieldName ) { if ( $ this -> getId ( ) && in_array ( $ fieldName , $ this -> getFieldNames ( ) ) ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ tableName = $ this -> getCoreTableName ( ) ; $ quotedOxid = $ database -> quote ( $ this -> getId ( ) ) ; $ title = $ database -> getOne ( "select `{$fieldName}` from `{$tableName}` where `oxid` = {$quotedOxid}" ) ; $ fieldValue = "{$tableName}__{$fieldName}" ; $ currentTime = $ this -> $ fieldValue -> value ; if ( $ title == $ currentTime ) { $ this -> setUpdateSeo ( false ) ; } } }
Checks whether certain field has changed and sets update seo flag if needed . It can only set the value to false so it allows for multiple calls to the method and if atleast one requires seo update other checks won t override that .
37,954
public function init ( $ tableName = null , $ forceAllFields = false ) { if ( $ tableName ) { $ this -> _sCoreTable = $ tableName ; } $ this -> _sViewTable = false ; if ( count ( $ this -> _aFieldNames ) <= 1 ) { $ this -> _initDataStructure ( $ forceAllFields ) ; } }
Sets the names to main and view tables loads metadata of each table .
37,955
public function assign ( $ dbRecord ) { if ( ! is_array ( $ dbRecord ) ) { return ; } foreach ( $ dbRecord as $ name => $ value ) { $ this -> _setFieldData ( $ name , $ value ) ; } $ oxidField = $ this -> _getFieldLongName ( 'oxid' ) ; if ( $ this -> $ oxidField instanceof Field ) { $ this -> _sOXID = $ this -> $ oxidField -> value ; } }
Assigns DB field values to object fields . Returns true on success .
37,956
public function setId ( $ oxid = null ) { if ( $ oxid ) { $ this -> _sOXID = $ oxid ; } else { if ( $ this -> getCoreTableName ( ) == 'oxobject2category' ) { $ objectId = $ this -> oxobject2category__oxobjectid ; $ categoryId = $ this -> oxobject2category__oxcatnid ; $ shopID = $ this -> oxobject2category__oxshopid ; $ this -> _sOXID = md5 ( $ objectId . $ categoryId . $ shopID ) ; } else { $ this -> _sOXID = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) -> generateUID ( ) ; } } $ idFieldName = $ this -> getCoreTableName ( ) . '__oxid' ; $ this -> $ idFieldName = new Field ( $ this -> _sOXID , Field :: T_RAW ) ; return $ this -> _sOXID ; }
Sets unique object id
37,957
public function assignRecord ( $ select ) { $ record = $ this -> getRecordByQuery ( $ select ) ; if ( $ record != false && $ record -> count ( ) > 0 ) { $ this -> assign ( $ record -> fields ) ; return true ; } return false ; }
Performs SQL query assigns record field values to object . Returns true on success .
37,958
public function getSelectFields ( $ forceCoreTableUsage = null ) { $ selectFields = [ ] ; $ viewName = $ this -> getViewName ( $ forceCoreTableUsage ) ; foreach ( $ this -> _aFieldNames as $ key => $ field ) { if ( $ viewName ) { $ selectFields [ ] = "`$viewName`.`$key`" ; } else { $ selectFields [ ] = ".`$key`" ; } } return implode ( ', ' , $ selectFields ) ; }
Function builds the field list used in select .
37,959
public function exists ( $ oxid = null ) { if ( ! $ oxid ) { $ oxid = $ this -> getId ( ) ; } if ( ! $ oxid ) { return false ; } $ viewName = $ this -> getCoreTableName ( ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ query = "select {$this->_sExistKey} from {$viewName} where {$this->_sExistKey} = " . $ database -> quote ( $ oxid ) ; return ( bool ) $ database -> getOne ( $ query ) ; }
Checks if this object exists returns true on success .
37,960
protected function _addField ( $ fieldName , $ fieldStatus , $ type = null , $ length = null ) { $ fieldName = strtolower ( $ fieldName ) ; $ this -> _aFieldNames [ $ fieldName ] = $ fieldStatus ; $ fieldLongName = $ this -> _getFieldLongName ( $ fieldName ) ; if ( $ this -> isPropertyLoaded ( $ fieldLongName ) ) { return ; } $ field = false ; if ( isset ( $ type ) ) { $ field = new Field ( ) ; $ field -> fldtype = $ type ; $ this -> _blIsSimplyClonable = false ; } if ( isset ( $ length ) ) { if ( ! $ field ) { $ field = new Field ( ) ; } $ field -> fldmax_length = $ length ; $ this -> _blIsSimplyClonable = false ; } $ this -> $ fieldLongName = $ field ; }
Adds additional field to meta structure
37,961
protected function _canFieldBeNull ( $ fieldName ) { $ metaData = $ this -> _getAllFields ( ) ; foreach ( $ metaData as $ metaInfo ) { if ( strcasecmp ( $ metaInfo -> name , $ fieldName ) == 0 ) { return ! $ metaInfo -> not_null ; } } return false ; }
check if db field can be null
37,962
protected function _getFieldDefaultValue ( $ fieldName ) { $ metaData = $ this -> _getAllFields ( ) ; foreach ( $ metaData as $ metaInfo ) { if ( strcasecmp ( $ metaInfo -> name , $ fieldName ) == 0 ) { return property_exists ( $ metaInfo , 'default_value' ) ? $ metaInfo -> default_value : null ; } } return false ; }
returns default field value
37,963
protected function _getUpdateFieldValue ( $ fieldName , $ field ) { $ fieldValue = null ; if ( $ field instanceof Field ) { $ fieldValue = $ field -> getRawValue ( ) ; } elseif ( isset ( $ field -> value ) ) { $ fieldValue = $ field -> value ; } $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; if ( ( null === $ fieldValue ) ) { if ( $ this -> _canFieldBeNull ( $ fieldName ) ) { return 'null' ; } elseif ( $ fieldValue = $ this -> _getFieldDefaultValue ( $ fieldName ) ) { return $ database -> quote ( $ fieldValue ) ; } } return $ database -> quote ( $ fieldValue ) ; }
returns quoted field value for using in update statement
37,964
protected function _update ( ) { if ( ! $ this -> allowDerivedUpdate ( ) ) { return false ; } if ( ! $ this -> getId ( ) ) { $ exception = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ ObjectException :: class ) ; $ exception -> setMessage ( 'EXCEPTION_OBJECT_OXIDNOTSET' ) ; $ exception -> setObject ( $ this ) ; throw $ exception ; } $ coreTableName = $ this -> getCoreTableName ( ) ; $ idKey = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> getArrFldName ( $ coreTableName . '.oxid' ) ; $ this -> $ idKey = new Field ( $ this -> getId ( ) , Field :: T_RAW ) ; $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ updateQuery = "update {$coreTableName} set " . $ this -> _getUpdateFields ( ) . " where {$coreTableName}.oxid = " . $ database -> quote ( $ this -> getId ( ) ) ; $ this -> beforeUpdate ( ) ; $ this -> executeDatabaseQuery ( $ updateQuery ) ; return true ; }
Update this Object into the database this function only works on the main table it will not save any dependent tables which might be loaded through oxList .
37,965
protected function _insert ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ myUtils = \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) ; if ( ! $ this -> getId ( ) ) { $ this -> setId ( ) ; } $ idKey = $ myUtils -> getArrFldName ( $ this -> getCoreTableName ( ) . '.oxid' ) ; $ this -> $ idKey = new Field ( $ this -> getId ( ) , Field :: T_RAW ) ; $ insertSql = "Insert into {$this->getCoreTableName()} set " ; $ shopIdField = $ myUtils -> getArrFldName ( $ this -> getCoreTableName ( ) . '.oxshopid' ) ; if ( $ this -> isPropertyLoaded ( $ shopIdField ) && ( ! $ this -> isPropertyField ( $ shopIdField ) || ! $ this -> $ shopIdField -> value ) ) { $ this -> $ shopIdField = new Field ( $ myConfig -> getShopId ( ) , Field :: T_RAW ) ; } $ insertSql .= $ this -> _getUpdateFields ( $ this -> getUseSkipSaveFields ( ) ) ; return $ result = ( bool ) $ this -> executeDatabaseQuery ( $ insertSql ) ; }
Insert this Object into the database this function only works on the main table it will not save any dependent tables which might be loaded through oxlist .
37,966
protected function _isDisabledFieldCache ( ) { $ class = get_class ( $ this ) ; if ( isset ( self :: $ _blDisableFieldCaching [ $ class ] ) && self :: $ _blDisableFieldCaching [ $ class ] ) { return true ; } return false ; }
Checks if current class disables field caching . This method is primary used in unit tests .
37,967
public function getFieldNames ( ) { $ fieldNames = $ this -> _aFieldNames ; if ( ! $ this -> isAdmin ( ) && $ this -> _blUseLazyLoading ) { $ fieldNames = $ this -> _getNonCachedFieldNames ( true ) ; } return array_keys ( $ fieldNames ) ; }
Returns array with object field names
37,968
public function addSnippet ( $ script , $ isDynamic = false ) { $ config = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ suffix = $ isDynamic ? '_dynamic' : '' ; $ scriptsParameterName = static :: SNIPPETS_PARAMETER_NAME . $ suffix ; $ scripts = ( array ) $ config -> getGlobalParameter ( $ scriptsParameterName ) ; $ script = trim ( $ script ) ; if ( ! in_array ( $ script , $ scripts ) ) { $ scripts [ ] = $ script ; } $ config -> setGlobalParameter ( $ scriptsParameterName , $ scripts ) ; }
Register JavaScript code snippet for rendering .
37,969
protected function getCacheFileName ( $ key ) { $ name = strtolower ( basename ( $ key ) ) ; $ shopId = strtolower ( basename ( $ this -> getShopIdCalculator ( ) -> getShopId ( ) ) ) ; return parent :: CACHE_FILE_PREFIX . ".$shopId.$name.txt" ; }
Returns shopId which should be used for cache file name generation .
37,970
public function addPayToSet ( ) { $ aChosenSets = $ this -> _getActionIds ( 'oxpayments.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sPayTable = $ this -> _getViewName ( 'oxpayments' ) ; $ aChosenSets = $ this -> _getAll ( $ this -> _addFilter ( "select $sPayTable.oxid " . $ this -> _getQuery ( ) ) ) ; } if ( $ soxId && $ soxId != "-1" && is_array ( $ aChosenSets ) ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; foreach ( $ aChosenSets as $ sChosenSet ) { $ sID = $ database -> getOne ( "select oxid from oxobject2payment where oxpaymentid = " . $ database -> quote ( $ sChosenSet ) . " and oxobjectid = " . $ database -> quote ( $ soxId ) . " and oxtype = 'oxdelset'" ) ; if ( ! isset ( $ sID ) || ! $ sID ) { $ oObject = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oObject -> init ( 'oxobject2payment' ) ; $ oObject -> oxobject2payment__oxpaymentid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenSet ) ; $ oObject -> oxobject2payment__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oObject -> oxobject2payment__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxdelset" ) ; $ oObject -> save ( ) ; } } } }
Adds this payments to this set
37,971
public function addUserToSet ( ) { $ aChosenUsr = $ this -> _getActionIds ( 'oxuser.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> 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 ) { $ oObject2Delivery = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oObject2Delivery -> init ( 'oxobject2delivery' ) ; $ oObject2Delivery -> oxobject2delivery__oxdeliveryid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oObject2Delivery -> oxobject2delivery__oxobjectid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sChosenUsr ) ; $ oObject2Delivery -> oxobject2delivery__oxtype = new \ OxidEsales \ Eshop \ Core \ Field ( "oxdelsetu" ) ; $ oObject2Delivery -> save ( ) ; } } }
Adds users for delivery sets config
37,972
public function load ( $ sOXID ) { $ aData = $ this -> _loadFromDb ( $ sOXID ) ; if ( $ aData ) { $ this -> assign ( $ aData ) ; $ this -> _isLoaded = true ; return true ; } return false ; }
Load category data
37,973
public function assign ( $ dbRecord ) { $ this -> _iNrOfArticles = null ; $ this -> _aSeoUrls = [ ] ; return parent :: assign ( $ dbRecord ) ; }
Loads and assigns object data from DB .
37,974
public function delete ( $ sOXID = null ) { if ( ! $ this -> getId ( ) ) { $ this -> load ( $ sOXID ) ; } $ sOXID = isset ( $ sOXID ) ? $ sOXID : $ this -> getId ( ) ; $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ blRet = false ; if ( $ this -> oxcategories__oxright -> value == ( $ this -> oxcategories__oxleft -> value + 1 ) ) { $ myUtilsPic = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsPic ( ) ; $ sDir = $ myConfig -> getPictureDir ( false ) ; $ myUtilsPic -> safePictureDelete ( $ this -> oxcategories__oxthumb -> value , $ sDir . \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> getImageDirByType ( 'TC' ) , 'oxcategories' , 'oxthumb' ) ; $ myUtilsPic -> safePictureDelete ( $ this -> oxcategories__oxicon -> value , $ sDir . \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> getImageDirByType ( 'CICO' ) , 'oxcategories' , 'oxicon' ) ; $ myUtilsPic -> safePictureDelete ( $ this -> oxcategories__oxpromoicon -> value , $ sDir . \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsFile ( ) -> getImageDirByType ( 'PICO' ) , 'oxcategories' , 'oxpromoicon' ) ; $ sAdd = " and oxshopid = '" . $ this -> getShopId ( ) . "' " ; $ oDb -> execute ( "UPDATE oxcategories SET OXLEFT = OXLEFT - 2 WHERE OXROOTID = " . $ oDb -> quote ( $ this -> oxcategories__oxrootid -> value ) . " AND OXLEFT > " . ( ( int ) $ this -> oxcategories__oxleft -> value ) . $ sAdd ) ; $ oDb -> execute ( "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2 WHERE OXROOTID = " . $ oDb -> quote ( $ this -> oxcategories__oxrootid -> value ) . " AND OXRIGHT > " . ( ( int ) $ this -> oxcategories__oxright -> value ) . $ sAdd ) ; $ blRet = parent :: delete ( $ sOXID ) ; $ sOxidQuoted = $ oDb -> quote ( $ sOXID ) ; $ oDb -> execute ( "delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted " ) ; $ oDb -> execute ( "delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted " ) ; $ oDb -> execute ( "delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted " ) ; $ oDb -> execute ( "delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted " ) ; \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ SeoEncoderCategory :: class ) -> onDeleteCategory ( $ this ) ; } return $ blRet ; }
Delete empty categories returns true on success .
37,975
public function setSubCats ( $ aCats ) { $ this -> _aSubCats = $ aCats ; foreach ( $ aCats as $ oCat ) { $ oCat -> setParentCategory ( $ this ) ; if ( $ oCat -> getIsVisible ( ) ) { $ this -> setHasVisibleSubCats ( true ) ; } } }
Sets an array of sub categories also handles parent hasVisibleSubCats
37,976
public function setSubCat ( $ oCat , $ sKey = null ) { if ( $ sKey ) { $ this -> _aSubCats [ $ sKey ] = $ oCat ; } else { $ this -> _aSubCats [ ] = $ oCat ; } $ oCat -> setParentCategory ( $ this ) ; if ( $ oCat -> getIsVisible ( ) ) { $ this -> setHasVisibleSubCats ( true ) ; } }
sets a single category handles sorting and parent hasVisibleSubCats
37,977
public function setContentCat ( $ oContent , $ sKey = null ) { if ( $ sKey ) { $ this -> _aContentCats [ $ sKey ] = $ oContent ; } else { $ this -> _aContentCats [ ] = $ oContent ; } }
sets a single category
37,978
public function getNrOfArticles ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; if ( ! isset ( $ this -> _iNrOfArticles ) && ! $ this -> isAdmin ( ) && ( $ myConfig -> getConfigParam ( 'bl_perfShowActionCatArticleCnt' ) || $ myConfig -> getConfigParam ( 'blDontShowEmptyCategories' ) ) ) { if ( $ this -> isPriceCategory ( ) ) { $ this -> _iNrOfArticles = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsCount ( ) -> getPriceCatArticleCount ( $ this -> getId ( ) , $ this -> oxcategories__oxpricefrom -> value , $ this -> oxcategories__oxpriceto -> value ) ; } else { $ this -> _iNrOfArticles = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsCount ( ) -> getCatArticleCount ( $ this -> getId ( ) ) ; } } return ( int ) $ this -> _iNrOfArticles ; }
returns number or articles in category
37,979
public function getIsVisible ( ) { if ( ! isset ( $ this -> _blIsVisible ) ) { if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'blDontShowEmptyCategories' ) ) { $ blEmpty = ( $ this -> getNrOfArticles ( ) < 1 ) && ! $ this -> getHasVisibleSubCats ( ) ; } else { $ blEmpty = false ; } $ this -> _blIsVisible = ! ( $ blEmpty || $ this -> oxcategories__oxhidden -> value ) ; } return $ this -> _blIsVisible ; }
returns the visibility of a category handles hidden and empty categories
37,980
public function getPictureUrl ( ) { if ( $ this -> _sDynImageDir === null ) { $ sThisShop = $ this -> oxcategories__oxshopid -> value ; $ this -> _sDynImageDir = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getPictureUrl ( null , false , null , null , $ sThisShop ) ; } return $ this -> _sDynImageDir ; }
Returns dyn image dir
37,981
public function getBaseSeoLink ( $ iLang , $ iPage = 0 ) { $ oEncoder = \ OxidEsales \ Eshop \ Core \ Registry :: get ( \ OxidEsales \ Eshop \ Application \ Model \ SeoEncoderCategory :: class ) ; if ( ! $ iPage ) { return $ oEncoder -> getCategoryUrl ( $ this , $ iLang ) ; } return $ oEncoder -> getCategoryPageUrl ( $ this , $ iPage , $ iLang ) ; }
Returns raw category seo url
37,982
public function setLink ( $ sLink ) { $ iLang = $ this -> getLanguage ( ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> seoIsActive ( ) ) { $ this -> _aSeoUrls [ $ iLang ] = $ sLink ; } else { $ this -> _aStdUrls [ $ iLang ] = $ sLink ; } }
sets the url of the category
37,983
public function getStdLink ( $ iLang = null , $ aParams = [ ] ) { if ( isset ( $ this -> oxcategories__oxextlink ) && $ this -> oxcategories__oxextlink -> value ) { return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> processUrl ( $ this -> oxcategories__oxextlink -> value , true ) ; } if ( $ iLang === null ) { $ iLang = $ this -> getLanguage ( ) ; } if ( ! isset ( $ this -> _aStdUrls [ $ iLang ] ) ) { $ this -> _aStdUrls [ $ iLang ] = $ this -> getBaseStdLink ( $ iLang ) ; } return \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsUrl ( ) -> processUrl ( $ this -> _aStdUrls [ $ iLang ] , true , $ aParams , $ iLang ) ; }
Returns standard URL to category
37,984
public function getHasSubCats ( ) { if ( ! isset ( $ this -> _blHasSubCats ) ) { $ this -> _blHasSubCats = $ this -> oxcategories__oxright -> value > $ this -> oxcategories__oxleft -> value + 1 ; } return $ this -> _blHasSubCats ; }
returns if a category has sub categories
37,985
public function setHasVisibleSubCats ( $ blHasVisibleSubcats ) { if ( $ blHasVisibleSubcats && ! $ this -> _blHasVisibleSubCats ) { unset ( $ this -> _blIsVisible ) ; if ( $ this -> _oParent instanceof \ OxidEsales \ Eshop \ Application \ Model \ Category ) { $ this -> _oParent -> setHasVisibleSubCats ( true ) ; } } $ this -> _blHasVisibleSubCats = $ blHasVisibleSubcats ; }
sets the state of has visible sub categories for the category
37,986
public function getAttributes ( ) { $ sActCat = $ this -> getId ( ) ; $ sKey = md5 ( $ sActCat . serialize ( \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( 'session_attrfilter' ) ) ) ; if ( ! isset ( self :: $ _aCatAttributes [ $ sKey ] ) ) { $ oAttrList = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ AttributeList :: class ) ; $ oAttrList -> getCategoryAttributes ( $ sActCat , $ this -> getLanguage ( ) ) ; self :: $ _aCatAttributes [ $ sKey ] = $ oAttrList ; } return self :: $ _aCatAttributes [ $ sKey ] ; }
Loads and returns attribute list associated with this category
37,987
public function getCatInLang ( $ oActCategory = null ) { $ oCategoryInDefaultLanguage = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Category :: class ) ; if ( $ this -> isPriceCategory ( ) ) { $ oCategoryInDefaultLanguage -> loadInLang ( 0 , $ this -> getId ( ) ) ; } else { $ oCategoryInDefaultLanguage -> loadInLang ( 0 , $ oActCategory -> getId ( ) ) ; } return $ oCategoryInDefaultLanguage ; }
Loads and returns category in base language
37,988
public static function getRootId ( $ sCategoryId ) { if ( ! isset ( $ sCategoryId ) ) { return ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; return $ oDb -> getOne ( 'select oxrootid from ' . getViewName ( 'oxcategories' ) . ' where oxid = ' . $ oDb -> quote ( $ sCategoryId ) ) ; }
Returns root category id of a child category
37,989
public function getIconUrl ( ) { if ( ( $ sIcon = $ this -> oxcategories__oxicon -> value ) ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sSize = $ oConfig -> getConfigParam ( 'sCatIconsize' ) ; if ( ! isset ( $ sSize ) ) { $ sSize = $ oConfig -> getConfigParam ( 'sIconsize' ) ; } return \ OxidEsales \ Eshop \ Core \ Registry :: getPictureHandler ( ) -> getPicUrl ( "category/icon/" , $ sIcon , $ sSize ) ; } }
Returns category icon picture url if exist false - if not
37,990
public function getThumbUrl ( ) { if ( ( $ sIcon = $ this -> oxcategories__oxthumb -> value ) ) { $ sSize = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCatThumbnailsize' ) ; return \ OxidEsales \ Eshop \ Core \ Registry :: getPictureHandler ( ) -> getPicUrl ( "category/thumb/" , $ sIcon , $ sSize ) ; } }
Returns category thumbnail picture url if exist false - if not
37,991
public function getPromotionIconUrl ( ) { if ( ( $ sIcon = $ this -> oxcategories__oxpromoicon -> value ) ) { $ sSize = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getConfigParam ( 'sCatPromotionsize' ) ; return \ OxidEsales \ Eshop \ Core \ Registry :: getPictureHandler ( ) -> getPicUrl ( "category/promo_icon/" , $ sIcon , $ sSize ) ; } }
Returns category promotion icon picture url if exist false - if not
37,992
public function isTopCategory ( ) { if ( $ this -> _blTopCategory == null ) { $ this -> _blTopCategory = $ this -> oxcategories__oxparentid -> value == 'oxrootid' ; } return $ this -> _blTopCategory ; }
Returns true if category parentid is oxrootid
37,993
public function getFieldFromSubCategories ( $ sField = 'OXID' , $ sOXID = null ) { if ( ! $ sOXID ) { $ sOXID = $ this -> getId ( ) ; } if ( ! $ sOXID ) { return false ; } $ sTable = $ this -> getViewName ( ) ; $ sField = "`{$sTable}`.`{$sField}`" ; $ sSql = "SELECT $sField FROM `{$sTable}` WHERE `OXROOTID` = ? AND `OXPARENTID` != 'oxrootid'" ; $ aResult = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getCol ( $ sSql , [ $ sOXID ] ) ; return $ aResult ; }
Gets one field from all of subcategories . Default is set to OXID
37,994
public function confirmRegistration ( ) { $ oUser = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ User :: class ) ; if ( $ oUser -> loadUserByUpdateId ( $ this -> getUpdateId ( ) ) ) { $ oUser -> setUpdateKey ( true ) ; $ oUser -> oxuser__oxactive = new \ OxidEsales \ Eshop \ Core \ Field ( 1 ) ; $ oUser -> save ( ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> setVariable ( 'usr' , $ oUser -> getId ( ) ) ; return 'register?confirmstate=1' ; } else { \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( 'REGISTER_ERRLINKEXPIRED' , false , true ) ; return 'account' ; } }
Registration confirmation functionality . If registration succeded - redirects to success page if not - returns exception informing about expired confirmation link
37,995
public function addSearch ( $ sQueryString , $ iNumberOfHits ) { $ this -> _searchQuery = $ this -> _emos_DataFormat ( $ sQueryString ) ; $ this -> _searchNumberOfHits = $ iNumberOfHits ; }
sets search tracking
37,996
public function addEmosBasketPageArray ( $ aBasket ) { if ( ! is_array ( $ aBasket ) ) { return ; } $ aBasketItems = [ ] ; foreach ( $ aBasket as $ oItem ) { $ oItem = $ this -> _emos_ItemFormat ( $ oItem ) ; $ aBasketItems [ ] = [ "buy" , $ oItem -> productId , $ oItem -> productName , $ oItem -> price , $ oItem -> productGroup , $ oItem -> quantity , $ oItem -> variant1 , $ oItem -> variant2 , $ oItem -> variant3 ] ; } $ this -> _ecEvent = $ aBasketItems ; }
adds a emosBasket Page Array to the preScript
37,997
protected function _setEmosBillingArray ( $ sBillingId = "" , $ sCustomerNumber = "" , $ iTotal = 0 , $ sCountry = "" , $ sCip = "" , $ sCity = "" ) { $ sCustomerNumber = md5 ( $ sCustomerNumber ) ; $ sCountry = $ this -> _emos_DataFormat ( $ sCountry ) ; $ sCip = $ this -> _emos_DataFormat ( $ sCip ) ; $ sCity = $ this -> _emos_DataFormat ( $ sCity ) ; $ ort = "" ; if ( $ sCountry ) { $ ort .= "$sCountry/" ; } if ( $ sCip ) { $ ort .= getStr ( ) -> substr ( $ sCip , 0 , 1 ) . "/" . getStr ( ) -> substr ( $ sCip , 0 , 2 ) . "/" ; } if ( $ sCity ) { $ ort .= "$sCity/" ; } if ( $ sCip ) { $ ort .= $ sCip ; } $ this -> _billing = [ $ sBillingId , $ sCustomerNumber , $ ort , $ iTotal ] ; }
set a emosBillingArray
37,998
public function _prepareScript ( ) { $ this -> _sPrescript = '<script type="text/javascript">window.emosTrackVersion = 2;</script>' . $ this -> _br ; $ this -> _sIncScript .= "<script type=\"text/javascript\" " . "src=\"" . $ this -> _sPathToFile . $ this -> _sScriptFileName . "\">" . "</script>" . $ this -> _br ; $ this -> _sPostscript = '<script type="text/javascript"><!--' . $ this -> _br ; $ this -> _sPostscript .= $ this -> _tab . 'var emospro = {};' . $ this -> _br ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "content" , $ this -> _content ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "orderProcess" , $ this -> _orderProcess ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "siteid" , $ this -> _siteid ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "langid" , $ this -> _langid ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "countryid" , $ this -> _countryid ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "pageId" , $ this -> _pageid ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "scontact" , $ this -> _scontact ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "download" , $ this -> _download ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "billing" , [ $ this -> _billing ] ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "search" , [ [ $ this -> _searchQuery , $ this -> _searchNumberOfHits ] ] ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "register" , [ [ $ this -> _registerUser , $ this -> _registerResult ] ] ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "login" , [ [ $ this -> _loginUser , $ this -> _loginResult ] ] ) ; $ this -> _sPostscript .= $ this -> _addJsFormat ( "ec_Event" , $ this -> _ecEvent ) ; $ this -> _sPostscript .= $ this -> _tab . 'window.emosPropertiesEvent(emospro);' . $ this -> _br ; $ this -> _sPostscript .= '// . $ this -> _br . '</script>' . $ this -> _br ; }
formats up the connector script in a Econda ver 2 JS format
37,999
protected function _addJsFormat ( $ sVarName , $ mContents ) { $ mVal = $ mContents ; while ( is_array ( $ mVal ) ) { $ mVal = $ mVal [ 0 ] ; } if ( is_null ( $ mVal ) ) { return ; } $ sEncoded = $ this -> _jsEncode ( ( $ mContents ) ) ; return $ this -> _tab . 'emospro.' . $ sVarName . ' = ' . $ sEncoded . ';' . $ this -> _br ; }
Formats a line in JS format