repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
OXID-eSales/oxideshop_ce | source/Internal/Review/Dao/RatingDao.php | RatingDao.mapRatings | private function mapRatings($ratingsData)
{
$ratings = new ArrayCollection();
foreach ($ratingsData as $ratingData) {
$rating = new Rating();
$ratings->add($this->mapper->map($rating, $ratingData));
}
return $ratings;
} | php | private function mapRatings($ratingsData)
{
$ratings = new ArrayCollection();
foreach ($ratingsData as $ratingData) {
$rating = new Rating();
$ratings->add($this->mapper->map($rating, $ratingData));
}
return $ratings;
} | [
"private",
"function",
"mapRatings",
"(",
"$",
"ratingsData",
")",
"{",
"$",
"ratings",
"=",
"new",
"ArrayCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"ratingsData",
"as",
"$",
"ratingData",
")",
"{",
"$",
"rating",
"=",
"new",
"Rating",
"(",
")",
... | Maps rating data from database to Ratings Collection.
@param array $ratingsData
@return ArrayCollection | [
"Maps",
"rating",
"data",
"from",
"database",
"to",
"Ratings",
"Collection",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Dao/RatingDao.php#L107-L117 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopConfiguration.php | ShopConfiguration._unserializeConfVar | 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;
} | php | 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;
} | [
"public",
"function",
"_unserializeConfVar",
"(",
"$",
"sType",
",",
"$",
"sName",
",",
"$",
"sValue",
")",
"{",
"$",
"oStr",
"=",
"getStr",
"(",
")",
";",
"$",
"mData",
"=",
"null",
";",
"switch",
"(",
"$",
"sType",
")",
"{",
"case",
"\"bool\"",
"... | Unserialize config var depending on it's type
@param string $sType var type
@param string $sName var name
@param string $sValue var value
@return mixed | [
"Unserialize",
"config",
"var",
"depending",
"on",
"it",
"s",
"type"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopConfiguration.php#L306-L344 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopConfiguration.php | ShopConfiguration._multilineToArray | 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;
}
} | php | 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;
}
} | [
"protected",
"function",
"_multilineToArray",
"(",
"$",
"sMultiline",
")",
"{",
"$",
"aArr",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"sMultiline",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aArr",
")",
")",
"{",
"foreach",
"(",
"$",
"aArr",
"as",
... | Converts Multiline text to simple array. Returns this array.
@param string $sMultiline Multiline text
@return array | [
"Converts",
"Multiline",
"text",
"to",
"simple",
"array",
".",
"Returns",
"this",
"array",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopConfiguration.php#L405-L418 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopConfiguration.php | ShopConfiguration._aarrayToMultiline | protected function _aarrayToMultiline($aInput)
{
if (is_array($aInput)) {
$sMultiline = '';
foreach ($aInput as $sKey => $sVal) {
if ($sMultiline) {
$sMultiline .= "\n";
}
$sMultiline .= $sKey . " => " . $sVal;
}
return $sMultiline;
}
} | php | protected function _aarrayToMultiline($aInput)
{
if (is_array($aInput)) {
$sMultiline = '';
foreach ($aInput as $sKey => $sVal) {
if ($sMultiline) {
$sMultiline .= "\n";
}
$sMultiline .= $sKey . " => " . $sVal;
}
return $sMultiline;
}
} | [
"protected",
"function",
"_aarrayToMultiline",
"(",
"$",
"aInput",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aInput",
")",
")",
"{",
"$",
"sMultiline",
"=",
"''",
";",
"foreach",
"(",
"$",
"aInput",
"as",
"$",
"sKey",
"=>",
"$",
"sVal",
")",
"{",
... | Converts associative array to multiline text. Returns this text.
@param array $aInput Array to convert
@return string | [
"Converts",
"associative",
"array",
"to",
"multiline",
"text",
".",
"Returns",
"this",
"text",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopConfiguration.php#L427-L440 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopConfiguration.php | ShopConfiguration._multilineToAarray | 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;
} | php | 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;
} | [
"protected",
"function",
"_multilineToAarray",
"(",
"$",
"sMultiline",
")",
"{",
"$",
"oStr",
"=",
"getStr",
"(",
")",
";",
"$",
"aArr",
"=",
"[",
"]",
";",
"$",
"aLines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"sMultiline",
")",
";",
"foreach",
"... | Converts Multiline text to associative array. Returns this array.
@param string $sMultiline Multiline text
@return array | [
"Converts",
"Multiline",
"text",
"to",
"associative",
"array",
".",
"Returns",
"this",
"array",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopConfiguration.php#L449-L466 | train |
OXID-eSales/oxideshop_ce | source/Core/Edition/EditionRootPathProvider.php | EditionRootPathProvider.getDirectoryPath | 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;
} | php | 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;
} | [
"public",
"function",
"getDirectoryPath",
"(",
")",
"{",
"$",
"editionsPath",
"=",
"VENDOR_PATH",
".",
"static",
"::",
"EDITIONS_DIRECTORY",
";",
"$",
"path",
"=",
"getShopBasePath",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getEditionSelector",
"(",
")"... | Returns path to edition directory. If no additional editions are found, returns base path.
@return string | [
"Returns",
"path",
"to",
"edition",
"directory",
".",
"If",
"no",
"additional",
"editions",
"are",
"found",
"returns",
"base",
"path",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Edition/EditionRootPathProvider.php#L44-L55 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DiscountUsersAjax.php | DiscountUsersAjax.removeDiscUser | 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);
}
} | php | 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);
}
} | [
"public",
"function",
"removeDiscUser",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aRemoveGroups",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxobject2... | Removes user from discount config | [
"Removes",
"user",
"from",
"discount",
"config"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DiscountUsersAjax.php#L92-L103 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DiscountUsersAjax.php | DiscountUsersAjax.addDiscUser | 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();
}
}
} | php | 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();
}
}
} | [
"public",
"function",
"addDiscUser",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"aChosenUsr",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxuser.oxid'",
... | Adds user to discount config | [
"Adds",
"user",
"to",
"discount",
"config"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DiscountUsersAjax.php#L108-L128 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.offsetSet | 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;
}
}
} | php | 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;
}
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"oBase",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"offset",
")",
")",
"{",
"$",
"this",
"->",
"_aArray",
"[",
"$",
"offset",
"]",
"=",
"&",
"$",
"oBase",
";",
"}",
"else",
"{",
"$"... | offsetSet for SPL
@param mixed $offset SPL array offset
@param BaseModel $oBase Array element | [
"offsetSet",
"for",
"SPL"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L89-L102 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.offsetUnset | public function offsetUnset($offset)
{
if (strcmp($offset, $this->key()) === 0) {
// #0002184: active element removed, next element will be prev / first
$this->_blRemovedActive = true;
}
unset($this->_aArray[$offset]);
} | php | public function offsetUnset($offset)
{
if (strcmp($offset, $this->key()) === 0) {
// #0002184: active element removed, next element will be prev / first
$this->_blRemovedActive = true;
}
unset($this->_aArray[$offset]);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"strcmp",
"(",
"$",
"offset",
",",
"$",
"this",
"->",
"key",
"(",
")",
")",
"===",
"0",
")",
"{",
"// #0002184: active element removed, next element will be prev / first",
"$",
"this... | offsetUnset for SPL
@param mixed $offset SPL array offset | [
"offsetUnset",
"for",
"SPL"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L109-L117 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.rewind | public function rewind()
{
$this->_blRemovedActive = false;
$this->_blValid = (false !== reset($this->_aArray));
} | php | public function rewind()
{
$this->_blRemovedActive = false;
$this->_blValid = (false !== reset($this->_aArray));
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"$",
"this",
"->",
"_blRemovedActive",
"=",
"false",
";",
"$",
"this",
"->",
"_blValid",
"=",
"(",
"false",
"!==",
"reset",
"(",
"$",
"this",
"->",
"_aArray",
")",
")",
";",
"}"
] | rewind for SPL | [
"rewind",
"for",
"SPL"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L132-L136 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.next | public function next()
{
if ($this->_blRemovedActive === true && current($this->_aArray)) {
$oVar = $this->prev();
} else {
$oVar = next($this->_aArray);
}
$this->_blValid = (false !== $oVar);
} | php | public function next()
{
if ($this->_blRemovedActive === true && current($this->_aArray)) {
$oVar = $this->prev();
} else {
$oVar = next($this->_aArray);
}
$this->_blValid = (false !== $oVar);
} | [
"public",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_blRemovedActive",
"===",
"true",
"&&",
"current",
"(",
"$",
"this",
"->",
"_aArray",
")",
")",
"{",
"$",
"oVar",
"=",
"$",
"this",
"->",
"prev",
"(",
")",
";",
"}",
"els... | next for SPL | [
"next",
"for",
"SPL"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L178-L187 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.init | public function init($sObjectName, $sCoreTable = null)
{
$this->_sObjectsInListName = $sObjectName;
if ($sCoreTable) {
$this->_sCoreTable = $sCoreTable;
}
} | php | public function init($sObjectName, $sCoreTable = null)
{
$this->_sObjectsInListName = $sObjectName;
if ($sCoreTable) {
$this->_sCoreTable = $sCoreTable;
}
} | [
"public",
"function",
"init",
"(",
"$",
"sObjectName",
",",
"$",
"sCoreTable",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_sObjectsInListName",
"=",
"$",
"sObjectName",
";",
"if",
"(",
"$",
"sCoreTable",
")",
"{",
"$",
"this",
"->",
"_sCoreTable",
"=",
... | Inits list table name and object name.
@param string $sObjectName List item object type
@param string $sCoreTable Db table name this list s selected from | [
"Inits",
"list",
"table",
"name",
"and",
"object",
"name",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L319-L325 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.getBaseObject | public function getBaseObject()
{
if (!$this->_oBaseObject) {
$this->_oBaseObject = oxNew($this->_sObjectsInListName);
$this->_oBaseObject->setInList();
$this->_oBaseObject->init($this->_sCoreTable);
}
return $this->_oBaseObject;
} | php | public function getBaseObject()
{
if (!$this->_oBaseObject) {
$this->_oBaseObject = oxNew($this->_sObjectsInListName);
$this->_oBaseObject->setInList();
$this->_oBaseObject->init($this->_sCoreTable);
}
return $this->_oBaseObject;
} | [
"public",
"function",
"getBaseObject",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_oBaseObject",
")",
"{",
"$",
"this",
"->",
"_oBaseObject",
"=",
"oxNew",
"(",
"$",
"this",
"->",
"_sObjectsInListName",
")",
";",
"$",
"this",
"->",
"_oBaseObject"... | Initializes or returns existing list template object.
@return BaseModel | [
"Initializes",
"or",
"returns",
"existing",
"list",
"template",
"object",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L332-L341 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.selectString | 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();
}
}
} | php | 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();
}
}
} | [
"public",
"function",
"selectString",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
":... | Convert results of the given select statement into objects and store them in _aArray.
Developers are encouraged to use prepared statements like this:
$sql = 'SELECT * FROM `mytable` WHERE oxid = ?';
$parameters = ['MYOXID']
selectString($sql, $parameters)
@param string $sql SQL select statement or prepared statement
@param array $parameters Parameters to be used in a prepared statement | [
"Convert",
"results",
"of",
"the",
"given",
"select",
"statement",
"into",
"objects",
"and",
"store",
"them",
"in",
"_aArray",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L364-L388 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.add | public function add($oObject)
{
if ($oObject->getId()) {
$this->_aArray[$oObject->getId()] = $oObject;
} else {
$this->_aArray[] = $oObject;
}
} | php | public function add($oObject)
{
if ($oObject->getId()) {
$this->_aArray[$oObject->getId()] = $oObject;
} else {
$this->_aArray[] = $oObject;
}
} | [
"public",
"function",
"add",
"(",
"$",
"oObject",
")",
"{",
"if",
"(",
"$",
"oObject",
"->",
"getId",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_aArray",
"[",
"$",
"oObject",
"->",
"getId",
"(",
")",
"]",
"=",
"$",
"oObject",
";",
"}",
"else",
"{... | Add an entry to object array.
@param object $oObject Object to be added. | [
"Add",
"an",
"entry",
"to",
"object",
"array",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L395-L402 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.assignArray | 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;
}
}
}
} | php | 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;
}
}
}
} | [
"public",
"function",
"assignArray",
"(",
"$",
"aData",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"aData",
")",
")",
"{",
"$",
"oSaved",
"=",
"clone",
"$",
"this",
"->",
"getBaseObject",
"(",
")",
";",
"fo... | Assign data from array to list
@param array $aData data for list | [
"Assign",
"data",
"from",
"array",
"to",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L409-L425 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.containsFieldValue | public function containsFieldValue($oVal, $sFieldName)
{
$sFieldName = $this->_getFieldLongName($sFieldName);
foreach ($this->_aArray as $obj) {
if ($obj->{$sFieldName}->value == $oVal) {
return true;
}
}
return false;
} | php | public function containsFieldValue($oVal, $sFieldName)
{
$sFieldName = $this->_getFieldLongName($sFieldName);
foreach ($this->_aArray as $obj) {
if ($obj->{$sFieldName}->value == $oVal) {
return true;
}
}
return false;
} | [
"public",
"function",
"containsFieldValue",
"(",
"$",
"oVal",
",",
"$",
"sFieldName",
")",
"{",
"$",
"sFieldName",
"=",
"$",
"this",
"->",
"_getFieldLongName",
"(",
"$",
"sFieldName",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_aArray",
"as",
"$",
"ob... | Function checks if there is at least one object in the list which has the given value in the given field
@param mixed $oVal The searched value
@param string $sFieldName The name of the field, give "oxid" will access the classname__oxid field
@return boolean | [
"Function",
"checks",
"if",
"there",
"is",
"at",
"least",
"one",
"object",
"in",
"the",
"list",
"which",
"has",
"the",
"given",
"value",
"in",
"the",
"given",
"field"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L448-L458 | train |
OXID-eSales/oxideshop_ce | source/Core/Model/ListModel.php | ListModel.getList | 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;
} | php | 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;
} | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"oListObject",
"=",
"$",
"this",
"->",
"getBaseObject",
"(",
")",
";",
"$",
"sFieldList",
"=",
"$",
"oListObject",
"->",
"getSelectFields",
"(",
")",
";",
"$",
"sQ",
"=",
"\"select $sFieldList from \"",
... | Generic function for loading the list
@return null; | [
"Generic",
"function",
"for",
"loading",
"the",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Model/ListModel.php#L465-L476 | train |
OXID-eSales/oxideshop_ce | source/Setup/Language.php | Language.getLanguage | public function getLanguage()
{
/** @var Session $oSession */
$oSession = $this->getInstance("Session");
/** @var Utilities $oUtils */
$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)) {
//updating setup language, so disabling redirect to next step, just reloading same step
$_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');
} | php | public function getLanguage()
{
/** @var Session $oSession */
$oSession = $this->getInstance("Session");
/** @var Utilities $oUtils */
$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)) {
//updating setup language, so disabling redirect to next step, just reloading same step
$_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');
} | [
"public",
"function",
"getLanguage",
"(",
")",
"{",
"/** @var Session $oSession */",
"$",
"oSession",
"=",
"$",
"this",
"->",
"getInstance",
"(",
"\"Session\"",
")",
";",
"/** @var Utilities $oUtils */",
"$",
"oUtils",
"=",
"$",
"this",
"->",
"getInstance",
"(",
... | Returns setup interface language id
@return string | [
"Returns",
"setup",
"interface",
"language",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Language.php#L28-L52 | train |
OXID-eSales/oxideshop_ce | source/Setup/Language.php | Language.getText | 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;
} | php | 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;
} | [
"public",
"function",
"getText",
"(",
"$",
"sTextIdent",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aLangData",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aLangData",
"=",
"[",
"]",
";",
"$",
"sLangFilePath",
"=",
"getShopBasePath",
"(",
")",
".",
... | Translates passed index
@param string $sTextIdent translation index
@return string | [
"Translates",
"passed",
"index"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Setup/Language.php#L61-L74 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.init | 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 {
//user does not have sufficient rights for shop
throw new Exception(self::ERROR_USER_NO_RIGHTS);
}
return $this->isInitialized;
} | php | 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 {
//user does not have sufficient rights for shop
throw new Exception(self::ERROR_USER_NO_RIGHTS);
}
return $this->isInitialized;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"user",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application"... | Init parameters needed for import.
Creates Objects, checks Rights etc.
@throws Exception
@return boolean | [
"Init",
"parameters",
"needed",
"for",
"import",
".",
"Creates",
"Objects",
"checks",
"Rights",
"etc",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L84-L99 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.getImportObject | public function getImportObject($type)
{
$this->importType = $type;
$result = null;
try {
$importType = $this->getImportType();
$result = $this->createImportObject($importType);
} catch (Exception $e) {
}
return $result;
} | php | public function getImportObject($type)
{
$this->importType = $type;
$result = null;
try {
$importType = $this->getImportType();
$result = $this->createImportObject($importType);
} catch (Exception $e) {
}
return $result;
} | [
"public",
"function",
"getImportObject",
"(",
"$",
"type",
")",
"{",
"$",
"this",
"->",
"importType",
"=",
"$",
"type",
";",
"$",
"result",
"=",
"null",
";",
"try",
"{",
"$",
"importType",
"=",
"$",
"this",
"->",
"getImportType",
"(",
")",
";",
"$",
... | Get import object according import type.
@param string $type Import object type.
@return ImportObject | [
"Get",
"import",
"object",
"according",
"import",
"type",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L108-L119 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.importFile | public function importFile($importFilePath = null)
{
$this->returnMessage = '';
$this->importFilePath = $importFilePath;
//init with given data
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;
} | php | public function importFile($importFilePath = null)
{
$this->returnMessage = '';
$this->importFilePath = $importFilePath;
//init with given data
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;
} | [
"public",
"function",
"importFile",
"(",
"$",
"importFilePath",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"returnMessage",
"=",
"''",
";",
"$",
"this",
"->",
"importFilePath",
"=",
"$",
"importFilePath",
";",
"//init with given data",
"try",
"{",
"$",
"this"... | Main import method, whole import of all types via a given csv file is done here.
@param string $importFilePath Full path of the CSV file.
@return string | [
"Main",
"import",
"method",
"whole",
"import",
"of",
"all",
"types",
"via",
"a",
"given",
"csv",
"file",
"is",
"done",
"here",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L157-L194 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.importData | 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);
} | php | 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);
} | [
"public",
"function",
"importData",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
")",
"{",
"try",
"{",
"$",
"success",
"=",
"$",
"this",
"->",
"importOne",
"(",
"$... | Performs import action.
@param array $data | [
"Performs",
"import",
"action",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L201-L218 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.getImportObjectsList | public function getImportObjectsList()
{
$importObjects = [];
foreach ($this->objects as $sKey => $importType) {
$type = $this->createImportObject($importType);
$importObjects[$sKey] = $type->getBaseTableName();
}
return $importObjects;
} | php | public function getImportObjectsList()
{
$importObjects = [];
foreach ($this->objects as $sKey => $importType) {
$type = $this->createImportObject($importType);
$importObjects[$sKey] = $type->getBaseTableName();
}
return $importObjects;
} | [
"public",
"function",
"getImportObjectsList",
"(",
")",
"{",
"$",
"importObjects",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"objects",
"as",
"$",
"sKey",
"=>",
"$",
"importType",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"createImpor... | Returns allowed for import objects list.
@return array | [
"Returns",
"allowed",
"for",
"import",
"objects",
"list",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L245-L254 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.afterImport | 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);
}
} | php | 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);
}
} | [
"protected",
"function",
"afterImport",
"(",
"$",
"data",
")",
"{",
"$",
"statistics",
"=",
"$",
"this",
"->",
"getStatistics",
"(",
")",
";",
"$",
"dataForRetry",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"statistics",
"as",
"$",
"key",
"=>",
"$",
"v... | 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.
@param array $data | [
"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",
"... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L291-L308 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.getImportType | 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];
}
} | php | 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];
}
} | [
"protected",
"function",
"getImportType",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"importType",
";",
"if",
"(",
"strlen",
"(",
"$",
"type",
")",
"!=",
"1",
"||",
"!",
"array_key_exists",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"objects"... | Gets import object type according type prefix.
@throws Exception if no such import type prefix
@return string | [
"Gets",
"import",
"object",
"type",
"according",
"type",
"prefix",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L317-L326 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.mapFields | 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;
} | php | 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;
} | [
"protected",
"function",
"mapFields",
"(",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"index",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"csvFileFieldsOrder",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
... | Maps numeric array to assoc. Array
@param array $data numeric indices
@return array assoc. indices | [
"Maps",
"numeric",
"array",
"to",
"assoc",
".",
"Array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L346-L363 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.csvTextConvert | 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;
} | php | 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;
} | [
"protected",
"function",
"csvTextConvert",
"(",
"$",
"text",
",",
"$",
"mode",
")",
"{",
"$",
"search",
"=",
"[",
"chr",
"(",
"13",
")",
",",
"chr",
"(",
"10",
")",
",",
"'\\''",
",",
"'\"'",
"]",
";",
"$",
"replace",
"=",
"[",
"' '",
",",
... | Parses and replaces special chars.
@param string $text input text
@param bool $mode true = Text2CSV, false = CSV2Text
@return string | [
"Parses",
"and",
"replaces",
"special",
"chars",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L373-L385 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.getCsvFieldsTerminator | 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;
} | php | 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;
} | [
"protected",
"function",
"getCsvFieldsTerminator",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"fieldTerminator",
"=",
"$",
"config",
"->",
"getConfigParam",
"("... | Set csv field terminator symbol.
@return string | [
"Set",
"csv",
"field",
"terminator",
"symbol",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L392-L406 | train |
OXID-eSales/oxideshop_ce | source/Core/GenericImport/GenericImport.php | GenericImport.getCsvFieldsEncolser | protected function getCsvFieldsEncolser()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($fieldEncloser = $config->getConfigParam('sGiCsvFieldEncloser')) {
return $fieldEncloser;
}
return $this->defaultStringEncloser;
} | php | protected function getCsvFieldsEncolser()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($fieldEncloser = $config->getConfigParam('sGiCsvFieldEncloser')) {
return $fieldEncloser;
}
return $this->defaultStringEncloser;
} | [
"protected",
"function",
"getCsvFieldsEncolser",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"fieldEncloser",
"=",
"$",
"config",
"->",
"getConfigPa... | Get csv field encloser symbol.
@return string | [
"Get",
"csv",
"field",
"encloser",
"symbol",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/GenericImport/GenericImport.php#L413-L422 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopList.php | ShopList.buildWhere | public function buildWhere()
{
// we override this to add our shop if we are not malladmin
$this->_aWhere = parent::buildWhere();
if (!\OxidEsales\Eshop\Core\Registry::getSession()->getVariable('malladmin')) {
// we only allow to see our shop
$this->_aWhere[getViewName("oxshops") . ".oxid"] = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
}
return $this->_aWhere;
} | php | public function buildWhere()
{
// we override this to add our shop if we are not malladmin
$this->_aWhere = parent::buildWhere();
if (!\OxidEsales\Eshop\Core\Registry::getSession()->getVariable('malladmin')) {
// we only allow to see our shop
$this->_aWhere[getViewName("oxshops") . ".oxid"] = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
}
return $this->_aWhere;
} | [
"public",
"function",
"buildWhere",
"(",
")",
"{",
"// we override this to add our shop if we are not malladmin",
"$",
"this",
"->",
"_aWhere",
"=",
"parent",
"::",
"buildWhere",
"(",
")",
";",
"if",
"(",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\... | Sets SQL WHERE condition. Returns array of conditions.
@return array | [
"Sets",
"SQL",
"WHERE",
"condition",
".",
"Returns",
"array",
"of",
"conditions",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopList.php#L97-L107 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleFiles.php | ArticleFiles.render | 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();
// variant handling
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;
} | php | 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();
// variant handling
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;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"if",
"(",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blEnableDownloads'",
")... | Collects available article axtended parameters, passes them to
Smarty engine and returns tamplate file name "article_extend.tpl".
@return string | [
"Collects",
"available",
"article",
"axtended",
"parameters",
"passes",
"them",
"to",
"Smarty",
"engine",
"and",
"returns",
"tamplate",
"file",
"name",
"article_extend",
".",
"tpl",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleFiles.php#L40-L57 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleFiles.php | ArticleFiles.getArticle | 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;
} | php | 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;
} | [
"public",
"function",
"getArticle",
"(",
"$",
"blReset",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oArticle",
"!==",
"null",
"&&",
"!",
"$",
"blReset",
")",
"{",
"return",
"$",
"this",
"->",
"_oArticle",
";",
"}",
"$",
"sProductId",
"="... | Returns current oxarticle object
@param bool $blReset Load article again
@return oxFile | [
"Returns",
"current",
"oxarticle",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleFiles.php#L96-L107 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleFiles.php | ArticleFiles.upload | 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");
//uploading and processing supplied file
$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');
}
//save media url
$oArticleFile->oxfiles__oxartid = new \OxidEsales\Eshop\Core\Field($soxId, \OxidEsales\Eshop\Core\Field::T_RAW);
$oArticleFile->save();
} | php | 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");
//uploading and processing supplied file
$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');
}
//save media url
$oArticleFile->oxfiles__oxartid = new \OxidEsales\Eshop\Core\Field($soxId, \OxidEsales\Eshop\Core\Field::T_RAW);
$oArticleFile->save();
} | [
"public",
"function",
"upload",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"myConfig",
"->",
"isDemoShop",
"(",
")",
")",
"{",
"$",
"oEx",
... | Creates new oxFile object and stores newly uploaded file
@return null | [
"Creates",
"new",
"oxFile",
"object",
"and",
"stores",
"newly",
"uploaded",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleFiles.php#L114-L156 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleFiles.php | ArticleFiles.deletefile | 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();
}
} | php | 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();
}
} | [
"public",
"function",
"deletefile",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"myConfig",
"->",
"isDemoShop",
"(",
")",
")",
"{",
"$",
"oE... | Deletes article file from fileid parameter and checks if this file belongs to current article.
@return void | [
"Deletes",
"article",
"file",
"from",
"fileid",
"parameter",
"and",
"checks",
"if",
"this",
"file",
"belongs",
"to",
"current",
"article",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleFiles.php#L163-L185 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleFiles.php | ArticleFiles._processOptions | 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;
} | php | 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;
} | [
"protected",
"function",
"_processOptions",
"(",
"$",
"aParams",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aParams",
")",
")",
"{",
"$",
"aParams",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"aParams",
"[",
"\"oxfiles__oxdownl... | Process config options. If value is not set, save as "-1" to database
@param array $aParams params
@return array | [
"Process",
"config",
"options",
".",
"If",
"value",
"is",
"not",
"set",
"save",
"as",
"-",
"1",
"to",
"database"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleFiles.php#L206-L226 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.getHistoryArticles | public function getHistoryArticles()
{
if ($aArticlesIds = $this->getSession()->getVariable('aHistoryArticles')) {
return $aArticlesIds;
} elseif ($sArticlesIds = \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('aHistoryArticles')) {
return explode('|', $sArticlesIds);
}
} | php | public function getHistoryArticles()
{
if ($aArticlesIds = $this->getSession()->getVariable('aHistoryArticles')) {
return $aArticlesIds;
} elseif ($sArticlesIds = \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('aHistoryArticles')) {
return explode('|', $sArticlesIds);
}
} | [
"public",
"function",
"getHistoryArticles",
"(",
")",
"{",
"if",
"(",
"$",
"aArticlesIds",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"'aHistoryArticles'",
")",
")",
"{",
"return",
"$",
"aArticlesIds",
";",
"}",
"elseif",
"("... | Get history article id's from session or cookie.
@return array | [
"Get",
"history",
"article",
"id",
"s",
"from",
"session",
"or",
"cookie",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L80-L87 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.setHistoryArticles | public function setHistoryArticles($aArticlesIds)
{
if ($this->getSession()->getId()) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('aHistoryArticles', $aArticlesIds);
// clean cookie, if session started
\OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie('aHistoryArticles', '');
} else {
\OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie('aHistoryArticles', implode('|', $aArticlesIds));
}
} | php | public function setHistoryArticles($aArticlesIds)
{
if ($this->getSession()->getId()) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('aHistoryArticles', $aArticlesIds);
// clean cookie, if session started
\OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie('aHistoryArticles', '');
} else {
\OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie('aHistoryArticles', implode('|', $aArticlesIds));
}
} | [
"public",
"function",
"setHistoryArticles",
"(",
"$",
"aArticlesIds",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getId",
"(",
")",
")",
"{",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession"... | Set history article id's to session or cookie
@param array $aArticlesIds array history article ids | [
"Set",
"history",
"article",
"id",
"s",
"to",
"session",
"or",
"cookie"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L94-L103 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.sortByIds | public function sortByIds($aIds)
{
$this->_aOrderMap = array_flip($aIds);
uksort($this->_aArray, [$this, '_sortByOrderMapCallback']);
} | php | public function sortByIds($aIds)
{
$this->_aOrderMap = array_flip($aIds);
uksort($this->_aArray, [$this, '_sortByOrderMapCallback']);
} | [
"public",
"function",
"sortByIds",
"(",
"$",
"aIds",
")",
"{",
"$",
"this",
"->",
"_aOrderMap",
"=",
"array_flip",
"(",
"$",
"aIds",
")",
";",
"uksort",
"(",
"$",
"this",
"->",
"_aArray",
",",
"[",
"$",
"this",
",",
"'_sortByOrderMapCallback'",
"]",
")... | sort this list by given order.
@param array $aIds ordered ids | [
"sort",
"this",
"list",
"by",
"given",
"order",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L141-L145 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._sortByOrderMapCallback | 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 {
// first is here, but 2nd is not - 1st gets more priority
return -1;
}
} elseif (isset($this->_aOrderMap[$key2])) {
// first is not here, but 2nd is - 2nd gets more priority
return 1;
} else {
// both unset, equal
return 0;
}
} | php | 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 {
// first is here, but 2nd is not - 1st gets more priority
return -1;
}
} elseif (isset($this->_aOrderMap[$key2])) {
// first is not here, but 2nd is - 2nd gets more priority
return 1;
} else {
// both unset, equal
return 0;
}
} | [
"protected",
"function",
"_sortByOrderMapCallback",
"(",
"$",
"key1",
",",
"$",
"key2",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_aOrderMap",
"[",
"$",
"key1",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_aOrderMap"... | callback function only used from sortByIds
@param string $key1 1st key
@param string $key2 2nd key
@see oxArticleList::sortByIds
@return int | [
"callback",
"function",
"only",
"used",
"from",
"sortByIds"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L157-L180 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadNewestArticles | public function loadNewestArticles($iLimit = null)
{
//has module?
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
$this->getBaseObject()->disablePriceLoad();
}
$this->_aArray = [];
switch ($myConfig->getConfigParam('iNewestArticlesMode')) {
case 0:
// switched off, do nothing
break;
case 1:
// manually entered
$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;
}
} | php | public function loadNewestArticles($iLimit = null)
{
//has module?
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
$this->getBaseObject()->disablePriceLoad();
}
$this->_aArray = [];
switch ($myConfig->getConfigParam('iNewestArticlesMode')) {
case 0:
// switched off, do nothing
break;
case 1:
// manually entered
$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;
}
} | [
"public",
"function",
"loadNewestArticles",
"(",
"$",
"iLimit",
"=",
"null",
")",
"{",
"//has module?",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"myCon... | Loads newest shops articles from DB.
@param int $iLimit Select limit | [
"Loads",
"newest",
"shops",
"articles",
"from",
"DB",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L187-L222 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadTop5Articles | public function loadTop5Articles($iLimit = null)
{
//has module?
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
$this->getBaseObject()->disablePriceLoad();
}
switch ($myConfig->getConfigParam('iTop5Mode')) {
case 0:
// switched off, do nothing
break;
case 1:
// manually entered
$this->loadActionArticles('oxtop5', $iLimit);
break;
case 2:
$sArticleTable = getViewName('oxarticles');
//by default limit 5
$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;
}
} | php | public function loadTop5Articles($iLimit = null)
{
//has module?
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
$this->getBaseObject()->disablePriceLoad();
}
switch ($myConfig->getConfigParam('iTop5Mode')) {
case 0:
// switched off, do nothing
break;
case 1:
// manually entered
$this->loadActionArticles('oxtop5', $iLimit);
break;
case 2:
$sArticleTable = getViewName('oxarticles');
//by default limit 5
$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;
}
} | [
"public",
"function",
"loadTop5Articles",
"(",
"$",
"iLimit",
"=",
"null",
")",
"{",
"//has module?",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"!",
"$",
"myConfi... | Load top 5 articles
@param int $iLimit Select limit | [
"Load",
"top",
"5",
"articles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L229-L260 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadActionArticles | public function loadActionArticles($sActionID, $iLimit = null)
{
// Performance
if (!trim($sActionID)) {
return;
}
$sShopID = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sActionID = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote(strtolower($sActionID));
//echo $sSelect;
$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);
} | php | public function loadActionArticles($sActionID, $iLimit = null)
{
// Performance
if (!trim($sActionID)) {
return;
}
$sShopID = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
$sActionID = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote(strtolower($sActionID));
//echo $sSelect;
$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);
} | [
"public",
"function",
"loadActionArticles",
"(",
"$",
"sActionID",
",",
"$",
"iLimit",
"=",
"null",
")",
"{",
"// Performance",
"if",
"(",
"!",
"trim",
"(",
"$",
"sActionID",
")",
")",
"{",
"return",
";",
"}",
"$",
"sShopID",
"=",
"\\",
"OxidEsales",
"... | Loads shop AktionArticles.
@param string $sActionID Action id
@param int $iLimit Select limit
@return null | [
"Loads",
"shop",
"AktionArticles",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L270-L299 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadArticleCrossSell | public function loadArticleCrossSell($sArticleId)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
// Performance
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();
// #525 bidirectional cross selling
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);
} | php | public function loadArticleCrossSell($sArticleId)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
// Performance
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();
// #525 bidirectional cross selling
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);
} | [
"public",
"function",
"loadArticleCrossSell",
"(",
"$",
"sArticleId",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"// Performance",
"if",
"(",
"!",
"$",
"myConfig",
"-... | Loads article cross selling
@param string $sArticleId Article id
@return null | [
"Loads",
"article",
"cross",
"selling"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L308-L351 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadCategoryArticles | public function loadCategoryArticles($sCatId, $aSessionFilter, $iLimit = null)
{
$sArticleFields = $this->getBaseObject()->getSelectFields();
$sSelect = $this->_getCategorySelect($sArticleFields, $sCatId, $aSessionFilter);
// calc count - we can not use count($this) here as we might have paging enabled
// #1970C - if any filters are used, we can not use cached category article count
$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;
}
// this select is FAST so no need to hazzle here with getNrOfArticles()
return \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getCatArticleCount($sCatId);
} | php | public function loadCategoryArticles($sCatId, $aSessionFilter, $iLimit = null)
{
$sArticleFields = $this->getBaseObject()->getSelectFields();
$sSelect = $this->_getCategorySelect($sArticleFields, $sCatId, $aSessionFilter);
// calc count - we can not use count($this) here as we might have paging enabled
// #1970C - if any filters are used, we can not use cached category article count
$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;
}
// this select is FAST so no need to hazzle here with getNrOfArticles()
return \OxidEsales\Eshop\Core\Registry::getUtilsCount()->getCatArticleCount($sCatId);
} | [
"public",
"function",
"loadCategoryArticles",
"(",
"$",
"sCatId",
",",
"$",
"aSessionFilter",
",",
"$",
"iLimit",
"=",
"null",
")",
"{",
"$",
"sArticleFields",
"=",
"$",
"this",
"->",
"getBaseObject",
"(",
")",
"->",
"getSelectFields",
"(",
")",
";",
"$",
... | Loads articles for the give Category
@param string $sCatId Category tree ID
@param array $aSessionFilter Like array ( catid => array( attrid => value,...))
@param int $iLimit Limit
@return integer total Count of Articles in this Category | [
"Loads",
"articles",
"for",
"the",
"give",
"Category"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L406-L431 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadRecommArticles | public function loadRecommArticles($sRecommId, $sArticlesFilter = null)
{
$sSelect = $this->_getArticleSelect($sRecommId, $sArticlesFilter);
$this->selectString($sSelect);
} | php | public function loadRecommArticles($sRecommId, $sArticlesFilter = null)
{
$sSelect = $this->_getArticleSelect($sRecommId, $sArticlesFilter);
$this->selectString($sSelect);
} | [
"public",
"function",
"loadRecommArticles",
"(",
"$",
"sRecommId",
",",
"$",
"sArticlesFilter",
"=",
"null",
")",
"{",
"$",
"sSelect",
"=",
"$",
"this",
"->",
"_getArticleSelect",
"(",
"$",
"sRecommId",
",",
"$",
"sArticlesFilter",
")",
";",
"$",
"this",
"... | Loads articles for the recommlist
@deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
@param string $sRecommId Recommlist ID
@param string $sArticlesFilter Additional filter for recommlist's items | [
"Loads",
"articles",
"for",
"the",
"recommlist"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L441-L445 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadRecommArticleIds | 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);
} | php | 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);
} | [
"public",
"function",
"loadRecommArticleIds",
"(",
"$",
"sRecommId",
",",
"$",
"sArticlesFilter",
")",
"{",
"$",
"sSelect",
"=",
"$",
"this",
"->",
"_getArticleSelect",
"(",
"$",
"sRecommId",
",",
"$",
"sArticlesFilter",
")",
";",
"$",
"sArtView",
"=",
"getV... | Loads only ID's and create Fake objects.
@deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
@param string $sRecommId Recommlist ID
@param string $sArticlesFilter Additional filter for recommlist's items | [
"Loads",
"only",
"ID",
"s",
"and",
"create",
"Fake",
"objects",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L455-L464 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._getArticleSelect | 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;
} | php | 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;
} | [
"protected",
"function",
"_getArticleSelect",
"(",
"$",
"sRecommId",
",",
"$",
"sArticlesFilter",
"=",
"null",
")",
"{",
"$",
"sRecommId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
"->",
"quote",... | Returns the appropriate SQL select
@deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
@param string $sRecommId Recommlist ID
@param string $sArticlesFilter Additional filter for recommlist's items
@return string | [
"Returns",
"the",
"appropriate",
"SQL",
"select"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L476-L486 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadPriceIds | public function loadPriceIds($dPriceFrom, $dPriceTo)
{
$sSelect = $this->_getPriceSelect($dPriceFrom, $dPriceTo);
$this->_createIdListFromSql($sSelect);
} | php | public function loadPriceIds($dPriceFrom, $dPriceTo)
{
$sSelect = $this->_getPriceSelect($dPriceFrom, $dPriceTo);
$this->_createIdListFromSql($sSelect);
} | [
"public",
"function",
"loadPriceIds",
"(",
"$",
"dPriceFrom",
",",
"$",
"dPriceTo",
")",
"{",
"$",
"sSelect",
"=",
"$",
"this",
"->",
"_getPriceSelect",
"(",
"$",
"dPriceFrom",
",",
"$",
"dPriceTo",
")",
";",
"$",
"this",
"->",
"_createIdListFromSql",
"(",... | Loads Id list of appropriate price products
@param float $dPriceFrom Starting price
@param float $dPriceTo Max price | [
"Loads",
"Id",
"list",
"of",
"appropriate",
"price",
"products"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L549-L553 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadIds | 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);
} | php | 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);
} | [
"public",
"function",
"loadIds",
"(",
"$",
"aIds",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"aIds",
")",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"return",
";",
"}",
"$",
"oBaseObject",
"=",
"$",
"this",
"->",
"getBaseObject",
"("... | Load the list by article ids
@param array $aIds Article ID array
@return null; | [
"Load",
"the",
"list",
"by",
"article",
"ids"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L643-L662 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadOrderArticles | 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);
// not active or not available products must not have button "tobasket"
$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);
}
}
} | php | 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);
// not active or not available products must not have button "tobasket"
$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);
}
}
} | [
"public",
"function",
"loadOrderArticles",
"(",
"$",
"aOrders",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"aOrders",
")",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"return",
";",
"}",
"foreach",
"(",
"$",
"aOrders",
"as",
"$",
"iKey",... | Loads the article list by orders ids
@param array $aOrders user orders array
@return null; | [
"Loads",
"the",
"article",
"list",
"by",
"orders",
"ids"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L671-L706 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.loadStockRemindProducts | 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();
// fetching actual db stock state and reminder status
$sQ = "select {$sFieldNames} from {$sTable} where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
oxremindactive = '1' and oxstock <= oxremindamount";
$this->selectString($sQ);
// updating stock reminder state
if ($this->count()) {
$sQ = "update {$sTable} set oxremindactive = '2' where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
oxremindactive = '1' and oxstock <= oxremindamount";
$oDb->execute($sQ);
}
}
} | php | 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();
// fetching actual db stock state and reminder status
$sQ = "select {$sFieldNames} from {$sTable} where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
oxremindactive = '1' and oxstock <= oxremindamount";
$this->selectString($sQ);
// updating stock reminder state
if ($this->count()) {
$sQ = "update {$sTable} set oxremindactive = '2' where {$sTable}.oxid in ( " . implode(",", $aArtIds) . " ) and
oxremindactive = '1' and oxstock <= oxremindamount";
$oDb->execute($sQ);
}
}
} | [
"public",
"function",
"loadStockRemindProducts",
"(",
"$",
"aBasketContents",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aBasketContents",
")",
"&&",
"count",
"(",
"$",
"aBasketContents",
")",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
... | Loads list of low stock state products
@param array $aBasketContents product ids array | [
"Loads",
"list",
"of",
"low",
"stock",
"state",
"products"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L713-L738 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.renewPriceUpdateTime | public function renewPriceUpdateTime()
{
$iTimeToUpdate = $this->fetchNextUpdateTime();
// next day?
$iCurrUpdateTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$iNextUpdateTime = $iCurrUpdateTime + 3600 * 24;
// renew next update time
if (!$iTimeToUpdate || $iTimeToUpdate > $iNextUpdateTime) {
$iTimeToUpdate = $iNextUpdateTime;
}
\OxidEsales\Eshop\Core\Registry::getConfig()->saveShopConfVar("num", "iTimeToUpdatePrices", $iTimeToUpdate);
return $iTimeToUpdate;
} | php | public function renewPriceUpdateTime()
{
$iTimeToUpdate = $this->fetchNextUpdateTime();
// next day?
$iCurrUpdateTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$iNextUpdateTime = $iCurrUpdateTime + 3600 * 24;
// renew next update time
if (!$iTimeToUpdate || $iTimeToUpdate > $iNextUpdateTime) {
$iTimeToUpdate = $iNextUpdateTime;
}
\OxidEsales\Eshop\Core\Registry::getConfig()->saveShopConfVar("num", "iTimeToUpdatePrices", $iTimeToUpdate);
return $iTimeToUpdate;
} | [
"public",
"function",
"renewPriceUpdateTime",
"(",
")",
"{",
"$",
"iTimeToUpdate",
"=",
"$",
"this",
"->",
"fetchNextUpdateTime",
"(",
")",
";",
"// next day?",
"$",
"iCurrUpdateTime",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::... | Calculates, updates and returns next price renew time
@return int | [
"Calculates",
"updates",
"and",
"returns",
"next",
"price",
"renew",
"time"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L745-L761 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._createIdListFromSql | 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']; //only the oxid
$rs->fetchRow();
}
}
} | php | 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']; //only the oxid
$rs->fetchRow();
}
}
} | [
"protected",
"function",
"_createIdListFromSql",
"(",
"$",
"sSql",
")",
"{",
"$",
"rs",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvid... | fills the list simply with keys of the oxid and the position as value for the given sql
@param string $sSql SQL select | [
"fills",
"the",
"list",
"simply",
"with",
"keys",
"of",
"the",
"oxid",
"and",
"the",
"position",
"as",
"value",
"for",
"the",
"given",
"sql"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L825-L835 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._getFilterIdsSql | 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 ";
} | php | 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 ";
} | [
"protected",
"function",
"_getFilterIdsSql",
"(",
"$",
"sCatId",
",",
"$",
"aFilter",
")",
"{",
"$",
"sO2CView",
"=",
"getViewName",
"(",
"'oxobject2category'",
")",
";",
"$",
"sO2AView",
"=",
"getViewName",
"(",
"'oxobject2attribute'",
")",
";",
"$",
"sFilter... | Returns sql to fetch ids of articles fitting current filter
@param string $sCatId category id
@param array $aFilter filters for this category
@return string | [
"Returns",
"sql",
"to",
"fetch",
"ids",
"of",
"articles",
"fitting",
"current",
"filter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L845-L875 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._getCategorySelect | protected function _getCategorySelect($sFields, $sCatId, $aSessionFilter)
{
$sArticleTable = getViewName('oxarticles');
$sO2CView = getViewName('oxobject2category');
// ----------------------------------
// sorting
$sSorting = '';
if ($this->_sCustomSorting) {
$sSorting = " {$this->_sCustomSorting} , ";
}
// ----------------------------------
// filtering ?
$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;
} | php | protected function _getCategorySelect($sFields, $sCatId, $aSessionFilter)
{
$sArticleTable = getViewName('oxarticles');
$sO2CView = getViewName('oxobject2category');
// ----------------------------------
// sorting
$sSorting = '';
if ($this->_sCustomSorting) {
$sSorting = " {$this->_sCustomSorting} , ";
}
// ----------------------------------
// filtering ?
$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;
} | [
"protected",
"function",
"_getCategorySelect",
"(",
"$",
"sFields",
",",
"$",
"sCatId",
",",
"$",
"aSessionFilter",
")",
"{",
"$",
"sArticleTable",
"=",
"getViewName",
"(",
"'oxarticles'",
")",
";",
"$",
"sO2CView",
"=",
"getViewName",
"(",
"'oxobject2category'"... | Creates SQL Statement to load Articles, etc.
@param string $sFields Fields which are loaded e.g. "oxid" or "*" etc.
@param string $sCatId Category tree ID
@param array $aSessionFilter Like array ( catid => array( attrid => value,...))
@return string SQL | [
"Creates",
"SQL",
"Statement",
"to",
"load",
"Articles",
"etc",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L919-L947 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._getPriceSelect | 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;
} | php | 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;
} | [
"protected",
"function",
"_getPriceSelect",
"(",
"$",
"dPriceFrom",
",",
"$",
"dPriceTo",
")",
"{",
"$",
"oBaseObject",
"=",
"$",
"this",
"->",
"getBaseObject",
"(",
")",
";",
"$",
"sArticleTable",
"=",
"$",
"oBaseObject",
"->",
"getViewName",
"(",
")",
";... | Builds SQL for selecting articles by price
@param double $dPriceFrom Starting price
@param double $dPriceTo Max price
@return string | [
"Builds",
"SQL",
"for",
"selecting",
"articles",
"by",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1055-L1074 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._getVendorSelect | 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;
} | php | 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;
} | [
"protected",
"function",
"_getVendorSelect",
"(",
"$",
"sVendorId",
")",
"{",
"$",
"sArticleTable",
"=",
"getViewName",
"(",
"'oxarticles'",
")",
";",
"$",
"oBaseObject",
"=",
"$",
"this",
"->",
"getBaseObject",
"(",
")",
";",
"$",
"sFieldNames",
"=",
"$",
... | Builds vendor select SQL statement
@param string $sVendorId Vendor ID
@return string | [
"Builds",
"vendor",
"select",
"SQL",
"statement"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1083-L1097 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList._canUpdatePrices | protected function _canUpdatePrices()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$blCan = false;
// crontab is off?
if (!$oConfig->getConfigParam("blUseCron")) {
$iTimeToUpdate = $oConfig->getConfigParam("iTimeToUpdatePrices");
if (!$iTimeToUpdate || $iTimeToUpdate <= \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()) {
$blCan = true;
}
}
return $blCan;
} | php | protected function _canUpdatePrices()
{
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$blCan = false;
// crontab is off?
if (!$oConfig->getConfigParam("blUseCron")) {
$iTimeToUpdate = $oConfig->getConfigParam("iTimeToUpdatePrices");
if (!$iTimeToUpdate || $iTimeToUpdate <= \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()) {
$blCan = true;
}
}
return $blCan;
} | [
"protected",
"function",
"_canUpdatePrices",
"(",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"blCan",
"=",
"false",
";",
"// crontab is off?",
"if",
"(",
"!",
"... | Checks if price update can be executed - current time > next price update time
@return bool | [
"Checks",
"if",
"price",
"update",
"can",
"be",
"executed",
"-",
"current",
"time",
">",
"next",
"price",
"update",
"time"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1127-L1141 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.fetchNextUpdateTime | protected function fetchNextUpdateTime()
{
// Function is called inside a transaction or from admin backend which uses master connection only.
// Transaction picks master automatically (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// fetching next update time
$sQ = $this->getQueryToFetchNextUpdateTime();
$iTimeToUpdate = $database->getOne(sprintf($sQ, "`oxarticles`"));
return $iTimeToUpdate;
} | php | protected function fetchNextUpdateTime()
{
// Function is called inside a transaction or from admin backend which uses master connection only.
// Transaction picks master automatically (see ESDEV-3804 and ESDEV-3822).
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// fetching next update time
$sQ = $this->getQueryToFetchNextUpdateTime();
$iTimeToUpdate = $database->getOne(sprintf($sQ, "`oxarticles`"));
return $iTimeToUpdate;
} | [
"protected",
"function",
"fetchNextUpdateTime",
"(",
")",
"{",
"// Function is called inside a transaction or from admin backend which uses master connection only.",
"// Transaction picks master automatically (see ESDEV-3804 and ESDEV-3822).",
"$",
"database",
"=",
"\\",
"OxidEsales",
"\\"... | Method fetches next update time for renewing price update time.
@return string | [
"Method",
"fetches",
"next",
"update",
"time",
"for",
"renewing",
"price",
"update",
"time",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1148-L1160 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.updateOxArticles | protected function updateOxArticles($sCurrUpdateTime, $oDb)
{
$sQ = $this->getQueryToUpdateOxArticle($sCurrUpdateTime);
$blUpdated = $oDb->execute(sprintf($sQ, "`oxarticles`"));
return $blUpdated;
} | php | protected function updateOxArticles($sCurrUpdateTime, $oDb)
{
$sQ = $this->getQueryToUpdateOxArticle($sCurrUpdateTime);
$blUpdated = $oDb->execute(sprintf($sQ, "`oxarticles`"));
return $blUpdated;
} | [
"protected",
"function",
"updateOxArticles",
"(",
"$",
"sCurrUpdateTime",
",",
"$",
"oDb",
")",
"{",
"$",
"sQ",
"=",
"$",
"this",
"->",
"getQueryToUpdateOxArticle",
"(",
"$",
"sCurrUpdateTime",
")",
";",
"$",
"blUpdated",
"=",
"$",
"oDb",
"->",
"execute",
... | Updates article.
@param string $sCurrUpdateTime
@param DatabaseInterface $oDb
@return mixed | [
"Updates",
"article",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1180-L1186 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/ArticleList.php | ArticleList.getSearchTableName | protected function getSearchTableName($table, $field)
{
$searchTable = $table;
if ($field == 'oxlongdesc') {
$searchTable = Registry::get(\OxidEsales\Eshop\Core\TableViewNameGenerator::class)->getViewName('oxartextends');
}
return $searchTable;
} | php | protected function getSearchTableName($table, $field)
{
$searchTable = $table;
if ($field == 'oxlongdesc') {
$searchTable = Registry::get(\OxidEsales\Eshop\Core\TableViewNameGenerator::class)->getViewName('oxartextends');
}
return $searchTable;
} | [
"protected",
"function",
"getSearchTableName",
"(",
"$",
"table",
",",
"$",
"field",
")",
"{",
"$",
"searchTable",
"=",
"$",
"table",
";",
"if",
"(",
"$",
"field",
"==",
"'oxlongdesc'",
")",
"{",
"$",
"searchTable",
"=",
"Registry",
"::",
"get",
"(",
"... | Get search table name.
Needed in case of searching for data in table oxartextends or its views.
@param string $table
@param string $field Chose table depending on field.
@return string | [
"Get",
"search",
"table",
"name",
".",
"Needed",
"in",
"case",
"of",
"searching",
"for",
"data",
"in",
"table",
"oxartextends",
"or",
"its",
"views",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/ArticleList.php#L1249-L1258 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._getSmarty | protected function _getSmarty()
{
if ($this->_oSmarty === null) {
$this->_oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
}
//setting default view
$this->_oSmarty->assign("oEmailView", $this);
return $this->_oSmarty;
} | php | protected function _getSmarty()
{
if ($this->_oSmarty === null) {
$this->_oSmarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
}
//setting default view
$this->_oSmarty->assign("oEmailView", $this);
return $this->_oSmarty;
} | [
"protected",
"function",
"_getSmarty",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oSmarty",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oSmarty",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsView",
"(",
"... | Smarty instance getter, assigns this oxEmail instance to "oEmailView" variable
@return \Smarty | [
"Smarty",
"instance",
"getter",
"assigns",
"this",
"oxEmail",
"instance",
"to",
"oEmailView",
"variable"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L339-L349 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._setSmtpProtocol | 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;
} | php | 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;
} | [
"protected",
"function",
"_setSmtpProtocol",
"(",
"$",
"url",
")",
"{",
"$",
"protocol",
"=",
"''",
";",
"$",
"smtpHost",
"=",
"$",
"url",
";",
"$",
"match",
"=",
"[",
"]",
";",
"if",
"(",
"Str",
"::",
"getStr",
"(",
")",
"->",
"preg_match",
"(",
... | Sets smtp parameters depending on the protocol used
returns smtp url which should be used for fsockopen
@param string $url initial smtp
@return string | [
"Sets",
"smtp",
"parameters",
"depending",
"on",
"the",
"protocol",
"used",
"returns",
"smtp",
"url",
"which",
"should",
"be",
"used",
"for",
"fsockopen"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L415-L432 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.setSmtp | 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);
}
} | php | 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);
}
} | [
"public",
"function",
"setSmtp",
"(",
"$",
"shop",
"=",
"null",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"shop",
"=",
"(",
"$",
"shop",
")",
"?",
"$",
"shop",
":",
"$",
"this",
"->",
"_getShop",
"(",
")",... | Sets SMTP mailer parameters, such as user name, password, location.
@param \OxidEsales\Eshop\Application\Model\Shop $shop Object, that keeps base shop info
@return null | [
"Sets",
"SMTP",
"mailer",
"parameters",
"such",
"as",
"user",
"name",
"password",
"location",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L441-L464 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendOrderEmailToUser | public function sendOrderEmailToUser($order, $subject = null)
{
// add user defined stuff if there is any
$order = $this->_addUserInfoOrderEMail($order);
$shop = $this->_getShop();
$this->_setMailParams($shop);
$user = $order->getOrderUser();
$this->setUser($user);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("order", $order);
$this->setViewData("blShowReviewLink", $this->shouldProductReviewLinksBeIncluded());
// Process view data array through oxOutput processor
$this->_processViewArray();
$this->setBody($smarty->fetch($this->_sOrderUserTemplate));
$this->setAltBody($smarty->fetch($this->_sOrderUserPlainTemplate));
// #586A
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();
} | php | public function sendOrderEmailToUser($order, $subject = null)
{
// add user defined stuff if there is any
$order = $this->_addUserInfoOrderEMail($order);
$shop = $this->_getShop();
$this->_setMailParams($shop);
$user = $order->getOrderUser();
$this->setUser($user);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("order", $order);
$this->setViewData("blShowReviewLink", $this->shouldProductReviewLinksBeIncluded());
// Process view data array through oxOutput processor
$this->_processViewArray();
$this->setBody($smarty->fetch($this->_sOrderUserTemplate));
$this->setAltBody($smarty->fetch($this->_sOrderUserPlainTemplate));
// #586A
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();
} | [
"public",
"function",
"sendOrderEmailToUser",
"(",
"$",
"order",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"// add user defined stuff if there is any",
"$",
"order",
"=",
"$",
"this",
"->",
"_addUserInfoOrderEMail",
"(",
"$",
"order",
")",
";",
"$",
"shop",
... | Sets mailer additional settings and sends ordering mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\Order $order Order object
@param string $subject user defined subject [optional]
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"ordering",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L505-L545 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendOrderEmailToOwner | public function sendOrderEmailToOwner($order, $subject = null)
{
$config = Registry::getConfig();
$shop = $this->_getShop();
// cleanup
$this->_clearMailer();
// add user defined stuff if there is any
$order = $this->_addUserInfoOrderEMail($order);
$user = $order->getOrderUser();
$this->setUser($user);
// send confirmation to shop owner
// send not pretending from order user, as different email domain rise spam filters
$this->setFrom($shop->oxshops__oxowneremail->value);
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$orderLanguage = $language->getObjectTplLanguage();
// if running shop language is different from admin lang. set in config
// we have to load shop in config language
if ($shop->getLanguage() != $orderLanguage) {
$shop = $this->_getShop($orderLanguage);
}
$this->setSmtp($shop);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("order", $order);
// Process view data array through oxoutput processor
$this->_processViewArray();
$this->setBody($smarty->fetch($config->getTemplatePath($this->_sOrderOwnerTemplate, false)));
$this->setAltBody($smarty->fetch($config->getTemplatePath($this->_sOrderOwnerPlainTemplate, false)));
//Sets subject to email
// #586A
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;
} | php | public function sendOrderEmailToOwner($order, $subject = null)
{
$config = Registry::getConfig();
$shop = $this->_getShop();
// cleanup
$this->_clearMailer();
// add user defined stuff if there is any
$order = $this->_addUserInfoOrderEMail($order);
$user = $order->getOrderUser();
$this->setUser($user);
// send confirmation to shop owner
// send not pretending from order user, as different email domain rise spam filters
$this->setFrom($shop->oxshops__oxowneremail->value);
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$orderLanguage = $language->getObjectTplLanguage();
// if running shop language is different from admin lang. set in config
// we have to load shop in config language
if ($shop->getLanguage() != $orderLanguage) {
$shop = $this->_getShop($orderLanguage);
}
$this->setSmtp($shop);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("order", $order);
// Process view data array through oxoutput processor
$this->_processViewArray();
$this->setBody($smarty->fetch($config->getTemplatePath($this->_sOrderOwnerTemplate, false)));
$this->setAltBody($smarty->fetch($config->getTemplatePath($this->_sOrderOwnerPlainTemplate, false)));
//Sets subject to email
// #586A
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;
} | [
"public",
"function",
"sendOrderEmailToOwner",
"(",
"$",
"order",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"shop",
"=",
"$",
"this",
"->",
"_getShop",
"(",
")",
";",
"// cleanup"... | Sets mailer additional settings and sends ordering mail to shop owner.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\Order $order Order object
@param string $subject user defined subject [optional]
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"ordering",
"mail",
"to",
"shop",
"owner",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L556-L623 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.onOrderEmailToOwnerSent | protected function onOrderEmailToOwnerSent($user, $order)
{
// add user history
$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();
} | php | protected function onOrderEmailToOwnerSent($user, $order)
{
// add user history
$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();
} | [
"protected",
"function",
"onOrderEmailToOwnerSent",
"(",
"$",
"user",
",",
"$",
"order",
")",
"{",
"// add user history",
"$",
"remark",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Remark",
"::",
"class",
... | Method is called when order email is sent to owner.
@param \OxidEsales\Eshop\Application\Model\User $user
@param \OxidEsales\Eshop\Application\Model\Order $order | [
"Method",
"is",
"called",
"when",
"order",
"email",
"is",
"sent",
"to",
"owner",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L631-L639 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendForgotPwdEmail | 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)) {
// create messages
$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; // failed to send
} else {
$result = true; // success
}
}
return $result;
} | php | 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)) {
// create messages
$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; // failed to send
} else {
$result = true; // success
}
}
return $result;
} | [
"public",
"function",
"sendForgotPwdEmail",
"(",
"$",
"emailAddress",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"shop",
"=",
"$",
"this",
"->",
"_addForgotPwdEmail",
"(",
"$",
"this",
"->",
"_getShop",
"(",
")",
... | Sets mailer additional settings and sends "forgot password" mail to user.
Returns true on success.
@param string $emailAddress user email address
@param string $subject user defined subject [optional]
@return mixed true - success, false - user not found, -1 - could not send | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"forgot",
"password",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L710-L743 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendContactMail | public function sendContactMail($emailAddress = null, $subject = null, $message = null)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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();
} | php | public function sendContactMail($emailAddress = null, $subject = null, $message = null)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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();
} | [
"public",
"function",
"sendContactMail",
"(",
"$",
"emailAddress",
"=",
"null",
",",
"$",
"subject",
"=",
"null",
",",
"$",
"message",
"=",
"null",
")",
"{",
"// shop info",
"$",
"shop",
"=",
"$",
"this",
"->",
"_getShop",
"(",
")",
";",
"//set mail para... | Sets mailer additional settings and sends contact info mail to user.
Returns true on success.
@param string $emailAddress Email address
@param string $subject Email subject
@param string $message Email message text
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"contact",
"info",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L755-L772 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendNewsletterDbOptInMail | public function sendNewsletterDbOptInMail($user, $subject = null)
{
// add user defined stuff if there is any
$user = $this->_addNewsletterDbOptInMail($user);
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
// create messages
$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);
// Process view data array through oxOutput processor
$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();
} | php | public function sendNewsletterDbOptInMail($user, $subject = null)
{
// add user defined stuff if there is any
$user = $this->_addNewsletterDbOptInMail($user);
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
// create messages
$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);
// Process view data array through oxOutput processor
$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();
} | [
"public",
"function",
"sendNewsletterDbOptInMail",
"(",
"$",
"user",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"// add user defined stuff if there is any",
"$",
"user",
"=",
"$",
"this",
"->",
"_addNewsletterDbOptInMail",
"(",
"$",
"user",
")",
";",
"// shop inf... | Sets mailer additional settings and sends "NewsletterDBOptInMail" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\User $user user object
@param string $subject user defined subject [optional]
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"NewsletterDBOptInMail",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L783-L814 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._getNewsSubsLink | 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;
} | php | 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;
} | [
"protected",
"function",
"_getNewsSubsLink",
"(",
"$",
"id",
",",
"$",
"confirmCode",
"=",
"null",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"actShopLang",
"=",
"$",
"myConfig",
"->",
"getActiveShop",
"(",
")",
"-... | Returns newsletter subscription link
@param string $id user id
@param string $confirmCode confirmation code
@return string $url | [
"Returns",
"newsletter",
"subscription",
"link"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L824-L834 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendNewsletterMail | public function sendNewsletterMail($newsLetter, $user, $subject = null)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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();
} | php | public function sendNewsletterMail($newsLetter, $user, $subject = null)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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();
} | [
"public",
"function",
"sendNewsletterMail",
"(",
"$",
"newsLetter",
",",
"$",
"user",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"// shop info",
"$",
"shop",
"=",
"$",
"this",
"->",
"_getShop",
"(",
")",
";",
"//set mail params (from, fromName, smtp)",
"$",
... | Sets mailer additional settings and sends "newsletter" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\Newsletter $newsLetter newsletter object
@param \OxidEsales\Eshop\Application\Model\User $user user object
@param string $subject user defined subject [optional]
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"newsletter",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L846-L871 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendSuggestMail | public function sendSuggestMail($user, $product)
{
$myConfig = Registry::getConfig();
//sets language of shop
$currLang = $myConfig->getActiveShop()->getLanguage();
// shop info
$shop = $this->_getShop($currLang);
//sets language to article
if ($product->getLanguage() != $currLang) {
$product->setLanguage($currLang);
$product->load($product->getId());
}
// mailer stuff
// send not pretending from suggesting user, as different email domain rise spam filters
$this->setFrom($shop->oxshops__oxinfoemail->value);
$this->setSmtp();
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $product);
$this->setUser($user);
$articleUrl = $product->getLink();
//setting recommended user id
if ($myConfig->getActiveView()->isActive('Invitations') && $activeUser = $shop->getUser()) {
$articleUrl = \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendParamSeparator($articleUrl);
$articleUrl .= "su=" . $activeUser->getId();
}
$this->setViewData("sArticleUrl", $articleUrl);
// Process view data array through oxOutput processor
$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();
} | php | public function sendSuggestMail($user, $product)
{
$myConfig = Registry::getConfig();
//sets language of shop
$currLang = $myConfig->getActiveShop()->getLanguage();
// shop info
$shop = $this->_getShop($currLang);
//sets language to article
if ($product->getLanguage() != $currLang) {
$product->setLanguage($currLang);
$product->load($product->getId());
}
// mailer stuff
// send not pretending from suggesting user, as different email domain rise spam filters
$this->setFrom($shop->oxshops__oxinfoemail->value);
$this->setSmtp();
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $product);
$this->setUser($user);
$articleUrl = $product->getLink();
//setting recommended user id
if ($myConfig->getActiveView()->isActive('Invitations') && $activeUser = $shop->getUser()) {
$articleUrl = \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendParamSeparator($articleUrl);
$articleUrl .= "su=" . $activeUser->getId();
}
$this->setViewData("sArticleUrl", $articleUrl);
// Process view data array through oxOutput processor
$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();
} | [
"public",
"function",
"sendSuggestMail",
"(",
"$",
"user",
",",
"$",
"product",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"//sets language of shop",
"$",
"currLang",
"=",
"$",
"myConfig",
"->",
"getActiveShop",
"(",
")",
... | Sets mailer additional settings and sends "SuggestMail" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\User $user Mailing parameters object
@param object $product Product object
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"SuggestMail",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L882-L929 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendInviteMail | public function sendInviteMail($user)
{
$myConfig = Registry::getConfig();
//sets language of shop
$currLang = $myConfig->getActiveShop()->getLanguage();
// shop info
$shop = $this->_getShop($currLang);
// mailer stuff
$this->setFrom($user->send_email, $user->send_name);
$this->setSmtp();
// create messages
$smarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
$this->setUser($user);
$homeUrl = $this->getViewConfig()->getHomeLink();
//setting recommended user id
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);
//setting recipient user email
$registerUrl .= "re=" . md5($email);
$this->setViewData("sHomeUrl", $registerUrl);
// Process view data array through oxoutput processor
$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;
} | php | public function sendInviteMail($user)
{
$myConfig = Registry::getConfig();
//sets language of shop
$currLang = $myConfig->getActiveShop()->getLanguage();
// shop info
$shop = $this->_getShop($currLang);
// mailer stuff
$this->setFrom($user->send_email, $user->send_name);
$this->setSmtp();
// create messages
$smarty = \OxidEsales\Eshop\Core\Registry::getUtilsView()->getSmarty();
$this->setUser($user);
$homeUrl = $this->getViewConfig()->getHomeLink();
//setting recommended user id
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);
//setting recipient user email
$registerUrl .= "re=" . md5($email);
$this->setViewData("sHomeUrl", $registerUrl);
// Process view data array through oxoutput processor
$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;
} | [
"public",
"function",
"sendInviteMail",
"(",
"$",
"user",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"//sets language of shop",
"$",
"currLang",
"=",
"$",
"myConfig",
"->",
"getActiveShop",
"(",
")",
"->",
"getLanguage",
"(... | Sets mailer additional settings and sends "InviteMail" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\User $user Mailing parameters object
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"InviteMail",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L939-L992 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendSendedNowMail | public function sendSendedNowMail($order, $subject = null)
{
$myConfig = Registry::getConfig();
$orderLang = (int) (isset($order->oxorder__oxlang->value) ? $order->oxorder__oxlang->value : 0);
// shop info
$shop = $this->_getShop($orderLang);
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
//create messages
$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);
}
// Process view data array through oxoutput processor
$this->_processViewArray();
// #1469 - we need to patch security here as we do not use standard template dir, so smarty stops working
$store['INCLUDE_ANY'] = $smarty->security_settings['INCLUDE_ANY'];
//V send email in order language
$oldTplLang = $lang->getTplLanguage();
$oldBaseLang = $lang->getBaseLanguage();
$lang->setTplLanguage($orderLang);
$lang->setBaseLanguage($orderLang);
$smarty->security_settings['INCLUDE_ANY'] = true;
// force non admin to get correct paths (tpl, img)
$myConfig->setAdminMode(false);
$this->setBody($smarty->fetch($this->_sSenedNowTemplate));
$this->setAltBody($smarty->fetch($this->_sSenedNowTemplatePlain));
$myConfig->setAdminMode(true);
$lang->setTplLanguage($oldTplLang);
$lang->setBaseLanguage($oldBaseLang);
// set it back
$smarty->security_settings['INCLUDE_ANY'] = $store['INCLUDE_ANY'];
//Sets subject to email
$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();
} | php | public function sendSendedNowMail($order, $subject = null)
{
$myConfig = Registry::getConfig();
$orderLang = (int) (isset($order->oxorder__oxlang->value) ? $order->oxorder__oxlang->value : 0);
// shop info
$shop = $this->_getShop($orderLang);
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
//create messages
$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);
}
// Process view data array through oxoutput processor
$this->_processViewArray();
// #1469 - we need to patch security here as we do not use standard template dir, so smarty stops working
$store['INCLUDE_ANY'] = $smarty->security_settings['INCLUDE_ANY'];
//V send email in order language
$oldTplLang = $lang->getTplLanguage();
$oldBaseLang = $lang->getBaseLanguage();
$lang->setTplLanguage($orderLang);
$lang->setBaseLanguage($orderLang);
$smarty->security_settings['INCLUDE_ANY'] = true;
// force non admin to get correct paths (tpl, img)
$myConfig->setAdminMode(false);
$this->setBody($smarty->fetch($this->_sSenedNowTemplate));
$this->setAltBody($smarty->fetch($this->_sSenedNowTemplatePlain));
$myConfig->setAdminMode(true);
$lang->setTplLanguage($oldTplLang);
$lang->setBaseLanguage($oldBaseLang);
// set it back
$smarty->security_settings['INCLUDE_ANY'] = $store['INCLUDE_ANY'];
//Sets subject to email
$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();
} | [
"public",
"function",
"sendSendedNowMail",
"(",
"$",
"order",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"$",
"myConfig",
"=",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"orderLang",
"=",
"(",
"int",
")",
"(",
"isset",
"(",
"$",
"order",
"->... | Sets mailer additional settings and sends "SendedNowMail" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\Order $order order object
@param string $subject user defined subject [optional]
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"SendedNowMail",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1003-L1060 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendBackupMail | public function sendBackupMail($attFiles, $attPath, $emailAddress, $subject, $message, &$status, &$error)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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, "");
//attaching files
$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]; //"Error: backup file $attFile not found";
}
}
if (!$attashSucc) {
$error[] = [4, ""]; //"Error: backup files was not sent to email ...";
$this->clearAttachments();
return false;
}
$status[] = 3; //"Mailing backup files ...";
$send = $this->send();
$this->clearAttachments();
return $send;
} | php | public function sendBackupMail($attFiles, $attPath, $emailAddress, $subject, $message, &$status, &$error)
{
// shop info
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$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, "");
//attaching files
$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]; //"Error: backup file $attFile not found";
}
}
if (!$attashSucc) {
$error[] = [4, ""]; //"Error: backup files was not sent to email ...";
$this->clearAttachments();
return false;
}
$status[] = 3; //"Mailing backup files ...";
$send = $this->send();
$this->clearAttachments();
return $send;
} | [
"public",
"function",
"sendBackupMail",
"(",
"$",
"attFiles",
",",
"$",
"attPath",
",",
"$",
"emailAddress",
",",
"$",
"subject",
",",
"$",
"message",
",",
"&",
"$",
"status",
",",
"&",
"$",
"error",
")",
"{",
"// shop info",
"$",
"shop",
"=",
"$",
"... | Sets mailer additional settings and sends backup data to user.
Returns true on success.
@param array $attFiles Array of file names to attach
@param string $attPath Path to files to attach
@param string $emailAddress Email address
@param string $subject Email subject
@param string $message Email body message
@param array $status Pointer to mailing status array
@param array $error Pointer to error status array
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"backup",
"data",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1139-L1181 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendEmail | public function sendEmail($to, $subject, $body)
{
//set mail params (from, fromName, smtp)
$this->_setMailParams();
if (is_array($to)) {
foreach ($to as $address) {
$this->setRecipient($address, "");
$this->setReplyTo($address, "");
}
} else {
$this->setRecipient($to, "");
$this->setReplyTo($to, "");
}
//may be changed later
$this->isHTML(false);
$this->setSubject($subject);
$this->setBody($body);
return $this->send();
} | php | public function sendEmail($to, $subject, $body)
{
//set mail params (from, fromName, smtp)
$this->_setMailParams();
if (is_array($to)) {
foreach ($to as $address) {
$this->setRecipient($address, "");
$this->setReplyTo($address, "");
}
} else {
$this->setRecipient($to, "");
$this->setReplyTo($to, "");
}
//may be changed later
$this->isHTML(false);
$this->setSubject($subject);
$this->setBody($body);
return $this->send();
} | [
"public",
"function",
"sendEmail",
"(",
"$",
"to",
",",
"$",
"subject",
",",
"$",
"body",
")",
"{",
"//set mail params (from, fromName, smtp)",
"$",
"this",
"->",
"_setMailParams",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"to",
")",
")",
"{",
"for... | Basic wrapper for email message sending with default parameters from the oxBaseShop.
Returns true on success.
@param mixed $to Recipient or an array of the recipients
@param string $subject Mail subject
@param string $body Mail body
@return bool | [
"Basic",
"wrapper",
"for",
"email",
"message",
"sending",
"with",
"default",
"parameters",
"from",
"the",
"oxBaseShop",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1193-L1215 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendStockReminder | public function sendStockReminder($basketContents, $subject = null)
{
$send = false;
$articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$articleList->loadStockRemindProducts($basketContents);
// nothing to remind?
if ($articleList->count()) {
$shop = $this->_getShop();
//set mail params (from, fromName, smtp... )
$this->_setMailParams($shop);
$lang = \OxidEsales\Eshop\Core\Registry::getLang();
$smarty = $this->_getSmarty();
$this->setViewData("articles", $articleList);
// Process view data array through oxOutput processor
$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;
} | php | public function sendStockReminder($basketContents, $subject = null)
{
$send = false;
$articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$articleList->loadStockRemindProducts($basketContents);
// nothing to remind?
if ($articleList->count()) {
$shop = $this->_getShop();
//set mail params (from, fromName, smtp... )
$this->_setMailParams($shop);
$lang = \OxidEsales\Eshop\Core\Registry::getLang();
$smarty = $this->_getSmarty();
$this->setViewData("articles", $articleList);
// Process view data array through oxOutput processor
$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;
} | [
"public",
"function",
"sendStockReminder",
"(",
"$",
"basketContents",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"$",
"send",
"=",
"false",
";",
"$",
"articleList",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",... | Sends reminder email to shop owner.
@param array $basketContents array of objects to pass to template
@param string $subject user defined subject [optional]
@return bool | [
"Sends",
"reminder",
"email",
"to",
"shop",
"owner",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1225-L1256 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendWishlistMail | public function sendWishlistMail($params)
{
$this->_clearMailer();
// mailer stuff
$this->setFrom($params->send_email, $params->send_name);
$this->setSmtp();
// create messages
$smarty = $this->_getSmarty();
$this->setUser($params);
// Process view data array through oxoutput processor
$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();
} | php | public function sendWishlistMail($params)
{
$this->_clearMailer();
// mailer stuff
$this->setFrom($params->send_email, $params->send_name);
$this->setSmtp();
// create messages
$smarty = $this->_getSmarty();
$this->setUser($params);
// Process view data array through oxoutput processor
$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();
} | [
"public",
"function",
"sendWishlistMail",
"(",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"_clearMailer",
"(",
")",
";",
"// mailer stuff",
"$",
"this",
"->",
"setFrom",
"(",
"$",
"params",
"->",
"send_email",
",",
"$",
"params",
"->",
"send_name",
")",
... | Sets mailer additional settings and sends "WishlistMail" mail to user.
Returns true on success.
@param \OxidEsales\Eshop\Application\Model\User|object $params Mailing parameters object
@return bool | [
"Sets",
"mailer",
"additional",
"settings",
"and",
"sends",
"WishlistMail",
"mail",
"to",
"user",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1266-L1289 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendPriceAlarmNotification | public function sendPriceAlarmNotification($params, $alarm, $subject = null)
{
$this->_clearMailer();
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
$alarmLang = $alarm->oxpricealarm__oxlang->value;
$article = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
//$article->setSkipAbPrice( true );
$article->loadInLang($alarmLang, $params['aid']);
$lang = \OxidEsales\Eshop\Core\Registry::getLang();
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $article);
$this->setViewData("email", $params['email']);
$this->setViewData("bidprice", $lang->formatCurrency($alarm->oxpricealarm__oxprice->value));
// Process view data array through oxOutput processor
$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();
} | php | public function sendPriceAlarmNotification($params, $alarm, $subject = null)
{
$this->_clearMailer();
$shop = $this->_getShop();
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
$alarmLang = $alarm->oxpricealarm__oxlang->value;
$article = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
//$article->setSkipAbPrice( true );
$article->loadInLang($alarmLang, $params['aid']);
$lang = \OxidEsales\Eshop\Core\Registry::getLang();
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $article);
$this->setViewData("email", $params['email']);
$this->setViewData("bidprice", $lang->formatCurrency($alarm->oxpricealarm__oxprice->value));
// Process view data array through oxOutput processor
$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();
} | [
"public",
"function",
"sendPriceAlarmNotification",
"(",
"$",
"params",
",",
"$",
"alarm",
",",
"$",
"subject",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_clearMailer",
"(",
")",
";",
"$",
"shop",
"=",
"$",
"this",
"->",
"_getShop",
"(",
")",
";",
"... | Sends a notification to the shop owner that price alarm was subscribed.
Returns true on success.
@param array $params Parameters array
@param \OxidEsales\Eshop\Application\Model\PriceAlarm $alarm oxPriceAlarm object
@param string $subject user defined subject [optional]
@return bool | [
"Sends",
"a",
"notification",
"to",
"the",
"shop",
"owner",
"that",
"price",
"alarm",
"was",
"subscribed",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1301-L1332 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.sendPricealarmToCustomer | 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);
}
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $alarm->getArticle());
$this->setViewData("oPriceAlarm", $alarm);
$this->setViewData("bidprice", $alarm->getFProposedPrice());
$this->setViewData("currency", $alarm->getPriceAlarmCurrency());
// Process view data array through oxoutput processor
$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();
}
} | php | 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);
}
//set mail params (from, fromName, smtp)
$this->_setMailParams($shop);
// create messages
$smarty = $this->_getSmarty();
$this->setViewData("product", $alarm->getArticle());
$this->setViewData("oPriceAlarm", $alarm);
$this->setViewData("bidprice", $alarm->getFProposedPrice());
$this->setViewData("currency", $alarm->getPriceAlarmCurrency());
// Process view data array through oxoutput processor
$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();
}
} | [
"public",
"function",
"sendPricealarmToCustomer",
"(",
"$",
"recipient",
",",
"$",
"alarm",
",",
"$",
"body",
"=",
"null",
",",
"$",
"returnMailBody",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_clearMailer",
"(",
")",
";",
"$",
"shop",
"=",
"$",
"this... | Sends price alarm to customer.
Returns true on success.
@param string $recipient email
@param \OxidEsales\Eshop\Application\Model\PriceAlarm $alarm oxPriceAlarm object
@param string $body optional mail body
@param bool $returnMailBody returns mail body instead of sending
@return bool | [
"Sends",
"price",
"alarm",
"to",
"customer",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1345-L1388 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.setAltBody | public function setAltBody($altBody = null, $clearSid = true)
{
if ($clearSid) {
$altBody = $this->_clearSidFromBody($altBody);
}
// A. alt body is used for plain text emails so we should eliminate HTML entities
$altBody = str_replace(['&', '"', ''', '<', '>'], ['&', '"', "'", '<', '>'], $altBody);
$this->set("AltBody", $altBody);
} | php | public function setAltBody($altBody = null, $clearSid = true)
{
if ($clearSid) {
$altBody = $this->_clearSidFromBody($altBody);
}
// A. alt body is used for plain text emails so we should eliminate HTML entities
$altBody = str_replace(['&', '"', ''', '<', '>'], ['&', '"', "'", '<', '>'], $altBody);
$this->set("AltBody", $altBody);
} | [
"public",
"function",
"setAltBody",
"(",
"$",
"altBody",
"=",
"null",
",",
"$",
"clearSid",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"clearSid",
")",
"{",
"$",
"altBody",
"=",
"$",
"this",
"->",
"_clearSidFromBody",
"(",
"$",
"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.
@param string $altBody mail subject
@param bool $clearSid clear sid in mail body (default value is true) | [
"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",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1518-L1528 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.setRecipient | public function setRecipient($address = null, $name = null)
{
try {
$address = $this->idnToAscii($address);
parent::addAddress($address, $name);
// copying values as original class does not allow to access recipients array
$this->_aRecipients[] = [$address, $name];
} catch (Exception $exception) {
}
} | php | public function setRecipient($address = null, $name = null)
{
try {
$address = $this->idnToAscii($address);
parent::addAddress($address, $name);
// copying values as original class does not allow to access recipients array
$this->_aRecipients[] = [$address, $name];
} catch (Exception $exception) {
}
} | [
"public",
"function",
"setRecipient",
"(",
"$",
"address",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"address",
"=",
"$",
"this",
"->",
"idnToAscii",
"(",
"$",
"address",
")",
";",
"parent",
"::",
"addAddress",
"(",
"$",
... | Sets mail recipient to recipients array
@param string $address recipient email address
@param string $name recipient name | [
"Sets",
"mail",
"recipient",
"to",
"recipients",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1546-L1557 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.headerLine | public function headerLine($name, $value)
{
if (stripos($name, 'X-') !== false) {
return null;
}
return parent::headerLine($name, $value);
} | php | public function headerLine($name, $value)
{
if (stripos($name, 'X-') !== false) {
return null;
}
return parent::headerLine($name, $value);
} | [
"public",
"function",
"headerLine",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"name",
",",
"'X-'",
")",
"!==",
"false",
")",
"{",
"return",
"null",
";",
"}",
"return",
"parent",
"::",
"headerLine",
"(",
"$",
"na... | Inherited phpMailer function adding a header to email message.
We override it to skip X-Mailer header.
@param string $name header name
@param string $value header value
@return string|null | [
"Inherited",
"phpMailer",
"function",
"adding",
"a",
"header",
"to",
"email",
"message",
".",
"We",
"override",
"it",
"to",
"skip",
"X",
"-",
"Mailer",
"header",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1829-L1836 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._setMailParams | 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);
} | php | 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);
} | [
"protected",
"function",
"_setMailParams",
"(",
"$",
"shop",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_clearMailer",
"(",
")",
";",
"if",
"(",
"!",
"$",
"shop",
")",
"{",
"$",
"shop",
"=",
"$",
"this",
"->",
"_getShop",
"(",
")",
";",
"}",
"$",... | Set mail From, FromName, SMTP values
@param \OxidEsales\Eshop\Application\Model\Shop $shop Shop object | [
"Set",
"mail",
"From",
"FromName",
"SMTP",
"values"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1946-L1956 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._getShop | 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;
} | php | 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;
} | [
"protected",
"function",
"_getShop",
"(",
"$",
"langId",
"=",
"null",
",",
"$",
"shopId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"langId",
"===",
"null",
"&&",
"$",
"shopId",
"===",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_... | Get active shop and set global params for it
If is set language parameter, load shop in given language
@param int $langId language id
@param int $shopId shop id
@return \OxidEsales\Eshop\Application\Model\Shop | [
"Get",
"active",
"shop",
"and",
"set",
"global",
"params",
"for",
"it",
"If",
"is",
"set",
"language",
"parameter",
"load",
"shop",
"in",
"given",
"language"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1967-L1989 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._setSmtpAuthInfo | protected function _setSmtpAuthInfo($userName = null, $userPassword = null)
{
$this->set("SMTPAuth", true);
$this->set("Username", $userName);
$this->set("Password", $userPassword);
} | php | protected function _setSmtpAuthInfo($userName = null, $userPassword = null)
{
$this->set("SMTPAuth", true);
$this->set("Username", $userName);
$this->set("Password", $userPassword);
} | [
"protected",
"function",
"_setSmtpAuthInfo",
"(",
"$",
"userName",
"=",
"null",
",",
"$",
"userPassword",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"\"SMTPAuth\"",
",",
"true",
")",
";",
"$",
"this",
"->",
"set",
"(",
"\"Username\"",
",",
"... | Sets smtp authentification parameters.
@param string $userName smtp user
@param \OxidEsales\Eshop\Application\Model\Shop $userPassword smtp password | [
"Sets",
"smtp",
"authentification",
"parameters",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L1997-L2002 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._sendMail | 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;
} | php | 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;
} | [
"protected",
"function",
"_sendMail",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"try",
"{",
"$",
"result",
"=",
"parent",
"::",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"exception",
")",
"{",
"$",
"ex",
"=",
"oxNew",
"(",
... | Sends email via phpmailer.
@return bool | [
"Sends",
"email",
"via",
"phpmailer",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L2031-L2047 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email._processViewArray | protected function _processViewArray()
{
$smarty = $this->_getSmarty();
$outputProcessor = oxNew(\OxidEsales\Eshop\Core\Output::class);
// processing all view data
foreach ($this->_aViewData as $key => $value) {
$smarty->assign($key, $value);
}
// processing assigned smarty variables
$newSmartyArray = $outputProcessor->processViewArray($smarty->get_template_vars(), "oxemail");
foreach ($newSmartyArray as $key => $val) {
$smarty->assign($key, $val);
}
} | php | protected function _processViewArray()
{
$smarty = $this->_getSmarty();
$outputProcessor = oxNew(\OxidEsales\Eshop\Core\Output::class);
// processing all view data
foreach ($this->_aViewData as $key => $value) {
$smarty->assign($key, $value);
}
// processing assigned smarty variables
$newSmartyArray = $outputProcessor->processViewArray($smarty->get_template_vars(), "oxemail");
foreach ($newSmartyArray as $key => $val) {
$smarty->assign($key, $val);
}
} | [
"protected",
"function",
"_processViewArray",
"(",
")",
"{",
"$",
"smarty",
"=",
"$",
"this",
"->",
"_getSmarty",
"(",
")",
";",
"$",
"outputProcessor",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Output",
"::",
"class",
")... | Process view data array through oxOutput processor | [
"Process",
"view",
"data",
"array",
"through",
"oxOutput",
"processor"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L2053-L2069 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.getCharset | public function getCharset()
{
if (!$this->_sCharSet) {
return \OxidEsales\Eshop\Core\Registry::getLang()->translateString("charset");
} else {
return $this->CharSet;
}
} | php | public function getCharset()
{
if (!$this->_sCharSet) {
return \OxidEsales\Eshop\Core\Registry::getLang()->translateString("charset");
} else {
return $this->CharSet;
}
} | [
"public",
"function",
"getCharset",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sCharSet",
")",
"{",
"return",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"translateString",
"(",
"\"charset\... | Get mail charset
@return string | [
"Get",
"mail",
"charset"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L2076-L2083 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.getOrderFileList | public function getOrderFileList($orderId)
{
$orderFileList = oxNew(OrderFileList::class);
$orderFileList->loadOrderFiles($orderId);
if (count($orderFileList) > 0) {
return $orderFileList;
}
return false;
} | php | public function getOrderFileList($orderId)
{
$orderFileList = oxNew(OrderFileList::class);
$orderFileList->loadOrderFiles($orderId);
if (count($orderFileList) > 0) {
return $orderFileList;
}
return false;
} | [
"public",
"function",
"getOrderFileList",
"(",
"$",
"orderId",
")",
"{",
"$",
"orderFileList",
"=",
"oxNew",
"(",
"OrderFileList",
"::",
"class",
")",
";",
"$",
"orderFileList",
"->",
"loadOrderFiles",
"(",
"$",
"orderId",
")",
";",
"if",
"(",
"count",
"("... | Get order files
@param string $orderId order id
@return bool|OrderFileList | [
"Get",
"order",
"files"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L2199-L2209 | train |
OXID-eSales/oxideshop_ce | source/Core/Email.php | Email.idnToAscii | private function idnToAscii($idn)
{
if (function_exists('idn_to_ascii')) {
// for old PHP versions support
// remove it after the PHP 7.1 support is dropped
if (defined('INTL_IDNA_VARIANT_UTS46')) {
return idn_to_ascii($idn, 0, INTL_IDNA_VARIANT_UTS46);
}
return idn_to_ascii($idn);
}
return $idn;
} | php | private function idnToAscii($idn)
{
if (function_exists('idn_to_ascii')) {
// for old PHP versions support
// remove it after the PHP 7.1 support is dropped
if (defined('INTL_IDNA_VARIANT_UTS46')) {
return idn_to_ascii($idn, 0, INTL_IDNA_VARIANT_UTS46);
}
return idn_to_ascii($idn);
}
return $idn;
} | [
"private",
"function",
"idnToAscii",
"(",
"$",
"idn",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'idn_to_ascii'",
")",
")",
"{",
"// for old PHP versions support",
"// remove it after the PHP 7.1 support is dropped",
"if",
"(",
"defined",
"(",
"'INTL_IDNA_VARIANT_UTS46... | Convert domain name to IDNA ASCII form.
@param string $idn The email address
@return string | [
"Convert",
"domain",
"name",
"to",
"IDNA",
"ASCII",
"form",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Email.php#L2289-L2302 | train |
OXID-eSales/oxideshop_ce | source/Core/Module/ModuleTranslationPathFinder.php | ModuleTranslationPathFinder.findTranslationPath | 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;
} | php | 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;
} | [
"public",
"function",
"findTranslationPath",
"(",
"$",
"language",
",",
"$",
"admin",
",",
"$",
"modulePath",
")",
"{",
"$",
"fullPath",
"=",
"$",
"this",
"->",
"getModulesDirectory",
"(",
")",
".",
"$",
"modulePath",
";",
"if",
"(",
"$",
"this",
"->",
... | Find the full path of the translation in the given module.
@param string $language The language short form. (e.g. 'de')
@param bool $admin Are we searching for the admin files?
@param string $modulePath The relative (to the module directory) path to the module, in which we want to find the translations file.
@return string | [
"Find",
"the",
"full",
"path",
"of",
"the",
"translation",
"in",
"the",
"given",
"module",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Module/ModuleTranslationPathFinder.php#L29-L44 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Rating.php | Rating.allowRating | 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;
} | php | 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;
} | [
"public",
"function",
"allowRating",
"(",
"$",
"sUserId",
",",
"$",
"sType",
",",
"$",
"sObjectId",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"myConfig",
"="... | Checks if user can rate product.
@param string $sUserId user id
@param string $sType object type
@param string $sObjectId object id
@return bool | [
"Checks",
"if",
"user",
"can",
"rate",
"product",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Rating.php#L50-L65 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Rating.php | Rating.getRatingAverage | 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;
} | php | 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;
} | [
"public",
"function",
"getRatingAverage",
"(",
"$",
"sObjectId",
",",
"$",
"sType",
",",
"$",
"aIncludedObjectsIds",
"=",
"null",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",... | calculates and return objects rating
@param string $sObjectId object id
@param string $sType object type
@param array $aIncludedObjectsIds array of ids
@return float | [
"calculates",
"and",
"return",
"objects",
"rating"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Rating.php#L77-L101 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Rating.php | Rating.getRatingCount | 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";
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$iCount = $masterDb->getOne($sSelect);
return $iCount;
} | php | 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";
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
$iCount = $masterDb->getOne($sSelect);
return $iCount;
} | [
"public",
"function",
"getRatingCount",
"(",
"$",
"sObjectId",
",",
"$",
"sType",
",",
"$",
"aIncludedObjectsIds",
"=",
"null",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
... | calculates and return objects rating count
@param string $sObjectId object id
@param string $sType object type
@param array $aIncludedObjectsIds array of ids
@return integer | [
"calculates",
"and",
"return",
"objects",
"rating",
"count"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Rating.php#L112-L135 | train |
OXID-eSales/oxideshop_ce | source/Core/Module/ModuleVariablesLocator.php | ModuleVariablesLocator.setModuleVariable | public function setModuleVariable($name, $value)
{
if (is_null($value)) {
self::$moduleVariables = null;
} else {
self::$moduleVariables[$name] = $value;
}
$this->getFileCache()->setToCache($name, $value);
} | php | public function setModuleVariable($name, $value)
{
if (is_null($value)) {
self::$moduleVariables = null;
} else {
self::$moduleVariables[$name] = $value;
}
$this->getFileCache()->setToCache($name, $value);
} | [
"public",
"function",
"setModuleVariable",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"self",
"::",
"$",
"moduleVariables",
"=",
"null",
";",
"}",
"else",
"{",
"self",
"::",
"$",
"moduleVari... | Sets module information variable. The variable is set statically and is not saved for future.
@param string $name Configuration array name
@param array $value Module name values | [
"Sets",
"module",
"information",
"variable",
".",
"The",
"variable",
"is",
"set",
"statically",
"and",
"is",
"not",
"saved",
"for",
"future",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Module/ModuleVariablesLocator.php#L77-L86 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.