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/Core/UtilsFile.php | UtilsFile._copyFile | protected function _copyFile($sSource, $sTarget)
{
if (!is_dir(dirname($sTarget))) {
mkdir(dirname($sTarget), 0744, true);
}
$blDone = true;
if ($sSource !== $sTarget) {
$blDone = copy($sSource, $sTarget);
}
if ($blDone) {
$blDone = @chmod($sTarget, 0644);
}
return $blDone;
} | php | protected function _copyFile($sSource, $sTarget)
{
if (!is_dir(dirname($sTarget))) {
mkdir(dirname($sTarget), 0744, true);
}
$blDone = true;
if ($sSource !== $sTarget) {
$blDone = copy($sSource, $sTarget);
}
if ($blDone) {
$blDone = @chmod($sTarget, 0644);
}
return $blDone;
} | [
"protected",
"function",
"_copyFile",
"(",
"$",
"sSource",
",",
"$",
"sTarget",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"dirname",
"(",
"$",
"sTarget",
")",
")",
")",
"{",
"mkdir",
"(",
"dirname",
"(",
"$",
"sTarget",
")",
",",
"0744",
",",
"true"... | Copy file from source to target location
@param string $sSource file location
@param string $sTarget file location
@return bool | [
"Copy",
"file",
"from",
"source",
"to",
"target",
"location"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L349-L365 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile._moveImage | protected function _moveImage($sSource, $sTarget)
{
if (!is_dir(dirname($sTarget))) {
mkdir(dirname($sTarget), 0744, true);
}
$blDone = true;
if ($sSource !== $sTarget) {
$blDone = move_uploaded_file($sSource, $sTarget);
}
if ($blDone) {
$blDone = @chmod($sTarget, 0644);
}
return $blDone;
} | php | protected function _moveImage($sSource, $sTarget)
{
if (!is_dir(dirname($sTarget))) {
mkdir(dirname($sTarget), 0744, true);
}
$blDone = true;
if ($sSource !== $sTarget) {
$blDone = move_uploaded_file($sSource, $sTarget);
}
if ($blDone) {
$blDone = @chmod($sTarget, 0644);
}
return $blDone;
} | [
"protected",
"function",
"_moveImage",
"(",
"$",
"sSource",
",",
"$",
"sTarget",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"dirname",
"(",
"$",
"sTarget",
")",
")",
")",
"{",
"mkdir",
"(",
"dirname",
"(",
"$",
"sTarget",
")",
",",
"0744",
",",
"true... | Moves image from source to target location
@param string $sSource image location
@param string $sTarget image copy location
@return bool | [
"Moves",
"image",
"from",
"source",
"to",
"target",
"location"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L375-L391 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.checkFile | public function checkFile($sFile)
{
$aCheckCache = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("checkcache");
if (isset($aCheckCache[$sFile])) {
return $aCheckCache[$sFile];
}
$blRet = true;
if (!is_readable($sFile)) {
$blRet = $this->urlValidate($sFile);
}
$aCheckCache[$sFile] = $blRet;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("checkcache", $aCheckCache);
return $blRet;
} | php | public function checkFile($sFile)
{
$aCheckCache = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("checkcache");
if (isset($aCheckCache[$sFile])) {
return $aCheckCache[$sFile];
}
$blRet = true;
if (!is_readable($sFile)) {
$blRet = $this->urlValidate($sFile);
}
$aCheckCache[$sFile] = $blRet;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("checkcache", $aCheckCache);
return $blRet;
} | [
"public",
"function",
"checkFile",
"(",
"$",
"sFile",
")",
"{",
"$",
"aCheckCache",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"\"checkcache\"",
")",
";",
"if",
"(",
"is... | Checks if passed file exists and may be opened for reading. Returns true
on success.
@param string $sFile Name of file to check
@return bool | [
"Checks",
"if",
"passed",
"file",
"exists",
"and",
"may",
"be",
"opened",
"for",
"reading",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L479-L496 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.processFile | public function processFile($sFileName, $sUploadPath)
{
$aFileInfo = $_FILES[$sFileName];
$sBasePath = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir');
//checking params
if (!isset($aFileInfo['name']) || !isset($aFileInfo['tmp_name'])) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_NOFILE');
}
//wrong chars in file name?
if (!getStr()->preg_match('/^[\-_a-z0-9\.]+$/i', $aFileInfo['name'])) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_FILENAMEINVALIDCHARS');
}
// error uploading file ?
if (isset($aFileInfo['error']) && $aFileInfo['error']) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_FILEUPLOADERROR_' . ((int) $aFileInfo['error']));
}
$aPathInfo = pathinfo($aFileInfo['name']);
$sExt = $aPathInfo['extension'];
$sFileName = $aPathInfo['filename'];
$aAllowedUploadTypes = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aAllowedUploadTypes');
$aAllowedUploadTypes = array_map("strtolower", $aAllowedUploadTypes);
if (!in_array(strtolower($sExt), $aAllowedUploadTypes)) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_NOTALLOWEDTYPE');
}
$sFileName = $this->_getUniqueFileName($sBasePath . $sUploadPath, $sFileName, $sExt);
if ($this->_moveImage($aFileInfo['tmp_name'], $sBasePath . $sUploadPath . "/" . $sFileName)) {
return $sFileName;
}
return false;
} | php | public function processFile($sFileName, $sUploadPath)
{
$aFileInfo = $_FILES[$sFileName];
$sBasePath = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir');
//checking params
if (!isset($aFileInfo['name']) || !isset($aFileInfo['tmp_name'])) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_NOFILE');
}
//wrong chars in file name?
if (!getStr()->preg_match('/^[\-_a-z0-9\.]+$/i', $aFileInfo['name'])) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_FILENAMEINVALIDCHARS');
}
// error uploading file ?
if (isset($aFileInfo['error']) && $aFileInfo['error']) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_FILEUPLOADERROR_' . ((int) $aFileInfo['error']));
}
$aPathInfo = pathinfo($aFileInfo['name']);
$sExt = $aPathInfo['extension'];
$sFileName = $aPathInfo['filename'];
$aAllowedUploadTypes = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aAllowedUploadTypes');
$aAllowedUploadTypes = array_map("strtolower", $aAllowedUploadTypes);
if (!in_array(strtolower($sExt), $aAllowedUploadTypes)) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'EXCEPTION_NOTALLOWEDTYPE');
}
$sFileName = $this->_getUniqueFileName($sBasePath . $sUploadPath, $sFileName, $sExt);
if ($this->_moveImage($aFileInfo['tmp_name'], $sBasePath . $sUploadPath . "/" . $sFileName)) {
return $sFileName;
}
return false;
} | [
"public",
"function",
"processFile",
"(",
"$",
"sFileName",
",",
"$",
"sUploadPath",
")",
"{",
"$",
"aFileInfo",
"=",
"$",
"_FILES",
"[",
"$",
"sFileName",
"]",
";",
"$",
"sBasePath",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry"... | Process uploaded files. Returns unique file name, on fail false
@param string $sFileName form file item name
@param string $sUploadPath RELATIVE (to config sShopDir parameter) path for uploaded file to be copied
@throws oxException if file is not valid
@return string | [
"Process",
"uploaded",
"files",
".",
"Returns",
"unique",
"file",
"name",
"on",
"fail",
"false"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L541-L581 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile._getUniqueFileName | protected function _getUniqueFileName($sFilePath, $sFileName, $sFileExt, $sSufix = "", $blUnique = true)
{
$sFilePath = $this->normalizeDir($sFilePath);
$iFileCounter = 0;
$sTempFileName = $sFileName;
$oStr = getStr();
//file exists ?
while ($blUnique && file_exists($sFilePath . "/" . $sFileName . $sSufix . "." . $sFileExt)) {
$iFileCounter++;
//removing "(any digit)" from file name end
$sTempFileName = $oStr->preg_replace("/\(" . $iFileCounter . "\)/", "", $sTempFileName);
$sFileName = $sTempFileName . "($iFileCounter)";
}
return $sFileName . $sSufix . "." . $sFileExt;
} | php | protected function _getUniqueFileName($sFilePath, $sFileName, $sFileExt, $sSufix = "", $blUnique = true)
{
$sFilePath = $this->normalizeDir($sFilePath);
$iFileCounter = 0;
$sTempFileName = $sFileName;
$oStr = getStr();
//file exists ?
while ($blUnique && file_exists($sFilePath . "/" . $sFileName . $sSufix . "." . $sFileExt)) {
$iFileCounter++;
//removing "(any digit)" from file name end
$sTempFileName = $oStr->preg_replace("/\(" . $iFileCounter . "\)/", "", $sTempFileName);
$sFileName = $sTempFileName . "($iFileCounter)";
}
return $sFileName . $sSufix . "." . $sFileExt;
} | [
"protected",
"function",
"_getUniqueFileName",
"(",
"$",
"sFilePath",
",",
"$",
"sFileName",
",",
"$",
"sFileExt",
",",
"$",
"sSufix",
"=",
"\"\"",
",",
"$",
"blUnique",
"=",
"true",
")",
"{",
"$",
"sFilePath",
"=",
"$",
"this",
"->",
"normalizeDir",
"("... | Checks if file with same name does not exist, if exists - addes number prefix
to file name Returns unique file name.
@param string $sFilePath file storage path/folder (e.g. /htdocs/out/img/)
@param string $sFileName name of file (e.g. picture1)
@param string $sFileExt file extension (e.g. gif)
@param string $sSufix file name sufix (e.g. _ico)
@param bool $blUnique TRUE - generates unique file name, FALSE - just glues given parts of file name
@return string | [
"Checks",
"if",
"file",
"with",
"same",
"name",
"does",
"not",
"exist",
"if",
"exists",
"-",
"addes",
"number",
"prefix",
"to",
"file",
"name",
"Returns",
"unique",
"file",
"name",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L595-L613 | train |
OXID-eSales/oxideshop_ce | source/Core/UtilsFile.php | UtilsFile.translateError | public function translateError($iError)
{
$message = '';
// Translate only if translation exist
if ($iError > 0 && $iError < 9 && 5 !== $iError) {
$message = 'EXCEPTION_FILEUPLOADERROR_' . ((int) $iError);
}
return $message;
} | php | public function translateError($iError)
{
$message = '';
// Translate only if translation exist
if ($iError > 0 && $iError < 9 && 5 !== $iError) {
$message = 'EXCEPTION_FILEUPLOADERROR_' . ((int) $iError);
}
return $message;
} | [
"public",
"function",
"translateError",
"(",
"$",
"iError",
")",
"{",
"$",
"message",
"=",
"''",
";",
"// Translate only if translation exist",
"if",
"(",
"$",
"iError",
">",
"0",
"&&",
"$",
"iError",
"<",
"9",
"&&",
"5",
"!==",
"$",
"iError",
")",
"{",
... | Translate php file upload errors to user readable format.
@param integer $iError php file upload error number
@return string | [
"Translate",
"php",
"file",
"upload",
"errors",
"to",
"user",
"readable",
"format",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/UtilsFile.php#L642-L651 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/CategoryUpdate.php | CategoryUpdate._getCategoryList | protected function _getCategoryList()
{
if ($this->_oCatList == null) {
$this->_oCatList = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->_oCatList->updateCategoryTree(false);
}
return $this->_oCatList;
} | php | protected function _getCategoryList()
{
if ($this->_oCatList == null) {
$this->_oCatList = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->_oCatList->updateCategoryTree(false);
}
return $this->_oCatList;
} | [
"protected",
"function",
"_getCategoryList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oCatList",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_oCatList",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",... | Returns category list object
@return oxCategoryList | [
"Returns",
"category",
"list",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/CategoryUpdate.php#L33-L41 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/UserAddress.php | UserAddress.save | public function save()
{
parent::save();
if ($this->_allowAdminEdit($this->getEditObjectId())) {
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oAdress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
if (isset($aParams['oxaddress__oxid']) && $aParams['oxaddress__oxid'] == "-1") {
$aParams['oxaddress__oxid'] = null;
} else {
$oAdress->load($aParams['oxaddress__oxid']);
}
$oAdress->assign($aParams);
$oAdress->save();
$this->sSavedOxid = $oAdress->getId();
}
} | php | public function save()
{
parent::save();
if ($this->_allowAdminEdit($this->getEditObjectId())) {
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$oAdress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
if (isset($aParams['oxaddress__oxid']) && $aParams['oxaddress__oxid'] == "-1") {
$aParams['oxaddress__oxid'] = null;
} else {
$oAdress->load($aParams['oxaddress__oxid']);
}
$oAdress->assign($aParams);
$oAdress->save();
$this->sSavedOxid = $oAdress->getId();
}
} | [
"public",
"function",
"save",
"(",
")",
"{",
"parent",
"::",
"save",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_allowAdminEdit",
"(",
"$",
"this",
"->",
"getEditObjectId",
"(",
")",
")",
")",
"{",
"$",
"aParams",
"=",
"\\",
"OxidEsales",
"\\",
... | Saves user addressing information. | [
"Saves",
"user",
"addressing",
"information",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/UserAddress.php#L80-L98 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/UserAddress.php | UserAddress.delAddress | public function delAddress()
{
$this->_blDelete = false;
if ($this->_allowAdminEdit($this->getEditObjectId())) {
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
if (isset($aParams['oxaddress__oxid']) && $aParams['oxaddress__oxid'] != "-1") {
$oAdress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
$this->_blDelete = $oAdress->delete($aParams['oxaddress__oxid']);
}
}
} | php | public function delAddress()
{
$this->_blDelete = false;
if ($this->_allowAdminEdit($this->getEditObjectId())) {
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
if (isset($aParams['oxaddress__oxid']) && $aParams['oxaddress__oxid'] != "-1") {
$oAdress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
$this->_blDelete = $oAdress->delete($aParams['oxaddress__oxid']);
}
}
} | [
"public",
"function",
"delAddress",
"(",
")",
"{",
"$",
"this",
"->",
"_blDelete",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"_allowAdminEdit",
"(",
"$",
"this",
"->",
"getEditObjectId",
"(",
")",
")",
")",
"{",
"$",
"aParams",
"=",
"\\",
"Oxi... | Deletes user addressing information. | [
"Deletes",
"user",
"addressing",
"information",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/UserAddress.php#L103-L113 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController.moveLeft | public function moveLeft() //#777C
{
$sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aid');
if ($sArticleId && ($aItems = $this->getCompareItems())) {
$sPrevArticleId = null;
$blFound = false;
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sArticleId) {
$blFound = true;
}
if (!$blFound) {
$sPrevArticleId = $sOxid;
}
}
if ($sPrevArticleId) {
$aNewItems = [];
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sPrevArticleId) {
$aNewItems[$sArticleId] = true;
} elseif ($sOxid == $sArticleId) {
$aNewItems[$sPrevArticleId] = true;
} else {
$aNewItems[$sOxid] = true;
}
}
$this->setCompareItems($aNewItems);
}
}
} | php | public function moveLeft() //#777C
{
$sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aid');
if ($sArticleId && ($aItems = $this->getCompareItems())) {
$sPrevArticleId = null;
$blFound = false;
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sArticleId) {
$blFound = true;
}
if (!$blFound) {
$sPrevArticleId = $sOxid;
}
}
if ($sPrevArticleId) {
$aNewItems = [];
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sPrevArticleId) {
$aNewItems[$sArticleId] = true;
} elseif ($sOxid == $sArticleId) {
$aNewItems[$sPrevArticleId] = true;
} else {
$aNewItems[$sOxid] = true;
}
}
$this->setCompareItems($aNewItems);
}
}
} | [
"public",
"function",
"moveLeft",
"(",
")",
"//#777C",
"{",
"$",
"sArticleId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'aid'",
")",
";",
"if",
"(",
"$",
"sArt... | moves current article to the left in compare items array | [
"moves",
"current",
"article",
"to",
"the",
"left",
"in",
"compare",
"items",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L108-L139 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController.moveRight | public function moveRight() //#777C
{
$sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aid');
if ($sArticleId && ($aItems = $this->getCompareItems())) {
$sNextArticleId = 0;
$blFound = false;
foreach ($aItems as $sOxid => $sVal) {
if ($blFound) {
$sNextArticleId = $sOxid;
$blFound = false;
}
if ($sOxid == $sArticleId) {
$blFound = true;
}
}
if ($sNextArticleId) {
$aNewItems = [];
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sArticleId) {
$aNewItems[$sNextArticleId] = true;
} elseif ($sOxid == $sNextArticleId) {
$aNewItems[$sArticleId] = true;
} else {
$aNewItems[$sOxid] = true;
}
}
$this->setCompareItems($aNewItems);
}
}
} | php | public function moveRight() //#777C
{
$sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aid');
if ($sArticleId && ($aItems = $this->getCompareItems())) {
$sNextArticleId = 0;
$blFound = false;
foreach ($aItems as $sOxid => $sVal) {
if ($blFound) {
$sNextArticleId = $sOxid;
$blFound = false;
}
if ($sOxid == $sArticleId) {
$blFound = true;
}
}
if ($sNextArticleId) {
$aNewItems = [];
foreach ($aItems as $sOxid => $sVal) {
if ($sOxid == $sArticleId) {
$aNewItems[$sNextArticleId] = true;
} elseif ($sOxid == $sNextArticleId) {
$aNewItems[$sArticleId] = true;
} else {
$aNewItems[$sOxid] = true;
}
}
$this->setCompareItems($aNewItems);
}
}
} | [
"public",
"function",
"moveRight",
"(",
")",
"//#777C",
"{",
"$",
"sArticleId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'aid'",
")",
";",
"if",
"(",
"$",
"sAr... | moves current article to the right in compare items array | [
"moves",
"current",
"article",
"to",
"the",
"right",
"in",
"compare",
"items",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L144-L175 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController.getCompArtList | public function getCompArtList()
{
if ($this->_oArtList === null) {
if (($aItems = $this->getCompareItems())) {
// counts how many pages
$oList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$oList->loadIds(array_keys($aItems));
// cut page articles
if ($this->_iArticlesPerPage > 0) {
$this->_iCntPages = ceil($oList->count() / $this->_iArticlesPerPage);
$aItems = $this->_removeArticlesFromPage($aItems, $oList);
}
$this->_oArtList = $this->_changeArtListOrder($aItems, $oList);
}
}
return $this->_oArtList;
} | php | public function getCompArtList()
{
if ($this->_oArtList === null) {
if (($aItems = $this->getCompareItems())) {
// counts how many pages
$oList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
$oList->loadIds(array_keys($aItems));
// cut page articles
if ($this->_iArticlesPerPage > 0) {
$this->_iCntPages = ceil($oList->count() / $this->_iArticlesPerPage);
$aItems = $this->_removeArticlesFromPage($aItems, $oList);
}
$this->_oArtList = $this->_changeArtListOrder($aItems, $oList);
}
}
return $this->_oArtList;
} | [
"public",
"function",
"getCompArtList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oArtList",
"===",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"aItems",
"=",
"$",
"this",
"->",
"getCompareItems",
"(",
")",
")",
")",
"{",
"// counts how many pages",
"$... | Template variable getter. Returns comparison's article
list in order per page
@return object | [
"Template",
"variable",
"getter",
".",
"Returns",
"comparison",
"s",
"article",
"list",
"in",
"order",
"per",
"page"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L266-L285 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController.getAttributeList | public function getAttributeList()
{
if ($this->_oAttributeList === null) {
$this->_oAttributeList = false;
if ($oArtList = $this->getCompArtList()) {
$aProductIds = array_keys($oArtList);
foreach ($oArtList as $oArticle) {
if ($oArticle->getParentId()) {
$aProductIds[] = $oArticle->getParentId();
}
}
$oAttributeList = oxNew(\OxidEsales\Eshop\Application\Model\AttributeList::class);
$this->_oAttributeList = $oAttributeList->loadAttributesByIds($aProductIds);
}
}
return $this->_oAttributeList;
} | php | public function getAttributeList()
{
if ($this->_oAttributeList === null) {
$this->_oAttributeList = false;
if ($oArtList = $this->getCompArtList()) {
$aProductIds = array_keys($oArtList);
foreach ($oArtList as $oArticle) {
if ($oArticle->getParentId()) {
$aProductIds[] = $oArticle->getParentId();
}
}
$oAttributeList = oxNew(\OxidEsales\Eshop\Application\Model\AttributeList::class);
$this->_oAttributeList = $oAttributeList->loadAttributesByIds($aProductIds);
}
}
return $this->_oAttributeList;
} | [
"public",
"function",
"getAttributeList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oAttributeList",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oAttributeList",
"=",
"false",
";",
"if",
"(",
"$",
"oArtList",
"=",
"$",
"this",
"->",
"getCompArtLis... | Template variable getter. Returns attribute list
@return object | [
"Template",
"variable",
"getter",
".",
"Returns",
"attribute",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L292-L309 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController._removeArticlesFromPage | protected function _removeArticlesFromPage($aItems, $oList)
{
//#1106S $aItems changed to $oList.
//2006-08-10 Alfonsas, compare arrows fixed, array position is very important here, preserve it.
$aListKeys = $oList->arrayKeys();
$aItemKeys = array_keys($aItems);
$aKeys = array_intersect($aItemKeys, $aListKeys);
$aNewItems = [];
$iActPage = $this->getActPage();
for ($i = $this->_iArticlesPerPage * $iActPage; $i < $this->_iArticlesPerPage * $iActPage + $this->_iArticlesPerPage; $i++) {
if (!isset($aKeys[$i])) {
break;
}
$aNewItems[$aKeys[$i]] = & $aItems[$aKeys[$i]];
}
return $aNewItems;
} | php | protected function _removeArticlesFromPage($aItems, $oList)
{
//#1106S $aItems changed to $oList.
//2006-08-10 Alfonsas, compare arrows fixed, array position is very important here, preserve it.
$aListKeys = $oList->arrayKeys();
$aItemKeys = array_keys($aItems);
$aKeys = array_intersect($aItemKeys, $aListKeys);
$aNewItems = [];
$iActPage = $this->getActPage();
for ($i = $this->_iArticlesPerPage * $iActPage; $i < $this->_iArticlesPerPage * $iActPage + $this->_iArticlesPerPage; $i++) {
if (!isset($aKeys[$i])) {
break;
}
$aNewItems[$aKeys[$i]] = & $aItems[$aKeys[$i]];
}
return $aNewItems;
} | [
"protected",
"function",
"_removeArticlesFromPage",
"(",
"$",
"aItems",
",",
"$",
"oList",
")",
"{",
"//#1106S $aItems changed to $oList.",
"//2006-08-10 Alfonsas, compare arrows fixed, array position is very important here, preserve it.",
"$",
"aListKeys",
"=",
"$",
"oList",
"->... | Cuts page articles
@param array $aItems article array
@param object $oList article list array
@return array $aNewItems | [
"Cuts",
"page",
"articles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L354-L371 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/CompareController.php | CompareController._changeArtListOrder | protected function _changeArtListOrder($aItems, $oList)
{
// #777C changing order of list elements, according to $aItems
$oNewList = [];
$iCnt = 0;
$iActPage = $this->getActPage();
foreach ($aItems as $sOxid => $sVal) {
//#4391T, skipping non loaded products
if (!isset($oList[$sOxid])) {
continue;
}
$iCnt++;
$oNewList[$sOxid] = $oList[$sOxid];
// hide arrow if article is first in the list
$oNewList[$sOxid]->hidePrev = false;
if ($iActPage == 0 && $iCnt == 1) {
$oNewList[$sOxid]->hidePrev = true;
}
// hide arrow if article is last in the list
$oNewList[$sOxid]->hideNext = false;
if (($iActPage + 1) == $this->_iCntPages && $iCnt == count($aItems)) {
$oNewList[$sOxid]->hideNext = true;
}
}
return $oNewList;
} | php | protected function _changeArtListOrder($aItems, $oList)
{
// #777C changing order of list elements, according to $aItems
$oNewList = [];
$iCnt = 0;
$iActPage = $this->getActPage();
foreach ($aItems as $sOxid => $sVal) {
//#4391T, skipping non loaded products
if (!isset($oList[$sOxid])) {
continue;
}
$iCnt++;
$oNewList[$sOxid] = $oList[$sOxid];
// hide arrow if article is first in the list
$oNewList[$sOxid]->hidePrev = false;
if ($iActPage == 0 && $iCnt == 1) {
$oNewList[$sOxid]->hidePrev = true;
}
// hide arrow if article is last in the list
$oNewList[$sOxid]->hideNext = false;
if (($iActPage + 1) == $this->_iCntPages && $iCnt == count($aItems)) {
$oNewList[$sOxid]->hideNext = true;
}
}
return $oNewList;
} | [
"protected",
"function",
"_changeArtListOrder",
"(",
"$",
"aItems",
",",
"$",
"oList",
")",
"{",
"// #777C changing order of list elements, according to $aItems",
"$",
"oNewList",
"=",
"[",
"]",
";",
"$",
"iCnt",
"=",
"0",
";",
"$",
"iActPage",
"=",
"$",
"this",... | Changes order of list elements
@param array $aItems article array
@param object $oList article list array
@return array $oNewList | [
"Changes",
"order",
"of",
"list",
"elements"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/CompareController.php#L381-L410 | train |
OXID-eSales/oxideshop_ce | source/Core/Autoload/ModuleAutoload.php | ModuleAutoload.autoload | public static function autoload($class)
{
/**
* Classes from unified namespace canot be loaded by this auto loader.
* Do not try to load them in order to avoid strange errors in edge cases.
*/
if (false !== strpos($class, 'OxidEsales\Eshop\\')) {
return false;
}
$instance = static::getInstance();
$class = strtolower(basename($class));
if ($classPath = $instance->getFilePath($class)) {
include $classPath;
} else {
$class = preg_replace('/_parent$/i', '', $class);
if (!in_array($class, $instance->triedClasses)) {
$instance->triedClasses[] = $class;
$instance->createExtensionClassChain($class);
}
}
} | php | public static function autoload($class)
{
/**
* Classes from unified namespace canot be loaded by this auto loader.
* Do not try to load them in order to avoid strange errors in edge cases.
*/
if (false !== strpos($class, 'OxidEsales\Eshop\\')) {
return false;
}
$instance = static::getInstance();
$class = strtolower(basename($class));
if ($classPath = $instance->getFilePath($class)) {
include $classPath;
} else {
$class = preg_replace('/_parent$/i', '', $class);
if (!in_array($class, $instance->triedClasses)) {
$instance->triedClasses[] = $class;
$instance->createExtensionClassChain($class);
}
}
} | [
"public",
"static",
"function",
"autoload",
"(",
"$",
"class",
")",
"{",
"/**\n * Classes from unified namespace canot be loaded by this auto loader.\n * Do not try to load them in order to avoid strange errors in edge cases.\n */",
"if",
"(",
"false",
"!==",
"str... | Tries to autoload given class. If class was not found in module files array,
checks module extensions.
@param string $class Class name.
@return bool | [
"Tries",
"to",
"autoload",
"given",
"class",
".",
"If",
"class",
"was",
"not",
"found",
"in",
"module",
"files",
"array",
"checks",
"module",
"extensions",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Autoload/ModuleAutoload.php#L61-L84 | train |
OXID-eSales/oxideshop_ce | source/Core/Autoload/ModuleAutoload.php | ModuleAutoload.getFilePath | protected function getFilePath($class)
{
$filePath = '';
$moduleFiles = Registry::getUtilsObject()->getModuleVar('aModuleFiles');
if (is_array($moduleFiles)) {
$basePath = getShopBasePath();
foreach ($moduleFiles as $moduleId => $classPaths) {
if (array_key_exists($class, $classPaths)) {
$moduleFilePath = $basePath . 'modules/' . $classPaths[$class];
if (file_exists($moduleFilePath)) {
$filePath = $moduleFilePath;
}
}
}
}
return $filePath;
} | php | protected function getFilePath($class)
{
$filePath = '';
$moduleFiles = Registry::getUtilsObject()->getModuleVar('aModuleFiles');
if (is_array($moduleFiles)) {
$basePath = getShopBasePath();
foreach ($moduleFiles as $moduleId => $classPaths) {
if (array_key_exists($class, $classPaths)) {
$moduleFilePath = $basePath . 'modules/' . $classPaths[$class];
if (file_exists($moduleFilePath)) {
$filePath = $moduleFilePath;
}
}
}
}
return $filePath;
} | [
"protected",
"function",
"getFilePath",
"(",
"$",
"class",
")",
"{",
"$",
"filePath",
"=",
"''",
";",
"$",
"moduleFiles",
"=",
"Registry",
"::",
"getUtilsObject",
"(",
")",
"->",
"getModuleVar",
"(",
"'aModuleFiles'",
")",
";",
"if",
"(",
"is_array",
"(",
... | Tries to find file path for given class. Returns empty string on path not found.
@param string $class
@return string | [
"Tries",
"to",
"find",
"file",
"path",
"for",
"given",
"class",
".",
"Returns",
"empty",
"string",
"on",
"path",
"not",
"found",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/Autoload/ModuleAutoload.php#L107-L125 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/PriceAlarmController.php | PriceAlarmController.getProduct | public function getProduct()
{
if ($this->_oArticle === null) {
$this->_oArticle = false;
$aParams = $this->_getParams();
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($aParams['aid']);
$this->_oArticle = $oArticle;
}
return $this->_oArticle;
} | php | public function getProduct()
{
if ($this->_oArticle === null) {
$this->_oArticle = false;
$aParams = $this->_getParams();
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($aParams['aid']);
$this->_oArticle = $oArticle;
}
return $this->_oArticle;
} | [
"public",
"function",
"getProduct",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oArticle",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oArticle",
"=",
"false",
";",
"$",
"aParams",
"=",
"$",
"this",
"->",
"_getParams",
"(",
")",
";",
"$",
"oAr... | Template variable getter. Returns active article
@return object | [
"Template",
"variable",
"getter",
".",
"Returns",
"active",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/PriceAlarmController.php#L116-L127 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/AccountWishlistController.php | AccountWishlistController.showSuggest | public function showSuggest()
{
if ($this->_blShowSuggest === null) {
$this->_blShowSuggest = ( bool ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blshowsuggest');
}
return $this->_blShowSuggest;
} | php | public function showSuggest()
{
if ($this->_blShowSuggest === null) {
$this->_blShowSuggest = ( bool ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blshowsuggest');
}
return $this->_blShowSuggest;
} | [
"public",
"function",
"showSuggest",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_blShowSuggest",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_blShowSuggest",
"=",
"(",
"bool",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
... | check if the wishlist is allowed
@return bool | [
"check",
"if",
"the",
"wishlist",
"is",
"allowed"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/AccountWishlistController.php#L133-L140 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/AccountWishlistController.php | AccountWishlistController.getWishList | public function getWishList()
{
if ($this->_oWishList === null) {
$this->_oWishList = false;
if ($oUser = $this->getUser()) {
$this->_oWishList = $oUser->getBasket('wishlist');
if ($this->_oWishList->isEmpty()) {
$this->_oWishList = false;
}
}
}
return $this->_oWishList;
} | php | public function getWishList()
{
if ($this->_oWishList === null) {
$this->_oWishList = false;
if ($oUser = $this->getUser()) {
$this->_oWishList = $oUser->getBasket('wishlist');
if ($this->_oWishList->isEmpty()) {
$this->_oWishList = false;
}
}
}
return $this->_oWishList;
} | [
"public",
"function",
"getWishList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oWishList",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oWishList",
"=",
"false",
";",
"if",
"(",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
... | Show the Wishlist
@return \OxidEsales\Eshop\Application\Model\UserBasket | bool | [
"Show",
"the",
"Wishlist"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/AccountWishlistController.php#L147-L160 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/AccountWishlistController.php | AccountWishlistController.getWishProductList | public function getWishProductList()
{
if ($this->_aWishProductList === null) {
$this->_aWishProductList = false;
if ($oWishList = $this->getWishList()) {
$this->_aWishProductList = $oWishList->getArticles();
}
}
return $this->_aWishProductList;
} | php | public function getWishProductList()
{
if ($this->_aWishProductList === null) {
$this->_aWishProductList = false;
if ($oWishList = $this->getWishList()) {
$this->_aWishProductList = $oWishList->getArticles();
}
}
return $this->_aWishProductList;
} | [
"public",
"function",
"getWishProductList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aWishProductList",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aWishProductList",
"=",
"false",
";",
"if",
"(",
"$",
"oWishList",
"=",
"$",
"this",
"->",
"getWis... | Returns array of producst assigned to user wish list
@return array | bool | [
"Returns",
"array",
"of",
"producst",
"assigned",
"to",
"user",
"wish",
"list"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/AccountWishlistController.php#L167-L177 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/AccountWishlistController.php | AccountWishlistController.sendWishList | public function sendWishList()
{
if (!\OxidEsales\Eshop\Core\Registry::getSession()->checkSessionChallenge()) {
return false;
}
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval', true);
if (is_array($aParams)) {
$oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();
$oParams = ( object ) $aParams;
$this->setEnteredData(( object ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval'));
if (!isset($aParams['rec_name']) || !isset($aParams['rec_email']) ||
!$aParams['rec_name'] || !$aParams['rec_email']
) {
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_COMPLETE_FIELDS_CORRECTLY', false, true);
} else {
if ($oUser = $this->getUser()) {
$sFirstName = 'oxuser__oxfname';
$sLastName = 'oxuser__oxlname';
$sSendEmail = 'send_email';
$sUserNameField = 'oxuser__oxusername';
$sSendName = 'send_name';
$sSendId = 'send_id';
$oParams->$sSendEmail = $oUser->$sUserNameField->value;
$oParams->$sSendName = $oUser->$sFirstName->getRawValue() . ' ' . $oUser->$sLastName->getRawValue();
$oParams->$sSendId = $oUser->getId();
$this->_blEmailSent = oxNew(\OxidEsales\Eshop\Core\Email::class)->sendWishlistMail($oParams);
if (!$this->_blEmailSent) {
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL', false, true);
}
}
}
}
} | php | public function sendWishList()
{
if (!\OxidEsales\Eshop\Core\Registry::getSession()->checkSessionChallenge()) {
return false;
}
$aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval', true);
if (is_array($aParams)) {
$oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();
$oParams = ( object ) $aParams;
$this->setEnteredData(( object ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editval'));
if (!isset($aParams['rec_name']) || !isset($aParams['rec_email']) ||
!$aParams['rec_name'] || !$aParams['rec_email']
) {
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_COMPLETE_FIELDS_CORRECTLY', false, true);
} else {
if ($oUser = $this->getUser()) {
$sFirstName = 'oxuser__oxfname';
$sLastName = 'oxuser__oxlname';
$sSendEmail = 'send_email';
$sUserNameField = 'oxuser__oxusername';
$sSendName = 'send_name';
$sSendId = 'send_id';
$oParams->$sSendEmail = $oUser->$sUserNameField->value;
$oParams->$sSendName = $oUser->$sFirstName->getRawValue() . ' ' . $oUser->$sLastName->getRawValue();
$oParams->$sSendId = $oUser->getId();
$this->_blEmailSent = oxNew(\OxidEsales\Eshop\Core\Email::class)->sendWishlistMail($oParams);
if (!$this->_blEmailSent) {
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL', false, true);
}
}
}
}
} | [
"public",
"function",
"sendWishList",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"checkSessionChallenge",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"... | Sends wishlist mail to recipient. On errors returns false.
@return bool | [
"Sends",
"wishlist",
"mail",
"to",
"recipient",
".",
"On",
"errors",
"returns",
"false",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/AccountWishlistController.php#L203-L239 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationController.php | NavigationController.logout | public function logout()
{
$mySession = $this->getSession();
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
$oUser->logout();
// kill session
$mySession->destroy();
//resetting content cache if needed
if ($myConfig->getConfigParam('blClearCacheOnLogout')) {
$this->resetContentCache(true);
}
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect('index.php', true, 302);
} | php | public function logout()
{
$mySession = $this->getSession();
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
$oUser->logout();
// kill session
$mySession->destroy();
//resetting content cache if needed
if ($myConfig->getConfigParam('blClearCacheOnLogout')) {
$this->resetContentCache(true);
}
\OxidEsales\Eshop\Core\Registry::getUtils()->redirect('index.php', true, 302);
} | [
"public",
"function",
"logout",
"(",
")",
"{",
"$",
"mySession",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"oUs... | Destroy session, redirects to admin login and clears cache | [
"Destroy",
"session",
"redirects",
"to",
"admin",
"login",
"and",
"clears",
"cache"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationController.php#L115-L132 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationController.php | NavigationController._doStartUpChecks | protected function _doStartUpChecks()
{
$aMessage = [];
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blCheckSysReq') !== false) {
// check if system reguirements are ok
$oSysReq = oxNew(\OxidEsales\Eshop\Core\SystemRequirements::class);
if (!$oSysReq->getSysReqStatus()) {
$aMessage['warning'] = \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE');
$aMessage['warning'] .= '<a href="?cl=sysreq&stoken=' . $this->getSession()->getSessionChallengeToken() . '" target="basefrm">';
$aMessage['warning'] .= \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE2') . '</a>';
}
} else {
$aMessage['message'] = \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE_INACTIVE');
$aMessage['message'] .= '<a href="?cl=sysreq&stoken=' . $this->getSession()->getSessionChallengeToken() . '" target="basefrm">';
$aMessage['message'] .= \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE2') . '</a>';
}
// version check
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blCheckForUpdates')) {
if ($sVersionNotice = $this->_checkVersion()) {
$aMessage['message'] .= $sVersionNotice;
}
}
// check if setup dir is deleted
if (file_exists(\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . '/Setup/index.php')) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('SETUP_DIRNOTDELETED_WARNING');
}
// check if updateApp dir is deleted or empty
$sUpdateDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . '/updateApp/';
if (file_exists($sUpdateDir) && !(count(glob("$sUpdateDir/*")) === 0)) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('UPDATEAPP_DIRNOTDELETED_WARNING');
}
// check if config file is writable
$sConfPath = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . "/config.inc.php";
if (!is_readable($sConfPath) || is_writable($sConfPath)) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('SETUP_CONFIGPERMISSIONS_WARNING');
}
return $aMessage;
} | php | protected function _doStartUpChecks()
{
$aMessage = [];
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blCheckSysReq') !== false) {
// check if system reguirements are ok
$oSysReq = oxNew(\OxidEsales\Eshop\Core\SystemRequirements::class);
if (!$oSysReq->getSysReqStatus()) {
$aMessage['warning'] = \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE');
$aMessage['warning'] .= '<a href="?cl=sysreq&stoken=' . $this->getSession()->getSessionChallengeToken() . '" target="basefrm">';
$aMessage['warning'] .= \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE2') . '</a>';
}
} else {
$aMessage['message'] = \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE_INACTIVE');
$aMessage['message'] .= '<a href="?cl=sysreq&stoken=' . $this->getSession()->getSessionChallengeToken() . '" target="basefrm">';
$aMessage['message'] .= \OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_SYSREQ_MESSAGE2') . '</a>';
}
// version check
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blCheckForUpdates')) {
if ($sVersionNotice = $this->_checkVersion()) {
$aMessage['message'] .= $sVersionNotice;
}
}
// check if setup dir is deleted
if (file_exists(\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . '/Setup/index.php')) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('SETUP_DIRNOTDELETED_WARNING');
}
// check if updateApp dir is deleted or empty
$sUpdateDir = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . '/updateApp/';
if (file_exists($sUpdateDir) && !(count(glob("$sUpdateDir/*")) === 0)) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('UPDATEAPP_DIRNOTDELETED_WARNING');
}
// check if config file is writable
$sConfPath = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopDir') . "/config.inc.php";
if (!is_readable($sConfPath) || is_writable($sConfPath)) {
$aMessage['warning'] .= ((!empty($aMessage['warning'])) ? "<br>" : '') . \OxidEsales\Eshop\Core\Registry::getLang()->translateString('SETUP_CONFIGPERMISSIONS_WARNING');
}
return $aMessage;
} | [
"protected",
"function",
"_doStartUpChecks",
"(",
")",
"{",
"$",
"aMessage",
"=",
"[",
"]",
";",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blCheckSysReq'",
")",... | Every Time Admin starts we perform these checks
returns some messages if there is something to display
@return string | [
"Every",
"Time",
"Admin",
"starts",
"we",
"perform",
"these",
"checks",
"returns",
"some",
"messages",
"if",
"there",
"is",
"something",
"to",
"display"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationController.php#L154-L198 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationController.php | NavigationController._checkVersion | protected function _checkVersion()
{
$edition = \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition();
$query = 'http://admin.oxid-esales.com/' . $edition . '/onlinecheck.php?getlatestversion';
if ($version = \OxidEsales\Eshop\Core\Registry::getUtilsFile()->readRemoteFileAsString($query)) {
// current version is older ..
if (version_compare(\OxidEsales\Eshop\Core\Registry::getConfig()->getVersion(), $version) == '-1') {
return sprintf(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_NEWVERSIONAVAILABLE'), $version);
}
}
} | php | protected function _checkVersion()
{
$edition = \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition();
$query = 'http://admin.oxid-esales.com/' . $edition . '/onlinecheck.php?getlatestversion';
if ($version = \OxidEsales\Eshop\Core\Registry::getUtilsFile()->readRemoteFileAsString($query)) {
// current version is older ..
if (version_compare(\OxidEsales\Eshop\Core\Registry::getConfig()->getVersion(), $version) == '-1') {
return sprintf(\OxidEsales\Eshop\Core\Registry::getLang()->translateString('NAVIGATION_NEWVERSIONAVAILABLE'), $version);
}
}
} | [
"protected",
"function",
"_checkVersion",
"(",
")",
"{",
"$",
"edition",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getEdition",
"(",
")",
";",
"$",
"query",
"=",
"'http://admin.oxid-esales.com... | Checks if newer shop version available. If true - returns message
@return string | [
"Checks",
"if",
"newer",
"shop",
"version",
"available",
".",
"If",
"true",
"-",
"returns",
"message"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationController.php#L205-L215 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/OrderRemark.php | OrderRemark.save | public function save()
{
parent::save();
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($oOrder->load($this->getEditObjectId())) {
$oRemark = oxNew(\OxidEsales\Eshop\Application\Model\Remark::class);
$oRemark->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("rem_oxid"));
$oRemark->oxremark__oxtext = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("remarktext"));
$oRemark->oxremark__oxheader = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("remarkheader"));
$oRemark->oxremark__oxtype = new \OxidEsales\Eshop\Core\Field("r");
$oRemark->oxremark__oxparentid = new \OxidEsales\Eshop\Core\Field($oOrder->oxorder__oxuserid->value);
$oRemark->save();
}
} | php | public function save()
{
parent::save();
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($oOrder->load($this->getEditObjectId())) {
$oRemark = oxNew(\OxidEsales\Eshop\Application\Model\Remark::class);
$oRemark->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("rem_oxid"));
$oRemark->oxremark__oxtext = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("remarktext"));
$oRemark->oxremark__oxheader = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("remarkheader"));
$oRemark->oxremark__oxtype = new \OxidEsales\Eshop\Core\Field("r");
$oRemark->oxremark__oxparentid = new \OxidEsales\Eshop\Core\Field($oOrder->oxorder__oxuserid->value);
$oRemark->save();
}
} | [
"public",
"function",
"save",
"(",
")",
"{",
"parent",
"::",
"save",
"(",
")",
";",
"$",
"oOrder",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Order",
"::",
"class",
")",
";",
"if",
"(",
"$",
"oO... | Saves order history item text changes. | [
"Saves",
"order",
"history",
"item",
"text",
"changes",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/OrderRemark.php#L68-L83 | train |
OXID-eSales/oxideshop_ce | source/Internal/Module/MetaData/Validator/MetaDataValidator.php | MetaDataValidator.validate | public function validate(string $metaDataFilePath, string $metaDataVersion, array $metaData)
{
$this->currentValidationMetaDataVersion = $metaDataVersion;
$this->metaDataFilePath = $metaDataFilePath;
$supportedMetaDataKeys = $this->metaDataSchemataProvider->getFlippedMetaDataSchemaForVersion($this->currentValidationMetaDataVersion);
foreach ($metaData as $metaDataKey => $value) {
if (is_scalar($value)) {
$this->validateMetaDataKey($supportedMetaDataKeys, (string) $metaDataKey);
} elseif (true === \is_array($value)) {
$this->validateMetaDataSection($supportedMetaDataKeys, $metaDataKey, $value);
} else {
throw new UnsupportedMetaDataValueTypeException('The value type "' . \gettype($value) . '" is not supported in metadata version ' . $this->currentValidationMetaDataVersion);
}
}
} | php | public function validate(string $metaDataFilePath, string $metaDataVersion, array $metaData)
{
$this->currentValidationMetaDataVersion = $metaDataVersion;
$this->metaDataFilePath = $metaDataFilePath;
$supportedMetaDataKeys = $this->metaDataSchemataProvider->getFlippedMetaDataSchemaForVersion($this->currentValidationMetaDataVersion);
foreach ($metaData as $metaDataKey => $value) {
if (is_scalar($value)) {
$this->validateMetaDataKey($supportedMetaDataKeys, (string) $metaDataKey);
} elseif (true === \is_array($value)) {
$this->validateMetaDataSection($supportedMetaDataKeys, $metaDataKey, $value);
} else {
throw new UnsupportedMetaDataValueTypeException('The value type "' . \gettype($value) . '" is not supported in metadata version ' . $this->currentValidationMetaDataVersion);
}
}
} | [
"public",
"function",
"validate",
"(",
"string",
"$",
"metaDataFilePath",
",",
"string",
"$",
"metaDataVersion",
",",
"array",
"$",
"metaData",
")",
"{",
"$",
"this",
"->",
"currentValidationMetaDataVersion",
"=",
"$",
"metaDataVersion",
";",
"$",
"this",
"->",
... | Validate that a given metadata meets the specifications of a given metadata version
@param string $metaDataFilePath
@param string $metaDataVersion
@param array $metaData
@throws UnsupportedMetaDataValueTypeException | [
"Validate",
"that",
"a",
"given",
"metadata",
"meets",
"the",
"specifications",
"of",
"a",
"given",
"metadata",
"version"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Module/MetaData/Validator/MetaDataValidator.php#L73-L88 | train |
OXID-eSales/oxideshop_ce | source/Internal/Module/MetaData/Validator/MetaDataValidator.php | MetaDataValidator.validateMetaDataSectionItems | private function validateMetaDataSectionItems(array $supportedMetaDataKeys, string $sectionName, array $sectionData)
{
foreach ($sectionData as $sectionItem) {
if (\is_array($sectionItem)) {
$metaDataKeys = array_keys($sectionItem);
foreach ($metaDataKeys as $metaDataKey) {
$this->validateMetaDataKey($supportedMetaDataKeys[$sectionName], $metaDataKey);
}
}
}
} | php | private function validateMetaDataSectionItems(array $supportedMetaDataKeys, string $sectionName, array $sectionData)
{
foreach ($sectionData as $sectionItem) {
if (\is_array($sectionItem)) {
$metaDataKeys = array_keys($sectionItem);
foreach ($metaDataKeys as $metaDataKey) {
$this->validateMetaDataKey($supportedMetaDataKeys[$sectionName], $metaDataKey);
}
}
}
} | [
"private",
"function",
"validateMetaDataSectionItems",
"(",
"array",
"$",
"supportedMetaDataKeys",
",",
"string",
"$",
"sectionName",
",",
"array",
"$",
"sectionData",
")",
"{",
"foreach",
"(",
"$",
"sectionData",
"as",
"$",
"sectionItem",
")",
"{",
"if",
"(",
... | Validate well defined section items
@param array $supportedMetaDataKeys
@param string $sectionName
@param array $sectionData | [
"Validate",
"well",
"defined",
"section",
"items"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Module/MetaData/Validator/MetaDataValidator.php#L112-L122 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DiscountGroupsAjax.php | DiscountGroupsAjax.removeDiscGroup | public function removeDiscGroup()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$groupIds = $this->_getActionIds('oxobject2discount.oxid');
if ($config->getRequestParameter('all')) {
$query = $this->_addFilter("delete oxobject2discount.* " . $this->_getQuery());
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($query);
} elseif ($groupIds && is_array($groupIds)) {
$groupIdsQuoted = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($groupIds));
$query = "delete from oxobject2discount where oxobject2discount.oxid in (" . $groupIdsQuoted . ") ";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($query);
}
} | php | public function removeDiscGroup()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$groupIds = $this->_getActionIds('oxobject2discount.oxid');
if ($config->getRequestParameter('all')) {
$query = $this->_addFilter("delete oxobject2discount.* " . $this->_getQuery());
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($query);
} elseif ($groupIds && is_array($groupIds)) {
$groupIdsQuoted = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($groupIds));
$query = "delete from oxobject2discount where oxobject2discount.oxid in (" . $groupIdsQuoted . ") ";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->Execute($query);
}
} | [
"public",
"function",
"removeDiscGroup",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"groupIds",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxobject2disco... | Removes user group from discount config | [
"Removes",
"user",
"group",
"from",
"discount",
"config"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DiscountGroupsAjax.php#L75-L88 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DiscountGroupsAjax.php | DiscountGroupsAjax.addDiscGroup | public function addDiscGroup()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$groupIds = $this->_getActionIds('oxgroups.oxid');
$discountId = $config->getRequestParameter('synchoxid');
if ($config->getRequestParameter('all')) {
$groupTable = $this->_getViewName('oxgroups');
$groupIds = $this->_getAll($this->_addFilter("select $groupTable.oxid " . $this->_getQuery()));
}
if ($discountId && $discountId != self::NEW_DISCOUNT_ID && is_array($groupIds)) {
foreach ($groupIds as $groupId) {
$object2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$object2Discount->init('oxobject2discount');
$object2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($discountId);
$object2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($groupId);
$object2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxgroups");
$object2Discount->save();
}
}
} | php | public function addDiscGroup()
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$groupIds = $this->_getActionIds('oxgroups.oxid');
$discountId = $config->getRequestParameter('synchoxid');
if ($config->getRequestParameter('all')) {
$groupTable = $this->_getViewName('oxgroups');
$groupIds = $this->_getAll($this->_addFilter("select $groupTable.oxid " . $this->_getQuery()));
}
if ($discountId && $discountId != self::NEW_DISCOUNT_ID && is_array($groupIds)) {
foreach ($groupIds as $groupId) {
$object2Discount = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
$object2Discount->init('oxobject2discount');
$object2Discount->oxobject2discount__oxdiscountid = new \OxidEsales\Eshop\Core\Field($discountId);
$object2Discount->oxobject2discount__oxobjectid = new \OxidEsales\Eshop\Core\Field($groupId);
$object2Discount->oxobject2discount__oxtype = new \OxidEsales\Eshop\Core\Field("oxgroups");
$object2Discount->save();
}
}
} | [
"public",
"function",
"addDiscGroup",
"(",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"groupIds",
"=",
"$",
"this",
"->",
"_getActionIds",
"(",
"'oxgroups.oxid'",
... | Adds user group to discount config | [
"Adds",
"user",
"group",
"to",
"discount",
"config"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DiscountGroupsAjax.php#L93-L113 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle._getArtStock | protected function _getArtStock($dAddAmount = 0, $blAllowNegativeStock = false)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
// #1592A. must take real value
$sQ = 'select oxstock from oxarticles where oxid = ' . $masterDb->quote($this->oxorderarticles__oxartid->value);
$iStockCount = ( float ) $masterDb->getOne($sQ);
$iStockCount += $dAddAmount;
// #1592A. calculating according new stock option
if (!$blAllowNegativeStock && $iStockCount < 0) {
$iStockCount = 0;
}
return $iStockCount;
} | php | protected function _getArtStock($dAddAmount = 0, $blAllowNegativeStock = false)
{
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
// #1592A. must take real value
$sQ = 'select oxstock from oxarticles where oxid = ' . $masterDb->quote($this->oxorderarticles__oxartid->value);
$iStockCount = ( float ) $masterDb->getOne($sQ);
$iStockCount += $dAddAmount;
// #1592A. calculating according new stock option
if (!$blAllowNegativeStock && $iStockCount < 0) {
$iStockCount = 0;
}
return $iStockCount;
} | [
"protected",
"function",
"_getArtStock",
"(",
"$",
"dAddAmount",
"=",
"0",
",",
"$",
"blAllowNegativeStock",
"=",
"false",
")",
"{",
"// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).",
"$",
"masterDb",
"=",
"\\",
... | Adds or substracts defined amount passed by param from arcticle stock
@param double $dAddAmount amount which will be added/substracled from value in db
@param bool $blAllowNegativeStock allow/disallow negative stock value
@return double | [
"Adds",
"or",
"substracts",
"defined",
"amount",
"passed",
"by",
"param",
"from",
"arcticle",
"stock"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L166-L183 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getPersParams | public function getPersParams()
{
if ($this->_aPersParam != null) {
return $this->_aPersParam;
}
if ($this->oxorderarticles__oxpersparam->value) {
$this->_aPersParam = unserialize($this->oxorderarticles__oxpersparam->value);
}
return $this->_aPersParam;
} | php | public function getPersParams()
{
if ($this->_aPersParam != null) {
return $this->_aPersParam;
}
if ($this->oxorderarticles__oxpersparam->value) {
$this->_aPersParam = unserialize($this->oxorderarticles__oxpersparam->value);
}
return $this->_aPersParam;
} | [
"public",
"function",
"getPersParams",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aPersParam",
"!=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_aPersParam",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"oxorderarticles__oxpersparam",
"->",
"value",
... | Order persistent data getter
@return array | [
"Order",
"persistent",
"data",
"getter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L190-L201 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.setPersParams | public function setPersParams($aParams)
{
$this->_aPersParam = $aParams;
// serializing persisten info stored while ordering
$this->oxorderarticles__oxpersparam = new \OxidEsales\Eshop\Core\Field(serialize($aParams), \OxidEsales\Eshop\Core\Field::T_RAW);
} | php | public function setPersParams($aParams)
{
$this->_aPersParam = $aParams;
// serializing persisten info stored while ordering
$this->oxorderarticles__oxpersparam = new \OxidEsales\Eshop\Core\Field(serialize($aParams), \OxidEsales\Eshop\Core\Field::T_RAW);
} | [
"public",
"function",
"setPersParams",
"(",
"$",
"aParams",
")",
"{",
"$",
"this",
"->",
"_aPersParam",
"=",
"$",
"aParams",
";",
"// serializing persisten info stored while ordering",
"$",
"this",
"->",
"oxorderarticles__oxpersparam",
"=",
"new",
"\\",
"OxidEsales",
... | Order persistent params setter
@param array $aParams array of params | [
"Order",
"persistent",
"params",
"setter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L208-L214 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getParentId | public function getParentId()
{
// when this field will be introduced there will be no need to load from real article
if (isset($this->oxorderarticles__oxartparentid) && $this->oxorderarticles__oxartparentid->value !== false) {
return $this->oxorderarticles__oxartparentid->value;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$sQ = "select oxparentid from " . $oArticle->getViewName() . " where oxid=" . $oDb->quote($this->getProductId());
$this->oxarticles__oxparentid = new \OxidEsales\Eshop\Core\Field($oDb->getOne($sQ));
return $this->oxarticles__oxparentid->value;
} | php | public function getParentId()
{
// when this field will be introduced there will be no need to load from real article
if (isset($this->oxorderarticles__oxartparentid) && $this->oxorderarticles__oxartparentid->value !== false) {
return $this->oxorderarticles__oxartparentid->value;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$sQ = "select oxparentid from " . $oArticle->getViewName() . " where oxid=" . $oDb->quote($this->getProductId());
$this->oxarticles__oxparentid = new \OxidEsales\Eshop\Core\Field($oDb->getOne($sQ));
return $this->oxarticles__oxparentid->value;
} | [
"public",
"function",
"getParentId",
"(",
")",
"{",
"// when this field will be introduced there will be no need to load from real article",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"oxorderarticles__oxartparentid",
")",
"&&",
"$",
"this",
"->",
"oxorderarticles__oxartpare... | Returns product parent id
@return string | [
"Returns",
"product",
"parent",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L270-L283 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle._setArticleParams | protected function _setArticleParams()
{
// creating needed fields
$this->oxarticles__oxstock = $this->oxorderarticles__oxamount;
$this->oxarticles__oxtitle = $this->oxorderarticles__oxtitle;
$this->oxarticles__oxwidth = $this->oxorderarticles__oxwidth;
$this->oxarticles__oxlength = $this->oxorderarticles__oxlength;
$this->oxarticles__oxheight = $this->oxorderarticles__oxheight;
$this->oxarticles__oxweight = $this->oxorderarticles__oxweight;
$this->oxarticles__oxsubclass = $this->oxorderarticles__oxsubclass;
$this->oxarticles__oxartnum = $this->oxorderarticles__oxartnum;
$this->oxarticles__oxshortdesc = $this->oxorderarticles__oxshortdesc;
$this->oxarticles__oxvat = $this->oxorderarticles__oxvat;
$this->oxarticles__oxprice = $this->oxorderarticles__oxprice;
$this->oxarticles__oxbprice = $this->oxorderarticles__oxbprice;
$this->oxarticles__oxthumb = $this->oxorderarticles__oxthumb;
$this->oxarticles__oxpic1 = $this->oxorderarticles__oxpic1;
$this->oxarticles__oxpic2 = $this->oxorderarticles__oxpic2;
$this->oxarticles__oxpic3 = $this->oxorderarticles__oxpic3;
$this->oxarticles__oxpic4 = $this->oxorderarticles__oxpic4;
$this->oxarticles__oxpic5 = $this->oxorderarticles__oxpic5;
$this->oxarticles__oxfile = $this->oxorderarticles__oxfile;
$this->oxarticles__oxdelivery = $this->oxorderarticles__oxdelivery;
$this->oxarticles__oxissearch = $this->oxorderarticles__oxissearch;
$this->oxarticles__oxfolder = $this->oxorderarticles__oxfolder;
$this->oxarticles__oxtemplate = $this->oxorderarticles__oxtemplate;
$this->oxarticles__oxexturl = $this->oxorderarticles__oxexturl;
$this->oxarticles__oxurlimg = $this->oxorderarticles__oxurlimg;
$this->oxarticles__oxurldesc = $this->oxorderarticles__oxurldesc;
$this->oxarticles__oxshopid = $this->oxorderarticles__oxordershopid;
$this->oxarticles__oxquestionemail = $this->oxorderarticles__oxquestionemail;
$this->oxarticles__oxsearchkeys = $this->oxorderarticles__oxsearchkeys;
} | php | protected function _setArticleParams()
{
// creating needed fields
$this->oxarticles__oxstock = $this->oxorderarticles__oxamount;
$this->oxarticles__oxtitle = $this->oxorderarticles__oxtitle;
$this->oxarticles__oxwidth = $this->oxorderarticles__oxwidth;
$this->oxarticles__oxlength = $this->oxorderarticles__oxlength;
$this->oxarticles__oxheight = $this->oxorderarticles__oxheight;
$this->oxarticles__oxweight = $this->oxorderarticles__oxweight;
$this->oxarticles__oxsubclass = $this->oxorderarticles__oxsubclass;
$this->oxarticles__oxartnum = $this->oxorderarticles__oxartnum;
$this->oxarticles__oxshortdesc = $this->oxorderarticles__oxshortdesc;
$this->oxarticles__oxvat = $this->oxorderarticles__oxvat;
$this->oxarticles__oxprice = $this->oxorderarticles__oxprice;
$this->oxarticles__oxbprice = $this->oxorderarticles__oxbprice;
$this->oxarticles__oxthumb = $this->oxorderarticles__oxthumb;
$this->oxarticles__oxpic1 = $this->oxorderarticles__oxpic1;
$this->oxarticles__oxpic2 = $this->oxorderarticles__oxpic2;
$this->oxarticles__oxpic3 = $this->oxorderarticles__oxpic3;
$this->oxarticles__oxpic4 = $this->oxorderarticles__oxpic4;
$this->oxarticles__oxpic5 = $this->oxorderarticles__oxpic5;
$this->oxarticles__oxfile = $this->oxorderarticles__oxfile;
$this->oxarticles__oxdelivery = $this->oxorderarticles__oxdelivery;
$this->oxarticles__oxissearch = $this->oxorderarticles__oxissearch;
$this->oxarticles__oxfolder = $this->oxorderarticles__oxfolder;
$this->oxarticles__oxtemplate = $this->oxorderarticles__oxtemplate;
$this->oxarticles__oxexturl = $this->oxorderarticles__oxexturl;
$this->oxarticles__oxurlimg = $this->oxorderarticles__oxurlimg;
$this->oxarticles__oxurldesc = $this->oxorderarticles__oxurldesc;
$this->oxarticles__oxshopid = $this->oxorderarticles__oxordershopid;
$this->oxarticles__oxquestionemail = $this->oxorderarticles__oxquestionemail;
$this->oxarticles__oxsearchkeys = $this->oxorderarticles__oxsearchkeys;
} | [
"protected",
"function",
"_setArticleParams",
"(",
")",
"{",
"// creating needed fields",
"$",
"this",
"->",
"oxarticles__oxstock",
"=",
"$",
"this",
"->",
"oxorderarticles__oxamount",
";",
"$",
"this",
"->",
"oxarticles__oxtitle",
"=",
"$",
"this",
"->",
"oxorderar... | Sets article parameters to current object, so this object can be used for basket calculation | [
"Sets",
"article",
"parameters",
"to",
"current",
"object",
"so",
"this",
"object",
"can",
"be",
"used",
"for",
"basket",
"calculation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L288-L323 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getSelectLists | public function getSelectLists($sKeyPrefix = null)
{
$aSelLists = [];
if ($oArticle = $this->_getOrderArticle()) {
$aSelLists = $oArticle->getSelectLists();
}
return $aSelLists;
} | php | public function getSelectLists($sKeyPrefix = null)
{
$aSelLists = [];
if ($oArticle = $this->_getOrderArticle()) {
$aSelLists = $oArticle->getSelectLists();
}
return $aSelLists;
} | [
"public",
"function",
"getSelectLists",
"(",
"$",
"sKeyPrefix",
"=",
"null",
")",
"{",
"$",
"aSelLists",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"_getOrderArticle",
"(",
")",
")",
"{",
"$",
"aSelLists",
"=",
"$",
"oArt... | Returns article select lists, implements iBaseArticle interface method
@param string $sKeyPrefix prefix (not used)
@return array | [
"Returns",
"article",
"select",
"lists",
"implements",
"iBaseArticle",
"interface",
"method"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L369-L377 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getOrderArticleSelectList | public function getOrderArticleSelectList($sArtId = null, $sOrderArtSelList = null)
{
if ($this->_aOrderArticleSelList === null) {
$sOrderArtSelList = $sOrderArtSelList ? $sOrderArtSelList : $this->oxorderarticles__oxselvariant->value;
$sOrderArtSelList = explode(' || ', $sOrderArtSelList)[0];
$aRet = [];
if ($oArticle = $this->_getOrderArticle($sArtId)) {
$aList = explode(", ", $sOrderArtSelList);
$oStr = getStr();
$aArticleSelList = $oArticle->getSelectLists();
//formatting temporary list array from string
if (count($aArticleSelList) > 0) {
foreach ($aList as $sList) {
if ($sList) {
$aVal = explode(":", $sList);
if (isset($aVal[0]) && isset($aVal[1])) {
$sOrderArtListTitle = $oStr->strtolower(trim($aVal[0]));
$sOrderArtSelValue = $oStr->strtolower(trim($aVal[1]));
//checking article list for matches with article list stored in oxOrderItem
$iSelListNum = 0;
foreach ($aArticleSelList as $aSelect) {
//check if selects titles are equal
if ($oStr->strtolower($aSelect['name']) == $sOrderArtListTitle) {
//try to find matching select items value
$iSelValueNum = 0;
foreach ($aSelect as $oSel) {
if ($oStr->strtolower($oSel->name) == $sOrderArtSelValue) {
// found, adding to return array
$aRet[$iSelListNum] = $iSelValueNum;
break;
}
//next article list item
$iSelValueNum++;
}
}
//next article list
$iSelListNum++;
}
}
}
}
}
}
$this->_aOrderArticleSelList = $aRet;
}
return $this->_aOrderArticleSelList;
} | php | public function getOrderArticleSelectList($sArtId = null, $sOrderArtSelList = null)
{
if ($this->_aOrderArticleSelList === null) {
$sOrderArtSelList = $sOrderArtSelList ? $sOrderArtSelList : $this->oxorderarticles__oxselvariant->value;
$sOrderArtSelList = explode(' || ', $sOrderArtSelList)[0];
$aRet = [];
if ($oArticle = $this->_getOrderArticle($sArtId)) {
$aList = explode(", ", $sOrderArtSelList);
$oStr = getStr();
$aArticleSelList = $oArticle->getSelectLists();
//formatting temporary list array from string
if (count($aArticleSelList) > 0) {
foreach ($aList as $sList) {
if ($sList) {
$aVal = explode(":", $sList);
if (isset($aVal[0]) && isset($aVal[1])) {
$sOrderArtListTitle = $oStr->strtolower(trim($aVal[0]));
$sOrderArtSelValue = $oStr->strtolower(trim($aVal[1]));
//checking article list for matches with article list stored in oxOrderItem
$iSelListNum = 0;
foreach ($aArticleSelList as $aSelect) {
//check if selects titles are equal
if ($oStr->strtolower($aSelect['name']) == $sOrderArtListTitle) {
//try to find matching select items value
$iSelValueNum = 0;
foreach ($aSelect as $oSel) {
if ($oStr->strtolower($oSel->name) == $sOrderArtSelValue) {
// found, adding to return array
$aRet[$iSelListNum] = $iSelValueNum;
break;
}
//next article list item
$iSelValueNum++;
}
}
//next article list
$iSelListNum++;
}
}
}
}
}
}
$this->_aOrderArticleSelList = $aRet;
}
return $this->_aOrderArticleSelList;
} | [
"public",
"function",
"getOrderArticleSelectList",
"(",
"$",
"sArtId",
"=",
"null",
",",
"$",
"sOrderArtSelList",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aOrderArticleSelList",
"===",
"null",
")",
"{",
"$",
"sOrderArtSelList",
"=",
"$",
"sOrde... | Returns order article selection list array
@param string $sArtId ordered article id [optional]
@param string $sOrderArtSelList order article selection list [optional]
@return array | [
"Returns",
"order",
"article",
"selection",
"list",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L387-L442 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getBasketPrice | public function getBasketPrice($dAmount, $aSelList, $oBasket)
{
$oArticle = $this->_getOrderArticle();
if ($oArticle) {
return $oArticle->getBasketPrice($dAmount, $aSelList, $oBasket);
} else {
return $this->getPrice();
}
} | php | public function getBasketPrice($dAmount, $aSelList, $oBasket)
{
$oArticle = $this->_getOrderArticle();
if ($oArticle) {
return $oArticle->getBasketPrice($dAmount, $aSelList, $oBasket);
} else {
return $this->getPrice();
}
} | [
"public",
"function",
"getBasketPrice",
"(",
"$",
"dAmount",
",",
"$",
"aSelList",
",",
"$",
"oBasket",
")",
"{",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"_getOrderArticle",
"(",
")",
";",
"if",
"(",
"$",
"oArticle",
")",
"{",
"return",
"$",
"oArticle... | Returns basket order article price
@param double $dAmount basket item amount
@param array $aSelList chosen selection list
@param \OxidEsales\Eshop\Application\Model\Basket $oBasket basket
@return oxprice | [
"Returns",
"basket",
"order",
"article",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L453-L462 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getCategoryIds | public function getCategoryIds($blActCats = false, $blSkipCache = false)
{
$aCatIds = [];
if ($oOrderArticle = $this->_getOrderArticle()) {
$aCatIds = $oOrderArticle->getCategoryIds($blActCats, $blSkipCache);
}
return $aCatIds;
} | php | public function getCategoryIds($blActCats = false, $blSkipCache = false)
{
$aCatIds = [];
if ($oOrderArticle = $this->_getOrderArticle()) {
$aCatIds = $oOrderArticle->getCategoryIds($blActCats, $blSkipCache);
}
return $aCatIds;
} | [
"public",
"function",
"getCategoryIds",
"(",
"$",
"blActCats",
"=",
"false",
",",
"$",
"blSkipCache",
"=",
"false",
")",
"{",
"$",
"aCatIds",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"oOrderArticle",
"=",
"$",
"this",
"->",
"_getOrderArticle",
"(",
")",
")"... | Returns empty array, implements iBaseArticle interface getter method
@param bool $blActCats select categories if all parents are active
@param bool $blSkipCache force reload or not (default false - no reload)
@return array | [
"Returns",
"empty",
"array",
"implements",
"iBaseArticle",
"interface",
"getter",
"method"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L482-L490 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getPrice | public function getPrice()
{
$oBasePrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
// prices in db are ONLY brutto
$oBasePrice->setBruttoPriceMode();
$oBasePrice->setVat($this->oxorderarticles__oxvat->value);
$oBasePrice->setPrice($this->oxorderarticles__oxbprice->value);
return $oBasePrice;
} | php | public function getPrice()
{
$oBasePrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
// prices in db are ONLY brutto
$oBasePrice->setBruttoPriceMode();
$oBasePrice->setVat($this->oxorderarticles__oxvat->value);
$oBasePrice->setPrice($this->oxorderarticles__oxbprice->value);
return $oBasePrice;
} | [
"public",
"function",
"getPrice",
"(",
")",
"{",
"$",
"oBasePrice",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Price",
"::",
"class",
")",
";",
"// prices in db are ONLY brutto",
"$",
"oBasePrice",
"->",
"setBruttoPriceMode",
"(... | Returns order article unit price
@return oxprice | [
"Returns",
"order",
"article",
"unit",
"price"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L520-L529 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.setNewAmount | public function setNewAmount($iNewAmount)
{
if ($iNewAmount >= 0) {
// to update stock we must first check if it is possible - article exists?
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($this->oxorderarticles__oxartid->value)) {
// updating stock info
$iStockChange = $iNewAmount - $this->oxorderarticles__oxamount->value;
if ($iStockChange > 0 && ($iOnStock = $oArticle->checkForStock($iStockChange)) !== false) {
if ($iOnStock !== true) {
$iStockChange = $iOnStock;
$iNewAmount = $this->oxorderarticles__oxamount->value + $iStockChange;
}
}
$this->updateArticleStock($iStockChange * -1, \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blAllowNegativeStock'));
// updating self
$this->oxorderarticles__oxamount = new \OxidEsales\Eshop\Core\Field($iNewAmount, \OxidEsales\Eshop\Core\Field::T_RAW);
$this->save();
}
}
} | php | public function setNewAmount($iNewAmount)
{
if ($iNewAmount >= 0) {
// to update stock we must first check if it is possible - article exists?
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
if ($oArticle->load($this->oxorderarticles__oxartid->value)) {
// updating stock info
$iStockChange = $iNewAmount - $this->oxorderarticles__oxamount->value;
if ($iStockChange > 0 && ($iOnStock = $oArticle->checkForStock($iStockChange)) !== false) {
if ($iOnStock !== true) {
$iStockChange = $iOnStock;
$iNewAmount = $this->oxorderarticles__oxamount->value + $iStockChange;
}
}
$this->updateArticleStock($iStockChange * -1, \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blAllowNegativeStock'));
// updating self
$this->oxorderarticles__oxamount = new \OxidEsales\Eshop\Core\Field($iNewAmount, \OxidEsales\Eshop\Core\Field::T_RAW);
$this->save();
}
}
} | [
"public",
"function",
"setNewAmount",
"(",
"$",
"iNewAmount",
")",
"{",
"if",
"(",
"$",
"iNewAmount",
">=",
"0",
")",
"{",
"// to update stock we must first check if it is possible - article exists?",
"$",
"oArticle",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Es... | Ordered article stock setter. Before setting new stock value additionally checks for
original article stock value. Is stock values <= preferred, adjusts order stock according
to it
@param int $iNewAmount new ordered items amount | [
"Ordered",
"article",
"stock",
"setter",
".",
"Before",
"setting",
"new",
"stock",
"value",
"additionally",
"checks",
"for",
"original",
"article",
"stock",
"value",
".",
"Is",
"stock",
"values",
"<",
"=",
"preferred",
"adjusts",
"order",
"stock",
"according",
... | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L558-L580 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.cancelOrderArticle | public function cancelOrderArticle()
{
if ($this->oxorderarticles__oxstorno->value == 0) {
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$this->oxorderarticles__oxstorno = new \OxidEsales\Eshop\Core\Field(1);
if ($this->save()) {
$this->updateArticleStock($this->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock'));
}
}
} | php | public function cancelOrderArticle()
{
if ($this->oxorderarticles__oxstorno->value == 0) {
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$this->oxorderarticles__oxstorno = new \OxidEsales\Eshop\Core\Field(1);
if ($this->save()) {
$this->updateArticleStock($this->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock'));
}
}
} | [
"public",
"function",
"cancelOrderArticle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorderarticles__oxstorno",
"->",
"value",
"==",
"0",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getCon... | Sets order article storno value to 1 and if stock control is on -
restores previous oxarticle stock state | [
"Sets",
"order",
"article",
"storno",
"value",
"to",
"1",
"and",
"if",
"stock",
"control",
"is",
"on",
"-",
"restores",
"previous",
"oxarticle",
"stock",
"state"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L596-L605 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.delete | public function delete($sOXID = null)
{
if ($blDelete = parent::delete($sOXID)) {
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($this->oxorderarticles__oxstorno->value != 1) {
$this->updateArticleStock($this->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock'));
}
}
return $blDelete;
} | php | public function delete($sOXID = null)
{
if ($blDelete = parent::delete($sOXID)) {
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($this->oxorderarticles__oxstorno->value != 1) {
$this->updateArticleStock($this->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock'));
}
}
return $blDelete;
} | [
"public",
"function",
"delete",
"(",
"$",
"sOXID",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"blDelete",
"=",
"parent",
"::",
"delete",
"(",
"$",
"sOXID",
")",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Reg... | Deletes order article object. If deletion succeded - updates
article stock information. Returns deletion status
@param string $sOXID Article id
@return bool | [
"Deletes",
"order",
"article",
"object",
".",
"If",
"deletion",
"succeded",
"-",
"updates",
"article",
"stock",
"information",
".",
"Returns",
"deletion",
"status"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L615-L625 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getWrapping | public function getWrapping()
{
if ($this->oxorderarticles__oxwrapid->value) {
$oWrapping = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class);
if ($oWrapping->load($this->oxorderarticles__oxwrapid->value)) {
return $oWrapping;
}
}
return null;
} | php | public function getWrapping()
{
if ($this->oxorderarticles__oxwrapid->value) {
$oWrapping = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class);
if ($oWrapping->load($this->oxorderarticles__oxwrapid->value)) {
return $oWrapping;
}
}
return null;
} | [
"public",
"function",
"getWrapping",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorderarticles__oxwrapid",
"->",
"value",
")",
"{",
"$",
"oWrapping",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Wrapp... | get used wrapping
@return oxWrapping | [
"get",
"used",
"wrapping"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L667-L677 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getBrutPriceFormated | public function getBrutPriceFormated()
{
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oOrder = $this->getOrder();
$oCurrency = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyObject($oOrder->oxorder__oxcurrency->value);
return $oLang->formatCurrency($this->oxorderarticles__oxbprice->value, $oCurrency);
} | php | public function getBrutPriceFormated()
{
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oOrder = $this->getOrder();
$oCurrency = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyObject($oOrder->oxorder__oxcurrency->value);
return $oLang->formatCurrency($this->oxorderarticles__oxbprice->value, $oCurrency);
} | [
"public",
"function",
"getBrutPriceFormated",
"(",
")",
"{",
"$",
"oLang",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
";",
"$",
"oOrder",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"$",
... | Get brut price formated
@return string | [
"Get",
"brut",
"price",
"formated"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L708-L715 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getNetPriceFormated | public function getNetPriceFormated()
{
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oOrder = $this->getOrder();
$oCurrency = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyObject($oOrder->oxorder__oxcurrency->value);
return $oLang->formatCurrency($this->oxorderarticles__oxnprice->value, $oCurrency);
} | php | public function getNetPriceFormated()
{
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
$oOrder = $this->getOrder();
$oCurrency = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyObject($oOrder->oxorder__oxcurrency->value);
return $oLang->formatCurrency($this->oxorderarticles__oxnprice->value, $oCurrency);
} | [
"public",
"function",
"getNetPriceFormated",
"(",
")",
"{",
"$",
"oLang",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
";",
"$",
"oOrder",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"$",
"... | Get Net price formated
@return string | [
"Get",
"Net",
"price",
"formated"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L722-L729 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle.getOrder | public function getOrder()
{
if ($this->oxorderarticles__oxorderid->value) {
// checking if the object already exists in the cache
if (isset($this->_aOrderCache[$this->oxorderarticles__oxorderid->value])) {
// returning the cached object
return $this->_aOrderCache[$this->oxorderarticles__oxorderid->value];
}
// creatina new order object and trying to load it
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($oOrder->load($this->oxorderarticles__oxorderid->value)) {
return $this->_aOrderCache[$this->oxorderarticles__oxorderid->value] = $oOrder;
}
}
return null;
} | php | public function getOrder()
{
if ($this->oxorderarticles__oxorderid->value) {
// checking if the object already exists in the cache
if (isset($this->_aOrderCache[$this->oxorderarticles__oxorderid->value])) {
// returning the cached object
return $this->_aOrderCache[$this->oxorderarticles__oxorderid->value];
}
// creatina new order object and trying to load it
$oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($oOrder->load($this->oxorderarticles__oxorderid->value)) {
return $this->_aOrderCache[$this->oxorderarticles__oxorderid->value] = $oOrder;
}
}
return null;
} | [
"public",
"function",
"getOrder",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorderarticles__oxorderid",
"->",
"value",
")",
"{",
"// checking if the object already exists in the cache",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_aOrderCache",
"[",
"$",
"... | Returns oxOrder object that the article belongs to
@return mixed - on success returns oxOrder object, else returns null | [
"Returns",
"oxOrder",
"object",
"that",
"the",
"article",
"belongs",
"to"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L736-L752 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/OrderArticle.php | OrderArticle._setOrderFiles | public function _setOrderFiles()
{
$oArticle = $this->getArticle();
if ($oArticle->oxarticles__oxisdownloadable->value) {
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sOrderId = $this->oxorderarticles__oxorderid->value;
$sOrderArticleId = $this->getId();
$sShopId = $oConfig->getShopId();
$oUser = $oConfig->getUser();
$oFiles = $oArticle->getArticleFiles(true);
if ($oFiles) {
foreach ($oFiles as $oFile) {
$oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
$oOrderFile->setOrderId($sOrderId);
$oOrderFile->setOrderArticleId($sOrderArticleId);
$oOrderFile->setShopId($sShopId);
$iMaxDownloadCount = (!empty($oUser) && !$oUser->hasAccount()) ? $oFile->getMaxUnregisteredDownloadsCount() : $oFile->getMaxDownloadsCount();
$oOrderFile->setFile(
$oFile->oxfiles__oxfilename->value,
$oFile->getId(),
$iMaxDownloadCount * $this->oxorderarticles__oxamount->value,
$oFile->getLinkExpirationTime(),
$oFile->getDownloadExpirationTime()
);
$oOrderFile->save();
}
}
}
} | php | public function _setOrderFiles()
{
$oArticle = $this->getArticle();
if ($oArticle->oxarticles__oxisdownloadable->value) {
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$sOrderId = $this->oxorderarticles__oxorderid->value;
$sOrderArticleId = $this->getId();
$sShopId = $oConfig->getShopId();
$oUser = $oConfig->getUser();
$oFiles = $oArticle->getArticleFiles(true);
if ($oFiles) {
foreach ($oFiles as $oFile) {
$oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
$oOrderFile->setOrderId($sOrderId);
$oOrderFile->setOrderArticleId($sOrderArticleId);
$oOrderFile->setShopId($sShopId);
$iMaxDownloadCount = (!empty($oUser) && !$oUser->hasAccount()) ? $oFile->getMaxUnregisteredDownloadsCount() : $oFile->getMaxDownloadsCount();
$oOrderFile->setFile(
$oFile->oxfiles__oxfilename->value,
$oFile->getId(),
$iMaxDownloadCount * $this->oxorderarticles__oxamount->value,
$oFile->getLinkExpirationTime(),
$oFile->getDownloadExpirationTime()
);
$oOrderFile->save();
}
}
}
} | [
"public",
"function",
"_setOrderFiles",
"(",
")",
"{",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"getArticle",
"(",
")",
";",
"if",
"(",
"$",
"oArticle",
"->",
"oxarticles__oxisdownloadable",
"->",
"value",
")",
"{",
"$",
"oConfig",
"=",
"\\",
"OxidEsales",... | Set order files | [
"Set",
"order",
"files"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/OrderArticle.php#L801-L834 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DiagnosticsOutput.php | DiagnosticsOutput.readResultFile | public function readResultFile($sOutputKey = null)
{
$sCurrentKey = (empty($sOutputKey)) ? $this->_sOutputKey : $sOutputKey;
return $this->_oUtils->fromFileCache($sCurrentKey);
} | php | public function readResultFile($sOutputKey = null)
{
$sCurrentKey = (empty($sOutputKey)) ? $this->_sOutputKey : $sOutputKey;
return $this->_oUtils->fromFileCache($sCurrentKey);
} | [
"public",
"function",
"readResultFile",
"(",
"$",
"sOutputKey",
"=",
"null",
")",
"{",
"$",
"sCurrentKey",
"=",
"(",
"empty",
"(",
"$",
"sOutputKey",
")",
")",
"?",
"$",
"this",
"->",
"_sOutputKey",
":",
"$",
"sOutputKey",
";",
"return",
"$",
"this",
"... | Reads exported result file contents
@param string $sOutputKey Output key.
@return string | [
"Reads",
"exported",
"result",
"file",
"contents"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DiagnosticsOutput.php#L107-L112 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/DiagnosticsOutput.php | DiagnosticsOutput.downloadResultFile | public function downloadResultFile($sOutputKey = null)
{
$sCurrentKey = (empty($sOutputKey)) ? $this->_sOutputKey : $sOutputKey;
$this->_oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$iFileSize = filesize($this->_oUtils->getCacheFilePath($sCurrentKey));
$this->_oUtils->setHeader("Pragma: public");
$this->_oUtils->setHeader("Expires: 0");
$this->_oUtils->setHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0, private");
$this->_oUtils->setHeader('Content-Disposition: attachment;filename=' . $this->_sOutputFileName);
$this->_oUtils->setHeader("Content-Type:text/html;charset=utf-8");
if ($iFileSize) {
$this->_oUtils->setHeader("Content-Length: " . $iFileSize);
}
echo $this->_oUtils->fromFileCache($sCurrentKey);
} | php | public function downloadResultFile($sOutputKey = null)
{
$sCurrentKey = (empty($sOutputKey)) ? $this->_sOutputKey : $sOutputKey;
$this->_oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$iFileSize = filesize($this->_oUtils->getCacheFilePath($sCurrentKey));
$this->_oUtils->setHeader("Pragma: public");
$this->_oUtils->setHeader("Expires: 0");
$this->_oUtils->setHeader("Cache-Control: must-revalidate, post-check=0, pre-check=0, private");
$this->_oUtils->setHeader('Content-Disposition: attachment;filename=' . $this->_sOutputFileName);
$this->_oUtils->setHeader("Content-Type:text/html;charset=utf-8");
if ($iFileSize) {
$this->_oUtils->setHeader("Content-Length: " . $iFileSize);
}
echo $this->_oUtils->fromFileCache($sCurrentKey);
} | [
"public",
"function",
"downloadResultFile",
"(",
"$",
"sOutputKey",
"=",
"null",
")",
"{",
"$",
"sCurrentKey",
"=",
"(",
"empty",
"(",
"$",
"sOutputKey",
")",
")",
"?",
"$",
"this",
"->",
"_sOutputKey",
":",
"$",
"sOutputKey",
";",
"$",
"this",
"->",
"... | Sends generated file for download
@param string $sOutputKey Output key. | [
"Sends",
"generated",
"file",
"for",
"download"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/DiagnosticsOutput.php#L119-L135 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.getVoucherByNr | public function getVoucherByNr($sVoucherNr, $aVouchers = [], $blCheckavalability = false)
{
$oRet = null;
if (!empty($sVoucherNr)) {
$sViewName = $this->getViewName();
$sSeriesViewName = getViewName('oxvoucherseries');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select {$sViewName}.* from {$sViewName}, {$sSeriesViewName} where
{$sSeriesViewName}.oxid = {$sViewName}.oxvoucherserieid and
{$sViewName}.oxvouchernr = " . $oDb->quote($sVoucherNr) . " and ";
if (is_array($aVouchers)) {
foreach ($aVouchers as $sVoucherId => $sSkipVoucherNr) {
$sQ .= "{$sViewName}.oxid != " . $oDb->quote($sVoucherId) . " and ";
}
}
$sQ .= "( {$sViewName}.oxorderid is NULL || {$sViewName}.oxorderid = '' ) ";
$sQ .= " and ( {$sViewName}.oxdateused is NULL || {$sViewName}.oxdateused = 0 ) ";
//voucher timeout for 3 hours
if ($blCheckavalability) {
$iTime = time() - $this->_getVoucherTimeout();
$sQ .= " and {$sViewName}.oxreserved < '{$iTime}' ";
}
$sQ .= " limit 1";
if (!($oRet = $this->assignRecord($sQ))) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($sVoucherNr);
throw $oEx;
}
}
return $oRet;
} | php | public function getVoucherByNr($sVoucherNr, $aVouchers = [], $blCheckavalability = false)
{
$oRet = null;
if (!empty($sVoucherNr)) {
$sViewName = $this->getViewName();
$sSeriesViewName = getViewName('oxvoucherseries');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "select {$sViewName}.* from {$sViewName}, {$sSeriesViewName} where
{$sSeriesViewName}.oxid = {$sViewName}.oxvoucherserieid and
{$sViewName}.oxvouchernr = " . $oDb->quote($sVoucherNr) . " and ";
if (is_array($aVouchers)) {
foreach ($aVouchers as $sVoucherId => $sSkipVoucherNr) {
$sQ .= "{$sViewName}.oxid != " . $oDb->quote($sVoucherId) . " and ";
}
}
$sQ .= "( {$sViewName}.oxorderid is NULL || {$sViewName}.oxorderid = '' ) ";
$sQ .= " and ( {$sViewName}.oxdateused is NULL || {$sViewName}.oxdateused = 0 ) ";
//voucher timeout for 3 hours
if ($blCheckavalability) {
$iTime = time() - $this->_getVoucherTimeout();
$sQ .= " and {$sViewName}.oxreserved < '{$iTime}' ";
}
$sQ .= " limit 1";
if (!($oRet = $this->assignRecord($sQ))) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($sVoucherNr);
throw $oEx;
}
}
return $oRet;
} | [
"public",
"function",
"getVoucherByNr",
"(",
"$",
"sVoucherNr",
",",
"$",
"aVouchers",
"=",
"[",
"]",
",",
"$",
"blCheckavalability",
"=",
"false",
")",
"{",
"$",
"oRet",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sVoucherNr",
")",
")",
"{... | Gets voucher from db by given number.
@param string $sVoucherNr Voucher number
@param array $aVouchers Array of available vouchers (default array())
@param bool $blCheckavalability check if voucher is still reserver od not
@throws oxVoucherException exception
@return mixed | [
"Gets",
"voucher",
"from",
"db",
"by",
"given",
"number",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L57-L94 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.markAsUsed | public function markAsUsed($sOrderId, $sUserId, $dDiscount)
{
//saving oxreserved field
if ($this->oxvouchers__oxid->value) {
$this->oxvouchers__oxorderid->setValue($sOrderId);
$this->oxvouchers__oxuserid->setValue($sUserId);
$this->oxvouchers__oxdiscount->setValue($dDiscount);
$this->oxvouchers__oxdateused->setValue(date("Y-m-d", \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()));
$this->save();
}
} | php | public function markAsUsed($sOrderId, $sUserId, $dDiscount)
{
//saving oxreserved field
if ($this->oxvouchers__oxid->value) {
$this->oxvouchers__oxorderid->setValue($sOrderId);
$this->oxvouchers__oxuserid->setValue($sUserId);
$this->oxvouchers__oxdiscount->setValue($dDiscount);
$this->oxvouchers__oxdateused->setValue(date("Y-m-d", \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime()));
$this->save();
}
} | [
"public",
"function",
"markAsUsed",
"(",
"$",
"sOrderId",
",",
"$",
"sUserId",
",",
"$",
"dDiscount",
")",
"{",
"//saving oxreserved field",
"if",
"(",
"$",
"this",
"->",
"oxvouchers__oxid",
"->",
"value",
")",
"{",
"$",
"this",
"->",
"oxvouchers__oxorderid",
... | marks voucher as used
@param string $sOrderId order id
@param string $sUserId user id
@param double $dDiscount used discount | [
"marks",
"voucher",
"as",
"used"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L103-L113 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.markAsReserved | public function markAsReserved()
{
//saving oxreserved field
$sVoucherID = $this->oxvouchers__oxid->value;
if ($sVoucherID) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "update oxvouchers set oxreserved = " . time() . " where oxid = " . $oDb->quote($sVoucherID);
$oDb->Execute($sQ);
}
} | php | public function markAsReserved()
{
//saving oxreserved field
$sVoucherID = $this->oxvouchers__oxid->value;
if ($sVoucherID) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "update oxvouchers set oxreserved = " . time() . " where oxid = " . $oDb->quote($sVoucherID);
$oDb->Execute($sQ);
}
} | [
"public",
"function",
"markAsReserved",
"(",
")",
"{",
"//saving oxreserved field",
"$",
"sVoucherID",
"=",
"$",
"this",
"->",
"oxvouchers__oxid",
"->",
"value",
";",
"if",
"(",
"$",
"sVoucherID",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",... | mark voucher as reserved | [
"mark",
"voucher",
"as",
"reserved"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L118-L128 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.checkVoucherAvailability | public function checkVoucherAvailability($aVouchers, $dPrice)
{
$this->_isAvailableWithSameSeries($aVouchers);
$this->_isAvailableWithOtherSeries($aVouchers);
$this->_isValidDate();
$this->_isAvailablePrice($dPrice);
$this->_isNotReserved();
// returning true - no exception was thrown
return true;
} | php | public function checkVoucherAvailability($aVouchers, $dPrice)
{
$this->_isAvailableWithSameSeries($aVouchers);
$this->_isAvailableWithOtherSeries($aVouchers);
$this->_isValidDate();
$this->_isAvailablePrice($dPrice);
$this->_isNotReserved();
// returning true - no exception was thrown
return true;
} | [
"public",
"function",
"checkVoucherAvailability",
"(",
"$",
"aVouchers",
",",
"$",
"dPrice",
")",
"{",
"$",
"this",
"->",
"_isAvailableWithSameSeries",
"(",
"$",
"aVouchers",
")",
";",
"$",
"this",
"->",
"_isAvailableWithOtherSeries",
"(",
"$",
"aVouchers",
")",... | Checks availability without user logged in. Returns array with errors.
@param array $aVouchers array of vouchers
@param double $dPrice current sum (price)
@throws oxVoucherException exception
@return array | [
"Checks",
"availability",
"without",
"user",
"logged",
"in",
".",
"Returns",
"array",
"with",
"errors",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L176-L186 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isAvailablePrice | protected function _isAvailablePrice($dPrice)
{
$oSeries = $this->getSerie();
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
if ($oSeries->oxvoucherseries__oxminimumvalue->value && $dPrice < ($oSeries->oxvoucherseries__oxminimumvalue->value * $oCur->rate)) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_INCORRECTPRICE');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
return true;
} | php | protected function _isAvailablePrice($dPrice)
{
$oSeries = $this->getSerie();
$oCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
if ($oSeries->oxvoucherseries__oxminimumvalue->value && $dPrice < ($oSeries->oxvoucherseries__oxminimumvalue->value * $oCur->rate)) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_INCORRECTPRICE');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
return true;
} | [
"protected",
"function",
"_isAvailablePrice",
"(",
"$",
"dPrice",
")",
"{",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"$",
"oCur",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
... | Checks availability about price. Returns error array.
@param double $dPrice base article price
@throws oxVoucherException exception
@return array | [
"Checks",
"availability",
"about",
"price",
".",
"Returns",
"error",
"array",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L219-L231 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isAvailableWithSameSeries | protected function _isAvailableWithSameSeries($aVouchers)
{
if (is_array($aVouchers)) {
$sId = $this->getId();
if (isset($aVouchers[$sId])) {
unset($aVouchers[$sId]);
}
$oSeries = $this->getSerie();
if (!$oSeries->oxvoucherseries__oxallowsameseries->value) {
foreach ($aVouchers as $voucherId => $voucherNr) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oVoucher->load($voucherId);
if ($this->oxvouchers__oxvoucherserieid->value == $oVoucher->oxvouchers__oxvoucherserieid->value) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
}
}
return true;
} | php | protected function _isAvailableWithSameSeries($aVouchers)
{
if (is_array($aVouchers)) {
$sId = $this->getId();
if (isset($aVouchers[$sId])) {
unset($aVouchers[$sId]);
}
$oSeries = $this->getSerie();
if (!$oSeries->oxvoucherseries__oxallowsameseries->value) {
foreach ($aVouchers as $voucherId => $voucherNr) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oVoucher->load($voucherId);
if ($this->oxvouchers__oxvoucherserieid->value == $oVoucher->oxvouchers__oxvoucherserieid->value) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
}
}
return true;
} | [
"protected",
"function",
"_isAvailableWithSameSeries",
"(",
"$",
"aVouchers",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aVouchers",
")",
")",
"{",
"$",
"sId",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"aVouchers",
... | Checks if calculation with vouchers of the same series possible. Returns
true on success.
@param array $aVouchers array of vouchers
@throws oxVoucherException exception
@return bool | [
"Checks",
"if",
"calculation",
"with",
"vouchers",
"of",
"the",
"same",
"series",
"possible",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L244-L267 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isAvailableWithOtherSeries | protected function _isAvailableWithOtherSeries($aVouchers)
{
if (is_array($aVouchers) && count($aVouchers)) {
$oSeries = $this->getSerie();
$sIds = implode(',', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray(array_keys($aVouchers)));
$blAvailable = true;
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
if (!$oSeries->oxvoucherseries__oxallowotherseries->value) {
// just search for vouchers with different series
$sSql = "select 1 from oxvouchers where oxvouchers.oxid in ($sIds) and ";
$sSql .= "oxvouchers.oxvoucherserieid != " . $oDb->quote($this->oxvouchers__oxvoucherserieid->value);
$blAvailable &= !$oDb->getOne($sSql);
} else {
// search for vouchers with different series and those vouchers do not allow other series
$sSql = "select 1 from oxvouchers left join oxvoucherseries on oxvouchers.oxvoucherserieid=oxvoucherseries.oxid ";
$sSql .= "where oxvouchers.oxid in ($sIds) and oxvouchers.oxvoucherserieid != " . $oDb->quote($this->oxvouchers__oxvoucherserieid->value);
$sSql .= "and not oxvoucherseries.oxallowotherseries";
$blAvailable &= !$oDb->getOne($sSql);
}
if (!$blAvailable) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDOTHERSERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
return true;
} | php | protected function _isAvailableWithOtherSeries($aVouchers)
{
if (is_array($aVouchers) && count($aVouchers)) {
$oSeries = $this->getSerie();
$sIds = implode(',', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray(array_keys($aVouchers)));
$blAvailable = true;
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
if (!$oSeries->oxvoucherseries__oxallowotherseries->value) {
// just search for vouchers with different series
$sSql = "select 1 from oxvouchers where oxvouchers.oxid in ($sIds) and ";
$sSql .= "oxvouchers.oxvoucherserieid != " . $oDb->quote($this->oxvouchers__oxvoucherserieid->value);
$blAvailable &= !$oDb->getOne($sSql);
} else {
// search for vouchers with different series and those vouchers do not allow other series
$sSql = "select 1 from oxvouchers left join oxvoucherseries on oxvouchers.oxvoucherserieid=oxvoucherseries.oxid ";
$sSql .= "where oxvouchers.oxid in ($sIds) and oxvouchers.oxvoucherserieid != " . $oDb->quote($this->oxvouchers__oxvoucherserieid->value);
$sSql .= "and not oxvoucherseries.oxallowotherseries";
$blAvailable &= !$oDb->getOne($sSql);
}
if (!$blAvailable) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDOTHERSERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
return true;
} | [
"protected",
"function",
"_isAvailableWithOtherSeries",
"(",
"$",
"aVouchers",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"aVouchers",
")",
"&&",
"count",
"(",
"$",
"aVouchers",
")",
")",
"{",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",... | Checks if calculation with vouchers from the other series possible.
Returns true on success.
@param array $aVouchers array of vouchers
@throws oxVoucherException exception
@return bool | [
"Checks",
"if",
"calculation",
"with",
"vouchers",
"from",
"the",
"other",
"series",
"possible",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L279-L307 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isValidDate | protected function _isValidDate()
{
$oSeries = $this->getSerie();
$iTime = time();
// If date is not set will add day before and day after to check if voucher valid today.
$iTomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
$iYesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
// Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid.
$iFrom = ((int) $oSeries->oxvoucherseries__oxbegindate->value) ?
strtotime($oSeries->oxvoucherseries__oxbegindate->value) : $iYesterday;
// Checks if end date is set, if no set $iTo to tomorrow so it will be valid.
$iTo = ((int) $oSeries->oxvoucherseries__oxenddate->value) ?
strtotime($oSeries->oxvoucherseries__oxenddate->value) : $iTomorrow;
if ($iFrom < $iTime && $iTo > $iTime) {
return true;
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('MESSAGE_COUPON_EXPIRED');
if ($iFrom > $iTime && $iTo > $iTime) {
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
}
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | php | protected function _isValidDate()
{
$oSeries = $this->getSerie();
$iTime = time();
// If date is not set will add day before and day after to check if voucher valid today.
$iTomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
$iYesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
// Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid.
$iFrom = ((int) $oSeries->oxvoucherseries__oxbegindate->value) ?
strtotime($oSeries->oxvoucherseries__oxbegindate->value) : $iYesterday;
// Checks if end date is set, if no set $iTo to tomorrow so it will be valid.
$iTo = ((int) $oSeries->oxvoucherseries__oxenddate->value) ?
strtotime($oSeries->oxvoucherseries__oxenddate->value) : $iTomorrow;
if ($iFrom < $iTime && $iTo > $iTime) {
return true;
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('MESSAGE_COUPON_EXPIRED');
if ($iFrom > $iTime && $iTo > $iTime) {
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
}
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | [
"protected",
"function",
"_isValidDate",
"(",
")",
"{",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"$",
"iTime",
"=",
"time",
"(",
")",
";",
"// If date is not set will add day before and day after to check if voucher valid today.",
"$",
"iTo... | Checks if voucher is in valid time period. Returns true on success.
@throws oxVoucherException exception
@return bool | [
"Checks",
"if",
"voucher",
"is",
"in",
"valid",
"time",
"period",
".",
"Returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L316-L344 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isNotReserved | protected function _isNotReserved()
{
if ($this->oxvouchers__oxreserved->value < time() - $this->_getVoucherTimeout()) {
return true;
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('EXCEPTION_VOUCHER_ISRESERVED');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | php | protected function _isNotReserved()
{
if ($this->oxvouchers__oxreserved->value < time() - $this->_getVoucherTimeout()) {
return true;
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('EXCEPTION_VOUCHER_ISRESERVED');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | [
"protected",
"function",
"_isNotReserved",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxvouchers__oxreserved",
"->",
"value",
"<",
"time",
"(",
")",
"-",
"$",
"this",
"->",
"_getVoucherTimeout",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"... | Checks if voucher is not yet reserved before.
@throws oxVoucherException exception
@return bool | [
"Checks",
"if",
"voucher",
"is",
"not",
"yet",
"reserved",
"before",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L353-L364 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isAvailableInOtherOrder | protected function _isAvailableInOtherOrder($oUser)
{
$oSeries = $this->getSerie();
if (!$oSeries->oxvoucherseries__oxallowuseanother->value) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSelect = 'select count(*) from ' . $this->getViewName() . ' where oxuserid = ' . $oDb->quote($oUser->oxuser__oxid->value) . ' and ';
$sSelect .= 'oxvoucherserieid = ' . $oDb->quote($this->oxvouchers__oxvoucherserieid->value) . ' and ';
$sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ';
if ($oDb->getOne($sSelect)) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
return true;
} | php | protected function _isAvailableInOtherOrder($oUser)
{
$oSeries = $this->getSerie();
if (!$oSeries->oxvoucherseries__oxallowuseanother->value) {
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sSelect = 'select count(*) from ' . $this->getViewName() . ' where oxuserid = ' . $oDb->quote($oUser->oxuser__oxid->value) . ' and ';
$sSelect .= 'oxvoucherserieid = ' . $oDb->quote($this->oxvouchers__oxvoucherserieid->value) . ' and ';
$sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ';
if ($oDb->getOne($sSelect)) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
}
return true;
} | [
"protected",
"function",
"_isAvailableInOtherOrder",
"(",
"$",
"oUser",
")",
"{",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oSeries",
"->",
"oxvoucherseries__oxallowuseanother",
"->",
"value",
")",
"{",
"$",
"... | Checks if user already used vouchers from this series and can he use it again.
@param object $oUser user object
@throws oxVoucherException exception
@return boolean | [
"Checks",
"if",
"user",
"already",
"used",
"vouchers",
"from",
"this",
"series",
"and",
"can",
"he",
"use",
"it",
"again",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L395-L413 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isValidUserGroup | protected function _isValidUserGroup($oUser)
{
$oVoucherSeries = $this->getSerie();
$oUserGroups = $oVoucherSeries->setUserGroups();
if (!$oUserGroups->count()) {
return true;
}
if ($oUser) {
foreach ($oUserGroups as $oGroup) {
if ($oUser->inGroup($oGroup->getId())) {
return true;
}
}
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTVALIDUSERGROUP');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | php | protected function _isValidUserGroup($oUser)
{
$oVoucherSeries = $this->getSerie();
$oUserGroups = $oVoucherSeries->setUserGroups();
if (!$oUserGroups->count()) {
return true;
}
if ($oUser) {
foreach ($oUserGroups as $oGroup) {
if ($oUser->inGroup($oGroup->getId())) {
return true;
}
}
}
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTVALIDUSERGROUP');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
} | [
"protected",
"function",
"_isValidUserGroup",
"(",
"$",
"oUser",
")",
"{",
"$",
"oVoucherSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"$",
"oUserGroups",
"=",
"$",
"oVoucherSeries",
"->",
"setUserGroups",
"(",
")",
";",
"if",
"(",
"!",
"$"... | Checks if user belongs to the same group as the voucher. Returns true on sucess.
@param object $oUser user object
@throws oxVoucherException exception
@return bool | [
"Checks",
"if",
"user",
"belongs",
"to",
"the",
"same",
"group",
"as",
"the",
"voucher",
".",
"Returns",
"true",
"on",
"sucess",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L424-L445 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.getSimpleVoucher | public function getSimpleVoucher()
{
$oVoucher = new stdClass();
$oVoucher->sVoucherId = $this->getId();
$oVoucher->sVoucherNr = null;
if ($this->oxvouchers__oxvouchernr) {
$oVoucher->sVoucherNr = $this->oxvouchers__oxvouchernr->value;
}
// R. set in oxBasket : $oVoucher->fVoucherdiscount = \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency( $this->oxvouchers__oxdiscount->value );
return $oVoucher;
} | php | public function getSimpleVoucher()
{
$oVoucher = new stdClass();
$oVoucher->sVoucherId = $this->getId();
$oVoucher->sVoucherNr = null;
if ($this->oxvouchers__oxvouchernr) {
$oVoucher->sVoucherNr = $this->oxvouchers__oxvouchernr->value;
}
// R. set in oxBasket : $oVoucher->fVoucherdiscount = \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency( $this->oxvouchers__oxdiscount->value );
return $oVoucher;
} | [
"public",
"function",
"getSimpleVoucher",
"(",
")",
"{",
"$",
"oVoucher",
"=",
"new",
"stdClass",
"(",
")",
";",
"$",
"oVoucher",
"->",
"sVoucherId",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"oVoucher",
"->",
"sVoucherNr",
"=",
"null",
";",... | Returns compact voucher object which is used in oxBasket
@return stdClass | [
"Returns",
"compact",
"voucher",
"object",
"which",
"is",
"used",
"in",
"oxBasket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L452-L464 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher.getSerie | public function getSerie()
{
if ($this->_oSerie !== null) {
return $this->_oSerie;
}
$oSerie = oxNew(\OxidEsales\Eshop\Application\Model\VoucherSerie::class);
if (!$oSerie->load($this->oxvouchers__oxvoucherserieid->value)) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\ObjectException::class);
}
$this->_oSerie = $oSerie;
return $oSerie;
} | php | public function getSerie()
{
if ($this->_oSerie !== null) {
return $this->_oSerie;
}
$oSerie = oxNew(\OxidEsales\Eshop\Application\Model\VoucherSerie::class);
if (!$oSerie->load($this->oxvouchers__oxvoucherserieid->value)) {
throw oxNew(\OxidEsales\Eshop\Core\Exception\ObjectException::class);
}
$this->_oSerie = $oSerie;
return $oSerie;
} | [
"public",
"function",
"getSerie",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oSerie",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_oSerie",
";",
"}",
"$",
"oSerie",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Applicati... | create oxVoucherSerie object of this voucher
@throws oxObjectException
@return oxVoucherSerie | [
"create",
"oxVoucherSerie",
"object",
"of",
"this",
"voucher"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L473-L485 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._isProductVoucher | protected function _isProductVoucher()
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oSeries = $this->getSerie();
$sSelect = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($oSeries->getId()) . " and oxtype = 'oxarticles'";
$blOk = ( bool ) $oDb->getOne($sSelect);
return $blOk;
} | php | protected function _isProductVoucher()
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oSeries = $this->getSerie();
$sSelect = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($oSeries->getId()) . " and oxtype = 'oxarticles'";
$blOk = ( bool ) $oDb->getOne($sSelect);
return $blOk;
} | [
"protected",
"function",
"_isProductVoucher",
"(",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"$... | Returns true if voucher is product specific, otherwise false
@return boolean | [
"Returns",
"true",
"if",
"voucher",
"is",
"product",
"specific",
"otherwise",
"false"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L492-L500 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._getSerieDiscount | protected function _getSerieDiscount()
{
$oSeries = $this->getSerie();
$oDiscount = oxNew(\OxidEsales\Eshop\Application\Model\Discount::class);
$oDiscount->setId($oSeries->getId());
$oDiscount->oxdiscount__oxshopid = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxshopid->value);
$oDiscount->oxdiscount__oxactive = new \OxidEsales\Eshop\Core\Field(true);
$oDiscount->oxdiscount__oxactivefrom = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxbegindate->value);
$oDiscount->oxdiscount__oxactiveto = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxenddate->value);
$oDiscount->oxdiscount__oxtitle = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxserienr->value);
$oDiscount->oxdiscount__oxamount = new \OxidEsales\Eshop\Core\Field(1);
$oDiscount->oxdiscount__oxamountto = new \OxidEsales\Eshop\Core\Field(MAX_64BIT_INTEGER);
$oDiscount->oxdiscount__oxprice = new \OxidEsales\Eshop\Core\Field(0);
$oDiscount->oxdiscount__oxpriceto = new \OxidEsales\Eshop\Core\Field(MAX_64BIT_INTEGER);
$oDiscount->oxdiscount__oxaddsumtype = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxdiscounttype->value == 'percent' ? '%' : 'abs');
$oDiscount->oxdiscount__oxaddsum = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxdiscount->value);
$oDiscount->oxdiscount__oxitmartid = new \OxidEsales\Eshop\Core\Field();
$oDiscount->oxdiscount__oxitmamount = new \OxidEsales\Eshop\Core\Field();
$oDiscount->oxdiscount__oxitmmultiple = new \OxidEsales\Eshop\Core\Field();
return $oDiscount;
} | php | protected function _getSerieDiscount()
{
$oSeries = $this->getSerie();
$oDiscount = oxNew(\OxidEsales\Eshop\Application\Model\Discount::class);
$oDiscount->setId($oSeries->getId());
$oDiscount->oxdiscount__oxshopid = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxshopid->value);
$oDiscount->oxdiscount__oxactive = new \OxidEsales\Eshop\Core\Field(true);
$oDiscount->oxdiscount__oxactivefrom = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxbegindate->value);
$oDiscount->oxdiscount__oxactiveto = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxenddate->value);
$oDiscount->oxdiscount__oxtitle = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxserienr->value);
$oDiscount->oxdiscount__oxamount = new \OxidEsales\Eshop\Core\Field(1);
$oDiscount->oxdiscount__oxamountto = new \OxidEsales\Eshop\Core\Field(MAX_64BIT_INTEGER);
$oDiscount->oxdiscount__oxprice = new \OxidEsales\Eshop\Core\Field(0);
$oDiscount->oxdiscount__oxpriceto = new \OxidEsales\Eshop\Core\Field(MAX_64BIT_INTEGER);
$oDiscount->oxdiscount__oxaddsumtype = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxdiscounttype->value == 'percent' ? '%' : 'abs');
$oDiscount->oxdiscount__oxaddsum = new \OxidEsales\Eshop\Core\Field($oSeries->oxvoucherseries__oxdiscount->value);
$oDiscount->oxdiscount__oxitmartid = new \OxidEsales\Eshop\Core\Field();
$oDiscount->oxdiscount__oxitmamount = new \OxidEsales\Eshop\Core\Field();
$oDiscount->oxdiscount__oxitmmultiple = new \OxidEsales\Eshop\Core\Field();
return $oDiscount;
} | [
"protected",
"function",
"_getSerieDiscount",
"(",
")",
"{",
"$",
"oSeries",
"=",
"$",
"this",
"->",
"getSerie",
"(",
")",
";",
"$",
"oDiscount",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Discount",
... | Returns the discount object created from voucher serie data
@return object | [
"Returns",
"the",
"discount",
"object",
"created",
"from",
"voucher",
"serie",
"data"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L522-L544 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._getBasketItems | protected function _getBasketItems($oDiscount = null)
{
if ($this->oxvouchers__oxorderid->value) {
return $this->_getOrderBasketItems($oDiscount);
} elseif ($this->getSession()->getBasket()) {
return $this->_getSessionBasketItems($oDiscount);
} else {
return [];
}
} | php | protected function _getBasketItems($oDiscount = null)
{
if ($this->oxvouchers__oxorderid->value) {
return $this->_getOrderBasketItems($oDiscount);
} elseif ($this->getSession()->getBasket()) {
return $this->_getSessionBasketItems($oDiscount);
} else {
return [];
}
} | [
"protected",
"function",
"_getBasketItems",
"(",
"$",
"oDiscount",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxvouchers__oxorderid",
"->",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"_getOrderBasketItems",
"(",
"$",
"oDiscount",
")",
";",
... | Returns basket item information array from session or order.
@param \OxidEsales\Eshop\Application\Model\Discount $oDiscount discount object
@return array | [
"Returns",
"basket",
"item",
"information",
"array",
"from",
"session",
"or",
"order",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L553-L562 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._getProductDiscountValue | protected function _getProductDiscountValue($dPrice)
{
$oDiscount = $this->_getSerieDiscount();
$aBasketItems = $this->_getBasketItems($oDiscount);
// Basket Item Count and isAdmin check (unble to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
if (!count($aBasketItems) && !$this->isAdmin()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
$oSeries = $this->getSerie();
$oVoucherPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oDiscountPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);
// Is the voucher discount applied to at least one basket item
$blDiscountApplied = false;
foreach ($aBasketItems as $aBasketItem) {
// If discount was already applied for the voucher to at least one basket items, then break
if ($blDiscountApplied and !empty($oSeries->oxvoucherseries__oxcalculateonce->value)) {
break;
}
$oDiscountPrice->setPrice($aBasketItem['discount']);
$oProductPrice->setPrice($aBasketItem['price']);
// Individual voucher is not multiplied by article amount
if (!$oSeries->oxvoucherseries__oxcalculateonce->value) {
$oDiscountPrice->multiply($aBasketItem['amount']);
$oProductPrice->multiply($aBasketItem['amount']);
}
$oVoucherPrice->add($oDiscountPrice->getBruttoPrice());
$oProductTotal->add($oProductPrice->getBruttoPrice());
if (!empty($aBasketItem['discount'])) {
$blDiscountApplied = true;
}
}
$dVoucher = $oVoucherPrice->getBruttoPrice();
$dProduct = $oProductTotal->getBruttoPrice();
if ($dVoucher > $dProduct) {
return $dProduct;
}
return $dVoucher;
} | php | protected function _getProductDiscountValue($dPrice)
{
$oDiscount = $this->_getSerieDiscount();
$aBasketItems = $this->_getBasketItems($oDiscount);
// Basket Item Count and isAdmin check (unble to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
if (!count($aBasketItems) && !$this->isAdmin()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
$oSeries = $this->getSerie();
$oVoucherPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oDiscountPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);
// Is the voucher discount applied to at least one basket item
$blDiscountApplied = false;
foreach ($aBasketItems as $aBasketItem) {
// If discount was already applied for the voucher to at least one basket items, then break
if ($blDiscountApplied and !empty($oSeries->oxvoucherseries__oxcalculateonce->value)) {
break;
}
$oDiscountPrice->setPrice($aBasketItem['discount']);
$oProductPrice->setPrice($aBasketItem['price']);
// Individual voucher is not multiplied by article amount
if (!$oSeries->oxvoucherseries__oxcalculateonce->value) {
$oDiscountPrice->multiply($aBasketItem['amount']);
$oProductPrice->multiply($aBasketItem['amount']);
}
$oVoucherPrice->add($oDiscountPrice->getBruttoPrice());
$oProductTotal->add($oProductPrice->getBruttoPrice());
if (!empty($aBasketItem['discount'])) {
$blDiscountApplied = true;
}
}
$dVoucher = $oVoucherPrice->getBruttoPrice();
$dProduct = $oProductTotal->getBruttoPrice();
if ($dVoucher > $dProduct) {
return $dProduct;
}
return $dVoucher;
} | [
"protected",
"function",
"_getProductDiscountValue",
"(",
"$",
"dPrice",
")",
"{",
"$",
"oDiscount",
"=",
"$",
"this",
"->",
"_getSerieDiscount",
"(",
")",
";",
"$",
"aBasketItems",
"=",
"$",
"this",
"->",
"_getBasketItems",
"(",
"$",
"oDiscount",
")",
";",
... | Returns the discount value used, if voucher is aplied only for specific products.
@param double $dPrice price to calculate discount on it
@throws oxVoucherException exception
@return double | [
"Returns",
"the",
"discount",
"value",
"used",
"if",
"voucher",
"is",
"aplied",
"only",
"for",
"specific",
"products",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L723-L777 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._getCategoryDiscountValue | protected function _getCategoryDiscountValue($dPrice)
{
$oDiscount = $this->_getSerieDiscount();
$aBasketItems = $this->_getBasketItems($oDiscount);
// Basket Item Count and isAdmin check (unable to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
if (!count($aBasketItems) && !$this->isAdmin()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
$oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);
foreach ($aBasketItems as $aBasketItem) {
$oProductPrice->setPrice($aBasketItem['price']);
$oProductPrice->multiply($aBasketItem['amount']);
$oProductTotal->add($oProductPrice->getBruttoPrice());
}
$dProduct = $oProductTotal->getBruttoPrice();
$dVoucher = $oDiscount->getAbsValue($dProduct);
return ($dVoucher > $dProduct) ? $dProduct : $dVoucher;
} | php | protected function _getCategoryDiscountValue($dPrice)
{
$oDiscount = $this->_getSerieDiscount();
$aBasketItems = $this->_getBasketItems($oDiscount);
// Basket Item Count and isAdmin check (unable to access property $oOrder->_getOrderBasket()->_blSkipVouchersAvailabilityChecking)
if (!count($aBasketItems) && !$this->isAdmin()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
$oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
$oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
throw $oEx;
}
$oProductPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oProductTotal = oxNew(\OxidEsales\Eshop\Core\Price::class);
foreach ($aBasketItems as $aBasketItem) {
$oProductPrice->setPrice($aBasketItem['price']);
$oProductPrice->multiply($aBasketItem['amount']);
$oProductTotal->add($oProductPrice->getBruttoPrice());
}
$dProduct = $oProductTotal->getBruttoPrice();
$dVoucher = $oDiscount->getAbsValue($dProduct);
return ($dVoucher > $dProduct) ? $dProduct : $dVoucher;
} | [
"protected",
"function",
"_getCategoryDiscountValue",
"(",
"$",
"dPrice",
")",
"{",
"$",
"oDiscount",
"=",
"$",
"this",
"->",
"_getSerieDiscount",
"(",
")",
";",
"$",
"aBasketItems",
"=",
"$",
"this",
"->",
"_getBasketItems",
"(",
"$",
"oDiscount",
")",
";",... | Returns the discount value used, if voucher is applied only for specific categories.
@param double $dPrice price to calculate discount on it
@throws oxVoucherException exception
@return double | [
"Returns",
"the",
"discount",
"value",
"used",
"if",
"voucher",
"is",
"applied",
"only",
"for",
"specific",
"categories",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L804-L830 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Voucher.php | Voucher._getVoucherTimeout | protected function _getVoucherTimeout()
{
$iVoucherTimeout = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iVoucherTimeout') ?:
3 * 3600;
return $iVoucherTimeout;
} | php | protected function _getVoucherTimeout()
{
$iVoucherTimeout = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iVoucherTimeout') ?:
3 * 3600;
return $iVoucherTimeout;
} | [
"protected",
"function",
"_getVoucherTimeout",
"(",
")",
"{",
"$",
"iVoucherTimeout",
"=",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'iVoucherTimeout'",
")",
... | Returns a configured value for voucher timeouts or a default
of 3 hours if not configured
@return integer Seconds a voucher can stay in status reserved | [
"Returns",
"a",
"configured",
"value",
"for",
"voucher",
"timeouts",
"or",
"a",
"default",
"of",
"3",
"hours",
"if",
"not",
"configured"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Voucher.php#L862-L868 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.render | public function render()
{
parent::render();
// assign all member variables to template
$aClassVars = get_object_vars($this);
foreach ($aClassVars as $name => $value) {
$this->_aViewData[$name] = $value;
}
$this->_aViewData['sOutputFile'] = $this->_sFilePath;
$this->_aViewData['sDownloadFile'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopURL') . $this->sExportPath . $this->sExportFileName . "." . $this->sExportFileType;
return $this->_sThisTemplate;
} | php | public function render()
{
parent::render();
// assign all member variables to template
$aClassVars = get_object_vars($this);
foreach ($aClassVars as $name => $value) {
$this->_aViewData[$name] = $value;
}
$this->_aViewData['sOutputFile'] = $this->_sFilePath;
$this->_aViewData['sDownloadFile'] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sShopURL') . $this->sExportPath . $this->sExportFileName . "." . $this->sExportFileType;
return $this->_sThisTemplate;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"// assign all member variables to template",
"$",
"aClassVars",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"aClassVars",
"as",
"$",
"name",
... | Calls parent rendering methods, sends implementation class names to template
and returns default template name
@return string | [
"Calls",
"parent",
"rendering",
"methods",
"sends",
"implementation",
"class",
"names",
"to",
"template",
"and",
"returns",
"default",
"template",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L130-L144 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.createMainExportView | public function createMainExportView()
{
// parent categorie tree
$this->_aViewData["cattree"] = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->_aViewData["cattree"]->loadList();
$oLangObj = oxNew(\OxidEsales\Eshop\Core\Language::class);
$aLangs = $oLangObj->getLanguageArray();
foreach ($aLangs as $id => $language) {
$language->selected = ($id == $this->_iEditLang);
$this->_aViewData["aLangs"][$id] = clone $language;
}
} | php | public function createMainExportView()
{
// parent categorie tree
$this->_aViewData["cattree"] = oxNew(\OxidEsales\Eshop\Application\Model\CategoryList::class);
$this->_aViewData["cattree"]->loadList();
$oLangObj = oxNew(\OxidEsales\Eshop\Core\Language::class);
$aLangs = $oLangObj->getLanguageArray();
foreach ($aLangs as $id => $language) {
$language->selected = ($id == $this->_iEditLang);
$this->_aViewData["aLangs"][$id] = clone $language;
}
} | [
"public",
"function",
"createMainExportView",
"(",
")",
"{",
"// parent categorie tree",
"$",
"this",
"->",
"_aViewData",
"[",
"\"cattree\"",
"]",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"CategoryList",
"::... | Prepares and fill all data which all the dyn exports needs | [
"Prepares",
"and",
"fill",
"all",
"data",
"which",
"all",
"the",
"dyn",
"exports",
"needs"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L149-L161 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.write | public function write($sLine)
{
$sLine = $this->removeSID($sLine);
$sLine = str_replace(["\r\n", "\n"], "", $sLine);
fwrite($this->fpFile, $sLine . "\r\n");
} | php | public function write($sLine)
{
$sLine = $this->removeSID($sLine);
$sLine = str_replace(["\r\n", "\n"], "", $sLine);
fwrite($this->fpFile, $sLine . "\r\n");
} | [
"public",
"function",
"write",
"(",
"$",
"sLine",
")",
"{",
"$",
"sLine",
"=",
"$",
"this",
"->",
"removeSID",
"(",
"$",
"sLine",
")",
";",
"$",
"sLine",
"=",
"str_replace",
"(",
"[",
"\"\\r\\n\"",
",",
"\"\\n\"",
"]",
",",
"\"\"",
",",
"$",
"sLine... | writes one line into open export file
@param string $sLine exported line | [
"writes",
"one",
"line",
"into",
"open",
"export",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L217-L222 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.getExportPerTick | public function getExportPerTick()
{
if ($this->_iExportPerTick === null) {
$this->_iExportPerTick = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("iExportNrofLines");
if (!$this->_iExportPerTick) {
$this->_iExportPerTick = $this->iExportPerTick;
}
}
return $this->_iExportPerTick;
} | php | public function getExportPerTick()
{
if ($this->_iExportPerTick === null) {
$this->_iExportPerTick = (int) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam("iExportNrofLines");
if (!$this->_iExportPerTick) {
$this->_iExportPerTick = $this->iExportPerTick;
}
}
return $this->_iExportPerTick;
} | [
"public",
"function",
"getExportPerTick",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_iExportPerTick",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_iExportPerTick",
"=",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registr... | Returns how many articles should be exported per tick
@return int | [
"Returns",
"how",
"many",
"articles",
"should",
"be",
"exported",
"per",
"tick"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L265-L275 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.getDefaultCategoryString | public function getDefaultCategoryString($oArticle)
{
$sLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCatView = getViewName('oxcategories', $sLang);
$sO2CView = getViewName('oxobject2category', $sLang);
//selecting category
$sQ = "select $sCatView.oxtitle from $sO2CView as oxobject2category left join $sCatView on $sCatView.oxid = oxobject2category.oxcatnid ";
$sQ .= "where oxobject2category.oxobjectid=" . $oDB->quote($oArticle->getId()) . " and $sCatView.oxactive = 1 order by oxobject2category.oxtime ";
return $oDB->getOne($sQ);
} | php | public function getDefaultCategoryString($oArticle)
{
$sLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCatView = getViewName('oxcategories', $sLang);
$sO2CView = getViewName('oxobject2category', $sLang);
//selecting category
$sQ = "select $sCatView.oxtitle from $sO2CView as oxobject2category left join $sCatView on $sCatView.oxid = oxobject2category.oxcatnid ";
$sQ .= "where oxobject2category.oxobjectid=" . $oDB->quote($oArticle->getId()) . " and $sCatView.oxactive = 1 order by oxobject2category.oxtime ";
return $oDB->getOne($sQ);
} | [
"public",
"function",
"getDefaultCategoryString",
"(",
"$",
"oArticle",
")",
"{",
"$",
"sLang",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
"->",
"getBaseLanguage",
"(",
")",
";",
"$",
"oDB",
"=",
"\... | Loads article default category
@param \OxidEsales\Eshop\Application\Model\Article $oArticle Article object
@return record set | [
"Loads",
"article",
"default",
"category"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L390-L403 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.prepareCSV | public function prepareCSV($sInput)
{
$sInput = \OxidEsales\Eshop\Core\Registry::getUtilsString()->prepareCSVField($sInput);
return str_replace([" ", "€", "|"], [" ", "", ""], $sInput);
} | php | public function prepareCSV($sInput)
{
$sInput = \OxidEsales\Eshop\Core\Registry::getUtilsString()->prepareCSVField($sInput);
return str_replace([" ", "€", "|"], [" ", "", ""], $sInput);
} | [
"public",
"function",
"prepareCSV",
"(",
"$",
"sInput",
")",
"{",
"$",
"sInput",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsString",
"(",
")",
"->",
"prepareCSVField",
"(",
"$",
"sInput",
")",
";",
"return",
"s... | Converts field for CSV
@param string $sInput input to process
@return string | [
"Converts",
"field",
"for",
"CSV"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L412-L417 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.prepareXML | public function prepareXML($sInput)
{
$sOutput = str_replace("&", "&", $sInput);
$sOutput = str_replace("\"", """, $sOutput);
$sOutput = str_replace(">", ">", $sOutput);
$sOutput = str_replace("<", "<", $sOutput);
$sOutput = str_replace("'", "'", $sOutput);
return $sOutput;
} | php | public function prepareXML($sInput)
{
$sOutput = str_replace("&", "&", $sInput);
$sOutput = str_replace("\"", """, $sOutput);
$sOutput = str_replace(">", ">", $sOutput);
$sOutput = str_replace("<", "<", $sOutput);
$sOutput = str_replace("'", "'", $sOutput);
return $sOutput;
} | [
"public",
"function",
"prepareXML",
"(",
"$",
"sInput",
")",
"{",
"$",
"sOutput",
"=",
"str_replace",
"(",
"\"&\"",
",",
"\"&\"",
",",
"$",
"sInput",
")",
";",
"$",
"sOutput",
"=",
"str_replace",
"(",
"\"\\\"\"",
",",
"\""\"",
",",
"$",
"sOutput... | Changes special chars to be XML compatible
@param string $sInput string which have to be changed
@return string | [
"Changes",
"special",
"chars",
"to",
"be",
"XML",
"compatible"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L426-L435 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.prepareExport | public function prepareExport()
{
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sHeapTable = $this->_getHeapTableName();
// #1070 Saulius 2005.11.28
// check mySQL version
$oRs = $oDB->select("SHOW VARIABLES LIKE 'version'");
$sTableCharset = $this->_generateTableCharSet($oRs->fields[1]);
// create heap table
if (!($this->_createHeapTable($sHeapTable, $sTableCharset))) {
// error
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("Could not create HEAP Table {$sHeapTable}\n<br>");
}
$sCatAdd = $this->_getCatAdd(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("acat"));
if (!$this->_insertArticles($sHeapTable, $sCatAdd)) {
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("Could not insert Articles in Table {$sHeapTable}\n<br>");
}
$this->_removeParentArticles($sHeapTable);
$this->_setSessionParams();
// get total cnt
return $oDB->getOne("select count(*) from {$sHeapTable}");
} | php | public function prepareExport()
{
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sHeapTable = $this->_getHeapTableName();
// #1070 Saulius 2005.11.28
// check mySQL version
$oRs = $oDB->select("SHOW VARIABLES LIKE 'version'");
$sTableCharset = $this->_generateTableCharSet($oRs->fields[1]);
// create heap table
if (!($this->_createHeapTable($sHeapTable, $sTableCharset))) {
// error
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("Could not create HEAP Table {$sHeapTable}\n<br>");
}
$sCatAdd = $this->_getCatAdd(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("acat"));
if (!$this->_insertArticles($sHeapTable, $sCatAdd)) {
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit("Could not insert Articles in Table {$sHeapTable}\n<br>");
}
$this->_removeParentArticles($sHeapTable);
$this->_setSessionParams();
// get total cnt
return $oDB->getOne("select count(*) from {$sHeapTable}");
} | [
"public",
"function",
"prepareExport",
"(",
")",
"{",
"$",
"oDB",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"sHeapTable",
"=",
"$",
"this",
"->",
"_getHeapTableName",
"(",
")",
";",... | create export resultset
@return int | [
"create",
"export",
"resultset"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L454-L480 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.getOneArticle | public function getOneArticle($iCnt, & $blContinue)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
//[Alfonsas 2006-05-31] setting specific parameter
//to be checked in oxarticle.php init() method
$myConfig->setConfigParam('blExport', true);
$blContinue = false;
if (($oArticle = $this->_initArticle($this->_getHeapTableName(), $iCnt, $blContinue))) {
$blContinue = true;
$oArticle = $this->_setCampaignDetailLink($oArticle);
}
//[Alfonsas 2006-05-31] unsetting specific parameter
//to be checked in oxarticle.php init() method
$myConfig->setConfigParam('blExport', false);
return $oArticle;
} | php | public function getOneArticle($iCnt, & $blContinue)
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
//[Alfonsas 2006-05-31] setting specific parameter
//to be checked in oxarticle.php init() method
$myConfig->setConfigParam('blExport', true);
$blContinue = false;
if (($oArticle = $this->_initArticle($this->_getHeapTableName(), $iCnt, $blContinue))) {
$blContinue = true;
$oArticle = $this->_setCampaignDetailLink($oArticle);
}
//[Alfonsas 2006-05-31] unsetting specific parameter
//to be checked in oxarticle.php init() method
$myConfig->setConfigParam('blExport', false);
return $oArticle;
} | [
"public",
"function",
"getOneArticle",
"(",
"$",
"iCnt",
",",
"&",
"$",
"blContinue",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"//[Alfonsas 2006-05-31] setting specific... | get's one oxid for exporting
@param integer $iCnt counter
@param bool $blContinue false is used to stop exporting
@return mixed | [
"get",
"s",
"one",
"oxid",
"for",
"exporting"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L490-L509 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController.assureContent | public function assureContent($sInput, $sReplace = null)
{
$oStr = getStr();
if (!$oStr->strlen($sInput)) {
if (!isset($sReplace) || !$oStr->strlen($sReplace)) {
$sReplace = "-";
}
$sInput = $sReplace;
}
return $sInput;
} | php | public function assureContent($sInput, $sReplace = null)
{
$oStr = getStr();
if (!$oStr->strlen($sInput)) {
if (!isset($sReplace) || !$oStr->strlen($sReplace)) {
$sReplace = "-";
}
$sInput = $sReplace;
}
return $sInput;
} | [
"public",
"function",
"assureContent",
"(",
"$",
"sInput",
",",
"$",
"sReplace",
"=",
"null",
")",
"{",
"$",
"oStr",
"=",
"getStr",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oStr",
"->",
"strlen",
"(",
"$",
"sInput",
")",
")",
"{",
"if",
"(",
"!",
"... | Make sure that string is never empty.
@param string $sInput string that will be replaced
@param string $sReplace string that will replace
@return string | [
"Make",
"sure",
"that",
"string",
"is",
"never",
"empty",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L519-L530 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._generateTableCharSet | protected function _generateTableCharSet($sMysqlVersion)
{
$sTableCharset = "";
//if MySQL >= 4.1.0 set charsets and collations
if (version_compare($sMysqlVersion, '4.1.0', '>=') > 0) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$oRs = $oDB->select("SHOW FULL COLUMNS FROM `oxarticles` WHERE field like 'OXID'");
if (isset($oRs->fields['Collation']) && ($sMysqlCollation = $oRs->fields['Collation'])) {
$oRs = $oDB->select("SHOW COLLATION LIKE '{$sMysqlCollation}'");
if (isset($oRs->fields['Charset']) && ($sMysqlCharacterSet = $oRs->fields['Charset'])) {
$sTableCharset = "DEFAULT CHARACTER SET {$sMysqlCharacterSet} COLLATE {$sMysqlCollation}";
}
}
}
return $sTableCharset;
} | php | protected function _generateTableCharSet($sMysqlVersion)
{
$sTableCharset = "";
//if MySQL >= 4.1.0 set charsets and collations
if (version_compare($sMysqlVersion, '4.1.0', '>=') > 0) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
$oRs = $oDB->select("SHOW FULL COLUMNS FROM `oxarticles` WHERE field like 'OXID'");
if (isset($oRs->fields['Collation']) && ($sMysqlCollation = $oRs->fields['Collation'])) {
$oRs = $oDB->select("SHOW COLLATION LIKE '{$sMysqlCollation}'");
if (isset($oRs->fields['Charset']) && ($sMysqlCharacterSet = $oRs->fields['Charset'])) {
$sTableCharset = "DEFAULT CHARACTER SET {$sMysqlCharacterSet} COLLATE {$sMysqlCollation}";
}
}
}
return $sTableCharset;
} | [
"protected",
"function",
"_generateTableCharSet",
"(",
"$",
"sMysqlVersion",
")",
"{",
"$",
"sTableCharset",
"=",
"\"\"",
";",
"//if MySQL >= 4.1.0 set charsets and collations",
"if",
"(",
"version_compare",
"(",
"$",
"sMysqlVersion",
",",
"'4.1.0'",
",",
"'>='",
")",... | generates table charset
@param string $sMysqlVersion MySql version
@return string | [
"generates",
"table",
"charset"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L565-L582 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._getCatAdd | protected function _getCatAdd($aChosenCat)
{
$sCatAdd = null;
if (is_array($aChosenCat) && count($aChosenCat)) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCatAdd = " and ( ";
$blSep = false;
foreach ($aChosenCat as $sCat) {
if ($blSep) {
$sCatAdd .= " or ";
}
$sCatAdd .= "oxobject2category.oxcatnid = " . $oDB->quote($sCat);
$blSep = true;
}
$sCatAdd .= ")";
}
return $sCatAdd;
} | php | protected function _getCatAdd($aChosenCat)
{
$sCatAdd = null;
if (is_array($aChosenCat) && count($aChosenCat)) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sCatAdd = " and ( ";
$blSep = false;
foreach ($aChosenCat as $sCat) {
if ($blSep) {
$sCatAdd .= " or ";
}
$sCatAdd .= "oxobject2category.oxcatnid = " . $oDB->quote($sCat);
$blSep = true;
}
$sCatAdd .= ")";
}
return $sCatAdd;
} | [
"protected",
"function",
"_getCatAdd",
"(",
"$",
"aChosenCat",
")",
"{",
"$",
"sCatAdd",
"=",
"null",
";",
"if",
"(",
"is_array",
"(",
"$",
"aChosenCat",
")",
"&&",
"count",
"(",
"$",
"aChosenCat",
")",
")",
"{",
"$",
"oDB",
"=",
"\\",
"OxidEsales",
... | creates additional cat string
@param array $aChosenCat Selected category array
@return string | [
"creates",
"additional",
"cat",
"string"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L612-L630 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._insertArticles | protected function _insertArticles($sHeapTable, $sCatAdd)
{
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$iExpLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iExportLanguage");
if (!isset($iExpLang)) {
$iExpLang = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("iExportLanguage");
}
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->setLanguage($iExpLang);
$sO2CView = getViewName('oxobject2category', $iExpLang);
$sArticleTable = getViewName("oxarticles", $iExpLang);
$insertQuery = "insert into {$sHeapTable} select {$sArticleTable}.oxid from {$sArticleTable}, {$sO2CView} as oxobject2category where ";
$insertQuery .= $oArticle->getSqlActiveSnippet();
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blExportVars")) {
$insertQuery .= " and {$sArticleTable}.oxid = oxobject2category.oxobjectid and {$sArticleTable}.oxparentid = '' ";
} else {
$insertQuery .= " and ( {$sArticleTable}.oxid = oxobject2category.oxobjectid or {$sArticleTable}.oxparentid = oxobject2category.oxobjectid ) ";
}
$sSearchString = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("search");
if (isset($sSearchString)) {
$insertQuery .= "and ( {$sArticleTable}.OXTITLE like " . $oDB->quote("%{$sSearchString}%");
$insertQuery .= " or {$sArticleTable}.OXSHORTDESC like " . $oDB->quote("%$sSearchString%");
$insertQuery .= " or {$sArticleTable}.oxsearchkeys like " . $oDB->quote("%$sSearchString%") . " ) ";
}
if ($sCatAdd) {
$insertQuery .= $sCatAdd;
}
// add minimum stock value
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseStock') && ($dMinStock = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportMinStock"))) {
$dMinStock = str_replace([";", " ", "/", "'"], "", $dMinStock);
$insertQuery .= " and {$sArticleTable}.oxstock >= " . $oDB->quote($dMinStock);
}
$insertQuery .= " group by {$sArticleTable}.oxid";
return $oDB->execute($insertQuery) ? true : false;
} | php | protected function _insertArticles($sHeapTable, $sCatAdd)
{
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$iExpLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iExportLanguage");
if (!isset($iExpLang)) {
$iExpLang = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("iExportLanguage");
}
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->setLanguage($iExpLang);
$sO2CView = getViewName('oxobject2category', $iExpLang);
$sArticleTable = getViewName("oxarticles", $iExpLang);
$insertQuery = "insert into {$sHeapTable} select {$sArticleTable}.oxid from {$sArticleTable}, {$sO2CView} as oxobject2category where ";
$insertQuery .= $oArticle->getSqlActiveSnippet();
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blExportVars")) {
$insertQuery .= " and {$sArticleTable}.oxid = oxobject2category.oxobjectid and {$sArticleTable}.oxparentid = '' ";
} else {
$insertQuery .= " and ( {$sArticleTable}.oxid = oxobject2category.oxobjectid or {$sArticleTable}.oxparentid = oxobject2category.oxobjectid ) ";
}
$sSearchString = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("search");
if (isset($sSearchString)) {
$insertQuery .= "and ( {$sArticleTable}.OXTITLE like " . $oDB->quote("%{$sSearchString}%");
$insertQuery .= " or {$sArticleTable}.OXSHORTDESC like " . $oDB->quote("%$sSearchString%");
$insertQuery .= " or {$sArticleTable}.oxsearchkeys like " . $oDB->quote("%$sSearchString%") . " ) ";
}
if ($sCatAdd) {
$insertQuery .= $sCatAdd;
}
// add minimum stock value
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blUseStock') && ($dMinStock = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportMinStock"))) {
$dMinStock = str_replace([";", " ", "/", "'"], "", $dMinStock);
$insertQuery .= " and {$sArticleTable}.oxstock >= " . $oDB->quote($dMinStock);
}
$insertQuery .= " group by {$sArticleTable}.oxid";
return $oDB->execute($insertQuery) ? true : false;
} | [
"protected",
"function",
"_insertArticles",
"(",
"$",
"sHeapTable",
",",
"$",
"sCatAdd",
")",
"{",
"$",
"oDB",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"iExpLang",
"=",
"\\",
"Oxid... | inserts articles into heaptable
@param string $sHeapTable heap table name
@param string $sCatAdd category id filter (part of sql)
@return bool | [
"inserts",
"articles",
"into",
"heaptable"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L640-L684 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._removeParentArticles | protected function _removeParentArticles($sHeapTable)
{
if (!(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blExportMainVars"))) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sArticleTable = getViewName('oxarticles');
// we need to remove again parent articles so that we only have the variants itself
$sQ = "select $sHeapTable.oxid from $sHeapTable, $sArticleTable where
$sHeapTable.oxid = $sArticleTable.oxparentid group by $sHeapTable.oxid";
$oRs = $oDB->select($sQ);
$sDel = "delete from $sHeapTable where oxid in ( ";
$blSep = false;
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
if ($blSep) {
$sDel .= ",";
}
$sDel .= $oDB->quote($oRs->fields[0]);
$blSep = true;
$oRs->fetchRow();
}
}
$sDel .= " )";
$oDB->execute($sDel);
}
} | php | protected function _removeParentArticles($sHeapTable)
{
if (!(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blExportMainVars"))) {
$oDB = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sArticleTable = getViewName('oxarticles');
// we need to remove again parent articles so that we only have the variants itself
$sQ = "select $sHeapTable.oxid from $sHeapTable, $sArticleTable where
$sHeapTable.oxid = $sArticleTable.oxparentid group by $sHeapTable.oxid";
$oRs = $oDB->select($sQ);
$sDel = "delete from $sHeapTable where oxid in ( ";
$blSep = false;
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
if ($blSep) {
$sDel .= ",";
}
$sDel .= $oDB->quote($oRs->fields[0]);
$blSep = true;
$oRs->fetchRow();
}
}
$sDel .= " )";
$oDB->execute($sDel);
}
} | [
"protected",
"function",
"_removeParentArticles",
"(",
"$",
"sHeapTable",
")",
"{",
"if",
"(",
"!",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"\"blExportMainVars\"",
"... | removes parent articles so that we only have variants itself
@param string $sHeapTable table name | [
"removes",
"parent",
"articles",
"so",
"that",
"we",
"only",
"have",
"variants",
"itself"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L691-L717 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._setSessionParams | protected function _setSessionParams()
{
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportDelCost");
$dDelCost = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportDelCost");
if (isset($dDelCost)) {
$dDelCost = str_replace([";", " ", "/", "'"], "", $dDelCost);
$dDelCost = str_replace(",", ".", $dDelCost);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportDelCost", $dDelCost);
}
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportMinPrice");
$dMinPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportMinPrice");
if (isset($dMinPrice)) {
$dMinPrice = str_replace([";", " ", "/", "'"], "", $dMinPrice);
$dMinPrice = str_replace(",", ".", $dMinPrice);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportMinPrice", $dMinPrice);
}
// #827
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportCampaign");
$sCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCampaign");
if (isset($sCampaign)) {
$sCampaign = str_replace([";", " ", "/", "'"], "", $sCampaign);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportCampaign", $sCampaign);
}
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("blAppendCatToCampaign");
// now retrieve it from get or post.
$blAppendCatToCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blAppendCatToCampaign");
if ($blAppendCatToCampaign) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("blAppendCatToCampaign", $blAppendCatToCampaign);
}
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iExportLanguage");
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("iExportLanguage", \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iExportLanguage"));
//setting the custom header
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportCustomHeader", \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCustomHeader"));
} | php | protected function _setSessionParams()
{
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportDelCost");
$dDelCost = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportDelCost");
if (isset($dDelCost)) {
$dDelCost = str_replace([";", " ", "/", "'"], "", $dDelCost);
$dDelCost = str_replace(",", ".", $dDelCost);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportDelCost", $dDelCost);
}
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportMinPrice");
$dMinPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportMinPrice");
if (isset($dMinPrice)) {
$dMinPrice = str_replace([";", " ", "/", "'"], "", $dMinPrice);
$dMinPrice = str_replace(",", ".", $dMinPrice);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportMinPrice", $dMinPrice);
}
// #827
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("sExportCampaign");
$sCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCampaign");
if (isset($sCampaign)) {
$sCampaign = str_replace([";", " ", "/", "'"], "", $sCampaign);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportCampaign", $sCampaign);
}
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("blAppendCatToCampaign");
// now retrieve it from get or post.
$blAppendCatToCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blAppendCatToCampaign");
if ($blAppendCatToCampaign) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("blAppendCatToCampaign", $blAppendCatToCampaign);
}
// reset it from session
\OxidEsales\Eshop\Core\Registry::getSession()->deleteVariable("iExportLanguage");
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("iExportLanguage", \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iExportLanguage"));
//setting the custom header
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sExportCustomHeader", \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCustomHeader"));
} | [
"protected",
"function",
"_setSessionParams",
"(",
")",
"{",
"// reset it from session",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"deleteVariable",
"(",
"\"sExportDelCost\"",
")",
";",
"$",
"dDelCost",
... | stores some info in session | [
"stores",
"some",
"info",
"in",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L722-L763 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._loadRootCats | protected function _loadRootCats()
{
if ($this->_aCatLvlCache === null) {
$this->_aCatLvlCache = [];
$sCatView = getViewName('oxcategories');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// Load all root cat's == all trees
$sSQL = "select oxid from $sCatView where oxparentid = 'oxrootid'";
$oRs = $oDb->select($sSQL);
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
// now load each tree
$sSQL = "SELECT s.oxid, s.oxtitle,
s.oxparentid, count( * ) AS LEVEL FROM $sCatView v,
$sCatView s WHERE s.oxrootid = '" . $oRs->fields[0] . "' and
v.oxrootid='" . $oRs->fields[0] . "' and s.oxleft BETWEEN
v.oxleft AND v.oxright AND s.oxhidden = '0' GROUP BY s.oxleft order by level";
$oRs2 = $oDb->select($sSQL);
if ($oRs2 != false && $oRs2->count() > 0) {
while (!$oRs2->EOF) {
// store it
$oCat = new stdClass();
$oCat->_sOXID = $oRs2->fields[0];
$oCat->oxtitle = $oRs2->fields[1];
$oCat->oxparentid = $oRs2->fields[2];
$oCat->ilevel = $oRs2->fields[3];
$this->_aCatLvlCache[$oCat->_sOXID] = $oCat;
$oRs2->fetchRow();
}
}
$oRs->fetchRow();
}
}
}
return $this->_aCatLvlCache;
} | php | protected function _loadRootCats()
{
if ($this->_aCatLvlCache === null) {
$this->_aCatLvlCache = [];
$sCatView = getViewName('oxcategories');
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// Load all root cat's == all trees
$sSQL = "select oxid from $sCatView where oxparentid = 'oxrootid'";
$oRs = $oDb->select($sSQL);
if ($oRs != false && $oRs->count() > 0) {
while (!$oRs->EOF) {
// now load each tree
$sSQL = "SELECT s.oxid, s.oxtitle,
s.oxparentid, count( * ) AS LEVEL FROM $sCatView v,
$sCatView s WHERE s.oxrootid = '" . $oRs->fields[0] . "' and
v.oxrootid='" . $oRs->fields[0] . "' and s.oxleft BETWEEN
v.oxleft AND v.oxright AND s.oxhidden = '0' GROUP BY s.oxleft order by level";
$oRs2 = $oDb->select($sSQL);
if ($oRs2 != false && $oRs2->count() > 0) {
while (!$oRs2->EOF) {
// store it
$oCat = new stdClass();
$oCat->_sOXID = $oRs2->fields[0];
$oCat->oxtitle = $oRs2->fields[1];
$oCat->oxparentid = $oRs2->fields[2];
$oCat->ilevel = $oRs2->fields[3];
$this->_aCatLvlCache[$oCat->_sOXID] = $oCat;
$oRs2->fetchRow();
}
}
$oRs->fetchRow();
}
}
}
return $this->_aCatLvlCache;
} | [
"protected",
"function",
"_loadRootCats",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aCatLvlCache",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aCatLvlCache",
"=",
"[",
"]",
";",
"$",
"sCatView",
"=",
"getViewName",
"(",
"'oxcategories'",
")",
";",... | Load all root cat's == all trees
@return null | [
"Load",
"all",
"root",
"cat",
"s",
"==",
"all",
"trees"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L770-L810 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._findDeepestCatPath | protected function _findDeepestCatPath($oArticle)
{
$sRet = "";
// find deepest
$aIds = $oArticle->getCategoryIds();
if (is_array($aIds) && count($aIds)) {
if ($aCatLvlCache = $this->_loadRootCats()) {
$sIdMax = null;
$dMaxLvl = 0;
foreach ($aIds as $sCatId) {
if ($dMaxLvl < $aCatLvlCache[$sCatId]->ilevel) {
$dMaxLvl = $aCatLvlCache[$sCatId]->ilevel;
$sIdMax = $sCatId;
$sRet = $aCatLvlCache[$sCatId]->oxtitle;
}
}
// endless
while (true) {
if (!isset($aCatLvlCache[$sIdMax]->oxparentid) || $aCatLvlCache[$sIdMax]->oxparentid == "oxrootid") {
break;
}
$sIdMax = $aCatLvlCache[$sIdMax]->oxparentid;
$sRet = $aCatLvlCache[$sIdMax]->oxtitle . "/" . $sRet;
}
}
}
return $sRet;
} | php | protected function _findDeepestCatPath($oArticle)
{
$sRet = "";
// find deepest
$aIds = $oArticle->getCategoryIds();
if (is_array($aIds) && count($aIds)) {
if ($aCatLvlCache = $this->_loadRootCats()) {
$sIdMax = null;
$dMaxLvl = 0;
foreach ($aIds as $sCatId) {
if ($dMaxLvl < $aCatLvlCache[$sCatId]->ilevel) {
$dMaxLvl = $aCatLvlCache[$sCatId]->ilevel;
$sIdMax = $sCatId;
$sRet = $aCatLvlCache[$sCatId]->oxtitle;
}
}
// endless
while (true) {
if (!isset($aCatLvlCache[$sIdMax]->oxparentid) || $aCatLvlCache[$sIdMax]->oxparentid == "oxrootid") {
break;
}
$sIdMax = $aCatLvlCache[$sIdMax]->oxparentid;
$sRet = $aCatLvlCache[$sIdMax]->oxtitle . "/" . $sRet;
}
}
}
return $sRet;
} | [
"protected",
"function",
"_findDeepestCatPath",
"(",
"$",
"oArticle",
")",
"{",
"$",
"sRet",
"=",
"\"\"",
";",
"// find deepest",
"$",
"aIds",
"=",
"$",
"oArticle",
"->",
"getCategoryIds",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aIds",
")",
"&&"... | finds deepest category path
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@return string | [
"finds",
"deepest",
"category",
"path"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L819-L849 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/DynamicExportBaseController.php | DynamicExportBaseController._setCampaignDetailLink | protected function _setCampaignDetailLink($oArticle)
{
// #827
if ($sCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCampaign")) {
// modify detaillink
//#1166R - pangora - campaign
$oArticle->appendLink("campaign={$sCampaign}");
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blAppendCatToCampaign") &&
($sCat = $this->getCategoryString($oArticle))
) {
$oArticle->appendLink("/$sCat");
}
}
return $oArticle;
} | php | protected function _setCampaignDetailLink($oArticle)
{
// #827
if ($sCampaign = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sExportCampaign")) {
// modify detaillink
//#1166R - pangora - campaign
$oArticle->appendLink("campaign={$sCampaign}");
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("blAppendCatToCampaign") &&
($sCat = $this->getCategoryString($oArticle))
) {
$oArticle->appendLink("/$sCat");
}
}
return $oArticle;
} | [
"protected",
"function",
"_setCampaignDetailLink",
"(",
"$",
"oArticle",
")",
"{",
"// #827",
"if",
"(",
"$",
"sCampaign",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
... | sets detail link for campaigns
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@return \OxidEsales\Eshop\Application\Model\Article | [
"sets",
"detail",
"link",
"for",
"campaigns"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/DynamicExportBaseController.php#L894-L910 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.getArticleRecommUri | public function getArticleRecommUri($oArticle, $iLang)
{
$sSeoUri = null;
if ($oRecomm = $this->_getRecomm($oArticle, $iLang)) {
//load details link from DB
if (!($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oRecomm->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderRecomm::class)->getRecommUri($oRecomm, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['recommid' => $oRecomm->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oRecomm->getId()
);
}
}
return $sSeoUri;
} | php | public function getArticleRecommUri($oArticle, $iLang)
{
$sSeoUri = null;
if ($oRecomm = $this->_getRecomm($oArticle, $iLang)) {
//load details link from DB
if (!($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oRecomm->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderRecomm::class)->getRecommUri($oRecomm, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['recommid' => $oRecomm->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oRecomm->getId()
);
}
}
return $sSeoUri;
} | [
"public",
"function",
"getArticleRecommUri",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
"{",
"$",
"sSeoUri",
"=",
"null",
";",
"if",
"(",
"$",
"oRecomm",
"=",
"$",
"this",
"->",
"_getRecomm",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
")",
"{",... | Returns SEO uri for passed article and active tag
@deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@param int $iLang language id
@return string | [
"Returns",
"SEO",
"uri",
"for",
"passed",
"article",
"and",
"active",
"tag"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L69-L102 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._getRecomm | protected function _getRecomm($oArticle, $iLang)
{
$oList = null;
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
$oList = $oView->getActiveRecommList();
}
return $oList;
} | php | protected function _getRecomm($oArticle, $iLang)
{
$oList = null;
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
$oList = $oView->getActiveRecommList();
}
return $oList;
} | [
"protected",
"function",
"_getRecomm",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"$",
"oView",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getActiv... | Returns active recommendation list object if available
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@param int $iLang language id
@deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
@return \OxidEsales\Eshop\Application\Model\RecommendationList | null | [
"Returns",
"active",
"recommendation",
"list",
"object",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L114-L123 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._createArticleCategoryUri | protected function _createArticleCategoryUri($oArticle, $oCategory, $iLang)
{
startProfile(__FUNCTION__);
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// writing category path
$sSeoUri = $this->_processSeoUrl(
\OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class)->getCategoryUri($oCategory, $iLang) . $sTitle,
$oArticle->getId(),
$iLang
);
$sCatId = $oCategory->getId();
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
['cnid' => $sCatId]
),
$sSeoUri,
$iLang,
null,
0,
$sCatId
);
stopProfile(__FUNCTION__);
return $sSeoUri;
} | php | protected function _createArticleCategoryUri($oArticle, $oCategory, $iLang)
{
startProfile(__FUNCTION__);
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// writing category path
$sSeoUri = $this->_processSeoUrl(
\OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class)->getCategoryUri($oCategory, $iLang) . $sTitle,
$oArticle->getId(),
$iLang
);
$sCatId = $oCategory->getId();
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
['cnid' => $sCatId]
),
$sSeoUri,
$iLang,
null,
0,
$sCatId
);
stopProfile(__FUNCTION__);
return $sSeoUri;
} | [
"protected",
"function",
"_createArticleCategoryUri",
"(",
"$",
"oArticle",
",",
"$",
"oCategory",
",",
"$",
"iLang",
")",
"{",
"startProfile",
"(",
"__FUNCTION__",
")",
";",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"_getProductForLang",
"(",
"$",
"oArticle",
... | create article uri for given category and save it
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@param \OxidEsales\Eshop\Application\Model\Category $oCategory category object
@param int $iLang language to generate uri for
@return string | [
"create",
"article",
"uri",
"for",
"given",
"category",
"and",
"save",
"it"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L144-L176 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._getCategory | protected function _getCategory($oArticle, $iLang)
{
$oCat = null;
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
$oCat = $oView->getActiveCategory();
} elseif ($oView instanceof \OxidEsales\Eshop\Core\Controller\BaseController) {
$oCat = $oView->getActCategory();
}
return $oCat;
} | php | protected function _getCategory($oArticle, $iLang)
{
$oCat = null;
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
$oCat = $oView->getActiveCategory();
} elseif ($oView instanceof \OxidEsales\Eshop\Core\Controller\BaseController) {
$oCat = $oView->getActCategory();
}
return $oCat;
} | [
"protected",
"function",
"_getCategory",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
"{",
"$",
"oCat",
"=",
"null",
";",
"$",
"oView",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getActi... | Returns active category if available
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@param int $iLang language id
@return \OxidEsales\Eshop\Application\Model\Category | null | [
"Returns",
"active",
"category",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L227-L238 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._getMainCategory | protected function _getMainCategory($oArticle)
{
$oMainCat = null;
// if variant parent id must be used
$sArtId = $oArticle->getId();
if (isset($oArticle->oxarticles__oxparentid->value) && $oArticle->oxarticles__oxparentid->value) {
$sArtId = $oArticle->oxarticles__oxparentid->value;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// add main category caching;
$sQ = "select oxcatnid from " . getViewName("oxobject2category") . " where oxobjectid = " . $oDb->quote($sArtId) . " order by oxtime";
$sIdent = md5($sQ);
if (($sMainCatId = $this->_loadFromCache($sIdent, "oxarticle")) === false) {
$sMainCatId = $oDb->getOne($sQ);
// storing in cache
$this->_saveInCache($sIdent, $sMainCatId, "oxarticle");
}
if ($sMainCatId) {
$oMainCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
if (!$oMainCat->load($sMainCatId)) {
$oMainCat = null;
}
}
return $oMainCat;
} | php | protected function _getMainCategory($oArticle)
{
$oMainCat = null;
// if variant parent id must be used
$sArtId = $oArticle->getId();
if (isset($oArticle->oxarticles__oxparentid->value) && $oArticle->oxarticles__oxparentid->value) {
$sArtId = $oArticle->oxarticles__oxparentid->value;
}
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
// add main category caching;
$sQ = "select oxcatnid from " . getViewName("oxobject2category") . " where oxobjectid = " . $oDb->quote($sArtId) . " order by oxtime";
$sIdent = md5($sQ);
if (($sMainCatId = $this->_loadFromCache($sIdent, "oxarticle")) === false) {
$sMainCatId = $oDb->getOne($sQ);
// storing in cache
$this->_saveInCache($sIdent, $sMainCatId, "oxarticle");
}
if ($sMainCatId) {
$oMainCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
if (!$oMainCat->load($sMainCatId)) {
$oMainCat = null;
}
}
return $oMainCat;
} | [
"protected",
"function",
"_getMainCategory",
"(",
"$",
"oArticle",
")",
"{",
"$",
"oMainCat",
"=",
"null",
";",
"// if variant parent id must be used",
"$",
"sArtId",
"=",
"$",
"oArticle",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"oArticle... | Returns products main category id
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@return string | [
"Returns",
"products",
"main",
"category",
"id"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L247-L276 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.getArticleVendorUri | public function getArticleVendorUri($oArticle, $iLang, $blRegenerate = false)
{
startProfile(__FUNCTION__);
$sSeoUri = null;
if ($oVendor = $this->_getVendor($oArticle, $iLang)) {
//load details link from DB
if ($blRegenerate || !($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oVendor->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderVendor::class)->getVendorUri($oVendor, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['cnid' => "v_" . $oVendor->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oVendor->getId()
);
}
stopProfile(__FUNCTION__);
}
return $sSeoUri;
} | php | public function getArticleVendorUri($oArticle, $iLang, $blRegenerate = false)
{
startProfile(__FUNCTION__);
$sSeoUri = null;
if ($oVendor = $this->_getVendor($oArticle, $iLang)) {
//load details link from DB
if ($blRegenerate || !($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oVendor->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderVendor::class)->getVendorUri($oVendor, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['cnid' => "v_" . $oVendor->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oVendor->getId()
);
}
stopProfile(__FUNCTION__);
}
return $sSeoUri;
} | [
"public",
"function",
"getArticleVendorUri",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
",",
"$",
"blRegenerate",
"=",
"false",
")",
"{",
"startProfile",
"(",
"__FUNCTION__",
")",
";",
"$",
"sSeoUri",
"=",
"null",
";",
"if",
"(",
"$",
"oVendor",
"=",
"$",
... | Returns vendor seo uri for current article
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@param int $iLang language id
@param bool $blRegenerate if TRUE forces seo url regeneration
@return string | [
"Returns",
"vendor",
"seo",
"uri",
"for",
"current",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L366-L403 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._getVendor | protected function _getVendor($oArticle, $iLang)
{
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
$oVendor = null;
if ($sActVendorId = $oArticle->oxarticles__oxvendorid->value) {
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActVendor = $oView->getActVendor())) {
$oVendor = $oActVendor;
} else {
$oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
}
if ($oVendor->getId() !== $sActVendorId) {
$oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
if (!$oVendor->loadInLang($iLang, $sActVendorId)) {
$oVendor = null;
}
}
}
return $oVendor;
} | php | protected function _getVendor($oArticle, $iLang)
{
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
$oVendor = null;
if ($sActVendorId = $oArticle->oxarticles__oxvendorid->value) {
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActVendor = $oView->getActVendor())) {
$oVendor = $oActVendor;
} else {
$oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
}
if ($oVendor->getId() !== $sActVendorId) {
$oVendor = oxNew(\OxidEsales\Eshop\Application\Model\Vendor::class);
if (!$oVendor->loadInLang($iLang, $sActVendorId)) {
$oVendor = null;
}
}
}
return $oVendor;
} | [
"protected",
"function",
"_getVendor",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
"{",
"$",
"oView",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getActiveView",
"(",
")",
";",
"$",
"oVe... | Returns active vendor if available
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@param int $iLang language id
@return \OxidEsales\Eshop\Application\Model\Vendor | null | [
"Returns",
"active",
"vendor",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L413-L433 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.getArticleManufacturerUri | public function getArticleManufacturerUri($oArticle, $iLang, $blRegenerate = false)
{
$sSeoUri = null;
startProfile(__FUNCTION__);
if ($oManufacturer = $this->_getManufacturer($oArticle, $iLang)) {
//load details link from DB
if ($blRegenerate || !($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oManufacturer->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderManufacturer::class)->getManufacturerUri($oManufacturer, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['mnid' => $oManufacturer->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oManufacturer->getId()
);
}
stopProfile(__FUNCTION__);
}
return $sSeoUri;
} | php | public function getArticleManufacturerUri($oArticle, $iLang, $blRegenerate = false)
{
$sSeoUri = null;
startProfile(__FUNCTION__);
if ($oManufacturer = $this->_getManufacturer($oArticle, $iLang)) {
//load details link from DB
if ($blRegenerate || !($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $oManufacturer->getId(), true))) {
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
// create uri for all categories
$sSeoUri = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderManufacturer::class)->getManufacturerUri($oManufacturer, $iLang);
$sSeoUri = $this->_processSeoUrl($sSeoUri . $sTitle, $oArticle->getId(), $iLang);
$aStdParams = ['mnid' => $oManufacturer->getId(), 'listtype' => $this->_getListType()];
$this->_saveToDb(
'oxarticle',
$oArticle->getId(),
\OxidEsales\Eshop\Core\Registry::getUtilsUrl()->appendUrl(
$oArticle->getBaseStdLink($iLang),
$aStdParams
),
$sSeoUri,
$iLang,
null,
0,
$oManufacturer->getId()
);
}
stopProfile(__FUNCTION__);
}
return $sSeoUri;
} | [
"public",
"function",
"getArticleManufacturerUri",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
",",
"$",
"blRegenerate",
"=",
"false",
")",
"{",
"$",
"sSeoUri",
"=",
"null",
";",
"startProfile",
"(",
"__FUNCTION__",
")",
";",
"if",
"(",
"$",
"oManufacturer",
... | Returns manufacturer seo uri for current article
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@param int $iLang language id
@param bool $blRegenerate if TRUE forces seo url regeneration
@return string | [
"Returns",
"manufacturer",
"seo",
"uri",
"for",
"current",
"article"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L444-L480 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle._getManufacturer | protected function _getManufacturer($oArticle, $iLang)
{
$oManufacturer = null;
if ($sActManufacturerId = $oArticle->oxarticles__oxmanufacturerid->value) {
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActManufacturer = $oView->getActManufacturer())) {
$oManufacturer = $oActManufacturer;
} else {
$oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
}
if ($oManufacturer->getId() !== $sActManufacturerId || $oManufacturer->getLanguage() != $iLang) {
$oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
if (!$oManufacturer->loadInLang($iLang, $sActManufacturerId)) {
$oManufacturer = null;
}
}
}
return $oManufacturer;
} | php | protected function _getManufacturer($oArticle, $iLang)
{
$oManufacturer = null;
if ($sActManufacturerId = $oArticle->oxarticles__oxmanufacturerid->value) {
$oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActManufacturer = $oView->getActManufacturer())) {
$oManufacturer = $oActManufacturer;
} else {
$oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
}
if ($oManufacturer->getId() !== $sActManufacturerId || $oManufacturer->getLanguage() != $iLang) {
$oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
if (!$oManufacturer->loadInLang($iLang, $sActManufacturerId)) {
$oManufacturer = null;
}
}
}
return $oManufacturer;
} | [
"protected",
"function",
"_getManufacturer",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
")",
"{",
"$",
"oManufacturer",
"=",
"null",
";",
"if",
"(",
"$",
"sActManufacturerId",
"=",
"$",
"oArticle",
"->",
"oxarticles__oxmanufacturerid",
"->",
"value",
")",
"{",
... | Returns active manufacturer if available
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@param int $iLang language id
@return \OxidEsales\Eshop\Application\Model\Manufacturer | null | [
"Returns",
"active",
"manufacturer",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L490-L511 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.getArticleMainUrl | public function getArticleMainUrl($oArticle, $iLang = null)
{
if (!isset($iLang)) {
$iLang = $oArticle->getLanguage();
}
return $this->_getFullUrl($this->getArticleMainUri($oArticle, $iLang), $iLang);
} | php | public function getArticleMainUrl($oArticle, $iLang = null)
{
if (!isset($iLang)) {
$iLang = $oArticle->getLanguage();
}
return $this->_getFullUrl($this->getArticleMainUri($oArticle, $iLang), $iLang);
} | [
"public",
"function",
"getArticleMainUrl",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"iLang",
")",
")",
"{",
"$",
"iLang",
"=",
"$",
"oArticle",
"->",
"getLanguage",
"(",
")",
";",
"}",
"retu... | return article main url, with path of its default category
@param \OxidEsales\Eshop\Application\Model\Article $oArticle product
@param int $iLang language id
@return string | [
"return",
"article",
"main",
"url",
"with",
"path",
"of",
"its",
"default",
"category"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L521-L528 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.getArticleUrl | public function getArticleUrl($oArticle, $iLang = null, $iType = 0)
{
if (!isset($iLang)) {
$iLang = $oArticle->getLanguage();
}
$sUri = null;
switch ($iType) {
case OXARTICLE_LINKTYPE_VENDOR:
$sUri = $this->getArticleVendorUri($oArticle, $iLang);
break;
case OXARTICLE_LINKTYPE_MANUFACTURER:
$sUri = $this->getArticleManufacturerUri($oArticle, $iLang);
break;
// @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
case OXARTICLE_LINKTYPE_RECOMM:
$sUri = $this->getArticleRecommUri($oArticle, $iLang);
break;
// END deprecated
case OXARTICLE_LINKTYPE_PRICECATEGORY: // goes price category urls to default (category urls)
default:
$sUri = $this->getArticleUri($oArticle, $iLang);
break;
}
// if was unable to fetch type uri - returning main
if (!$sUri) {
$sUri = $this->getArticleMainUri($oArticle, $iLang);
}
return $this->_getFullUrl($sUri, $iLang);
} | php | public function getArticleUrl($oArticle, $iLang = null, $iType = 0)
{
if (!isset($iLang)) {
$iLang = $oArticle->getLanguage();
}
$sUri = null;
switch ($iType) {
case OXARTICLE_LINKTYPE_VENDOR:
$sUri = $this->getArticleVendorUri($oArticle, $iLang);
break;
case OXARTICLE_LINKTYPE_MANUFACTURER:
$sUri = $this->getArticleManufacturerUri($oArticle, $iLang);
break;
// @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
case OXARTICLE_LINKTYPE_RECOMM:
$sUri = $this->getArticleRecommUri($oArticle, $iLang);
break;
// END deprecated
case OXARTICLE_LINKTYPE_PRICECATEGORY: // goes price category urls to default (category urls)
default:
$sUri = $this->getArticleUri($oArticle, $iLang);
break;
}
// if was unable to fetch type uri - returning main
if (!$sUri) {
$sUri = $this->getArticleMainUri($oArticle, $iLang);
}
return $this->_getFullUrl($sUri, $iLang);
} | [
"public",
"function",
"getArticleUrl",
"(",
"$",
"oArticle",
",",
"$",
"iLang",
"=",
"null",
",",
"$",
"iType",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"iLang",
")",
")",
"{",
"$",
"iLang",
"=",
"$",
"oArticle",
"->",
"getLanguage",
... | Encodes article URLs into SEO format
@param \OxidEsales\Eshop\Application\Model\Article $oArticle Article object
@param int $iLang language
@param int $iType type
@return string | [
"Encodes",
"article",
"URLs",
"into",
"SEO",
"format"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L539-L570 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/SeoEncoderArticle.php | SeoEncoderArticle.onDeleteArticle | public function onDeleteArticle($oArticle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sIdQuoted = $oDb->quote($oArticle->getId());
$oDb->execute("delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxarticle'");
$oDb->execute("delete from oxobject2seodata where oxobjectid = $sIdQuoted");
$oDb->execute("delete from oxseohistory where oxobjectid = $sIdQuoted");
} | php | public function onDeleteArticle($oArticle)
{
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sIdQuoted = $oDb->quote($oArticle->getId());
$oDb->execute("delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxarticle'");
$oDb->execute("delete from oxobject2seodata where oxobjectid = $sIdQuoted");
$oDb->execute("delete from oxseohistory where oxobjectid = $sIdQuoted");
} | [
"public",
"function",
"onDeleteArticle",
"(",
"$",
"oArticle",
")",
"{",
"$",
"oDb",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"sIdQuoted",
"=",
"$",
"oDb",
"->",
"quote",
"(",
"$... | deletes article seo entries
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article to remove | [
"deletes",
"article",
"seo",
"entries"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/SeoEncoderArticle.php#L577-L584 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ActionsArticleAjax.php | ActionsArticleAjax.removeActionArticle | public function removeActionArticle()
{
$sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
//$sActionId = $this->getConfig()->getConfigParam( 'oxid' );
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oDb->Execute(
'delete from oxobject2action '
. 'where oxactionid=' . $oDb->quote($sActionId)
. ' and oxclass = "oxarticle"'
);
} | php | public function removeActionArticle()
{
$sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
//$sActionId = $this->getConfig()->getConfigParam( 'oxid' );
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$oDb->Execute(
'delete from oxobject2action '
. 'where oxactionid=' . $oDb->quote($sActionId)
. ' and oxclass = "oxarticle"'
);
} | [
"public",
"function",
"removeActionArticle",
"(",
")",
"{",
"$",
"sActionId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'oxid'",
")",
";",
"//$sActionId = $this->getCon... | Removing article assignment | [
"Removing",
"article",
"assignment"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ActionsArticleAjax.php#L102-L114 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.