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/Application/Controller/Admin/VoucherSerieGenerate.php | VoucherSerieGenerate.generateVoucher | public function generateVoucher($iCnt)
{
$iAmount = abs((int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherAmount"));
// creating new vouchers
if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
if (!$this->_iGenerated) {
$this->_iGenerated = $iCnt;
}
$blRandomNr = ( bool ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("randomVoucherNr");
$sVoucherNr = $blRandomNr ? \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID() : \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherNr");
$oNewVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oNewVoucher->oxvouchers__oxvoucherserieid = new \OxidEsales\Eshop\Core\Field($oVoucherSerie->getId());
$oNewVoucher->oxvouchers__oxvouchernr = new \OxidEsales\Eshop\Core\Field($sVoucherNr);
$oNewVoucher->save();
$this->_iGenerated++;
}
return $this->_iGenerated;
} | php | public function generateVoucher($iCnt)
{
$iAmount = abs((int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherAmount"));
// creating new vouchers
if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
if (!$this->_iGenerated) {
$this->_iGenerated = $iCnt;
}
$blRandomNr = ( bool ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("randomVoucherNr");
$sVoucherNr = $blRandomNr ? \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID() : \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherNr");
$oNewVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oNewVoucher->oxvouchers__oxvoucherserieid = new \OxidEsales\Eshop\Core\Field($oVoucherSerie->getId());
$oNewVoucher->oxvouchers__oxvouchernr = new \OxidEsales\Eshop\Core\Field($sVoucherNr);
$oNewVoucher->save();
$this->_iGenerated++;
}
return $this->_iGenerated;
} | [
"public",
"function",
"generateVoucher",
"(",
"$",
"iCnt",
")",
"{",
"$",
"iAmount",
"=",
"abs",
"(",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"\"voucherAm... | Generates and saves vouchers. Returns number of saved records
@param int $iCnt voucher counter offset
@return int saved record count | [
"Generates",
"and",
"saves",
"vouchers",
".",
"Returns",
"number",
"of",
"saved",
"records"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/VoucherSerieGenerate.php#L76-L98 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/VoucherSerieGenerate.php | VoucherSerieGenerate.run | public function run()
{
$blContinue = true;
$iExportedItems = 0;
// file is open
$iStart = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iStart");
for ($i = $iStart; $i < $iStart + $this->iGeneratePerTick; $i++) {
if (($iExportedItems = $this->nextTick($i)) === false) {
// end reached
$this->stop(ERR_SUCCESS);
$blContinue = false;
break;
}
}
if ($blContinue) {
// make ticker continue
$this->_aViewData['refresh'] = 0;
$this->_aViewData['iStart'] = $i;
$this->_aViewData['iExpItems'] = $iExportedItems;
}
} | php | public function run()
{
$blContinue = true;
$iExportedItems = 0;
// file is open
$iStart = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("iStart");
for ($i = $iStart; $i < $iStart + $this->iGeneratePerTick; $i++) {
if (($iExportedItems = $this->nextTick($i)) === false) {
// end reached
$this->stop(ERR_SUCCESS);
$blContinue = false;
break;
}
}
if ($blContinue) {
// make ticker continue
$this->_aViewData['refresh'] = 0;
$this->_aViewData['iStart'] = $i;
$this->_aViewData['iExpItems'] = $iExportedItems;
}
} | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"blContinue",
"=",
"true",
";",
"$",
"iExportedItems",
"=",
"0",
";",
"// file is open",
"$",
"iStart",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
... | Runs voucher generation | [
"Runs",
"voucher",
"generation"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/VoucherSerieGenerate.php#L103-L126 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._cleanEmptyParents | protected function _cleanEmptyParents($dom, $parentXPath, $childXPath)
{
$xPath = new DomXPath($dom);
$nodeList = $xPath->query($parentXPath);
foreach ($nodeList as $node) {
$id = $node->getAttribute('id');
$childList = $xPath->query("{$parentXPath}[@id='$id']/$childXPath");
if (!$childList->length) {
$node->parentNode->removeChild($node);
}
}
} | php | protected function _cleanEmptyParents($dom, $parentXPath, $childXPath)
{
$xPath = new DomXPath($dom);
$nodeList = $xPath->query($parentXPath);
foreach ($nodeList as $node) {
$id = $node->getAttribute('id');
$childList = $xPath->query("{$parentXPath}[@id='$id']/$childXPath");
if (!$childList->length) {
$node->parentNode->removeChild($node);
}
}
} | [
"protected",
"function",
"_cleanEmptyParents",
"(",
"$",
"dom",
",",
"$",
"parentXPath",
",",
"$",
"childXPath",
")",
"{",
"$",
"xPath",
"=",
"new",
"DomXPath",
"(",
"$",
"dom",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"$",
"... | clean empty nodes from tree
@param object $dom dom object
@param string $parentXPath parent xpath
@param string $childXPath child xpath from parent | [
"clean",
"empty",
"nodes",
"from",
"tree"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L54-L66 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._addLinks | protected function _addLinks($dom)
{
$url = 'index.php?'; // session parameters will be included later (after cache processor)
$xPath = new DomXPath($dom);
// building
$nodeList = $xPath->query("//SUBMENU[@cl]");
foreach ($nodeList as $node) {
// fetching class
$cl = $node->getAttribute('cl');
$cl = $cl ? "cl=$cl" : '';
// fetching params
$param = $node->getAttribute('clparam');
$param = $param ? "&$param" : '';
// setting link
$node->setAttribute('link', "{$url}{$cl}{$param}");
}
} | php | protected function _addLinks($dom)
{
$url = 'index.php?'; // session parameters will be included later (after cache processor)
$xPath = new DomXPath($dom);
// building
$nodeList = $xPath->query("//SUBMENU[@cl]");
foreach ($nodeList as $node) {
// fetching class
$cl = $node->getAttribute('cl');
$cl = $cl ? "cl=$cl" : '';
// fetching params
$param = $node->getAttribute('clparam');
$param = $param ? "&$param" : '';
// setting link
$node->setAttribute('link', "{$url}{$cl}{$param}");
}
} | [
"protected",
"function",
"_addLinks",
"(",
"$",
"dom",
")",
"{",
"$",
"url",
"=",
"'index.php?'",
";",
"// session parameters will be included later (after cache processor)",
"$",
"xPath",
"=",
"new",
"DomXPath",
"(",
"$",
"dom",
")",
";",
"// building",
"$",
"nod... | Adds links to xml nodes to resolve paths
@param DomDocument $dom where to add links | [
"Adds",
"links",
"to",
"xml",
"nodes",
"to",
"resolve",
"paths"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L73-L92 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._loadFromFile | protected function _loadFromFile($menuFile, $dom)
{
$merge = false;
$domFile = new DomDocument();
$domFile->preserveWhiteSpace = false;
if (!@$domFile->load($menuFile)) {
$merge = true;
} elseif (is_readable($menuFile) && ($xml = @file_get_contents($menuFile))) {
// looking for non supported character encoding
if (getStr()->preg_match("/encoding\=(.*)\?\>/", $xml, $matches) !== 0) {
if (isset($matches[1])) {
$currEncoding = trim($matches[1], "\"");
if (!in_array(strtolower($currEncoding), $this->_aSupportedExpathXmlEncodings)) {
$xml = str_replace($matches[1], "\"UTF-8\"", $xml);
$xml = iconv($currEncoding, "UTF-8", $xml);
}
}
}
// load XML as string
if (@$domFile->loadXml($xml)) {
$merge = true;
}
}
if ($merge) {
$this->_merge($domFile, $dom);
}
} | php | protected function _loadFromFile($menuFile, $dom)
{
$merge = false;
$domFile = new DomDocument();
$domFile->preserveWhiteSpace = false;
if (!@$domFile->load($menuFile)) {
$merge = true;
} elseif (is_readable($menuFile) && ($xml = @file_get_contents($menuFile))) {
// looking for non supported character encoding
if (getStr()->preg_match("/encoding\=(.*)\?\>/", $xml, $matches) !== 0) {
if (isset($matches[1])) {
$currEncoding = trim($matches[1], "\"");
if (!in_array(strtolower($currEncoding), $this->_aSupportedExpathXmlEncodings)) {
$xml = str_replace($matches[1], "\"UTF-8\"", $xml);
$xml = iconv($currEncoding, "UTF-8", $xml);
}
}
}
// load XML as string
if (@$domFile->loadXml($xml)) {
$merge = true;
}
}
if ($merge) {
$this->_merge($domFile, $dom);
}
} | [
"protected",
"function",
"_loadFromFile",
"(",
"$",
"menuFile",
",",
"$",
"dom",
")",
"{",
"$",
"merge",
"=",
"false",
";",
"$",
"domFile",
"=",
"new",
"DomDocument",
"(",
")",
";",
"$",
"domFile",
"->",
"preserveWhiteSpace",
"=",
"false",
";",
"if",
"... | Loads data form XML file, and merges it with main oDomXML.
@param string $menuFile which file to load
@param DomDocument $dom where to load | [
"Loads",
"data",
"form",
"XML",
"file",
"and",
"merges",
"it",
"with",
"main",
"oDomXML",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L100-L128 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._sessionizeLocalUrls | protected function _sessionizeLocalUrls($dom)
{
$url = $this->_getAdminUrl();
$xPath = new DomXPath($dom);
$str = getStr();
foreach (['url', 'link'] as $attrType) {
foreach ($xPath->query("//OXMENU//*[@$attrType]") as $node) {
$localUrl = $node->getAttribute($attrType);
if (strpos($localUrl, 'index.php?') === 0) {
$localUrl = $str->preg_replace('#^index.php\?#', $url, $localUrl);
$node->setAttribute($attrType, $localUrl);
}
}
}
} | php | protected function _sessionizeLocalUrls($dom)
{
$url = $this->_getAdminUrl();
$xPath = new DomXPath($dom);
$str = getStr();
foreach (['url', 'link'] as $attrType) {
foreach ($xPath->query("//OXMENU//*[@$attrType]") as $node) {
$localUrl = $node->getAttribute($attrType);
if (strpos($localUrl, 'index.php?') === 0) {
$localUrl = $str->preg_replace('#^index.php\?#', $url, $localUrl);
$node->setAttribute($attrType, $localUrl);
}
}
}
} | [
"protected",
"function",
"_sessionizeLocalUrls",
"(",
"$",
"dom",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_getAdminUrl",
"(",
")",
";",
"$",
"xPath",
"=",
"new",
"DomXPath",
"(",
"$",
"dom",
")",
";",
"$",
"str",
"=",
"getStr",
"(",
")",
";"... | add session parameters to local urls
@param object $dom dom element to add links | [
"add",
"session",
"parameters",
"to",
"local",
"urls"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L135-L149 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._checkRights | protected function _checkRights($dom)
{
$xPath = new DomXPath($dom);
$nodeList = $xPath->query('//*[@rights or @norights]');
foreach ($nodeList as $node) {
// only allowed modules/user rights or so
if (($req = $node->getAttribute('rights'))) {
$perms = explode(',', $req);
foreach ($perms as $perm) {
if ($perm && !$this->_hasRights($perm)) {
$node->parentNode->removeChild($node);
}
}
// not allowed modules/user rights or so
} elseif (($noReq = $node->getAttribute('norights'))) {
$perms = explode(',', $noReq);
foreach ($perms as $perm) {
if ($perm && $this->_hasRights($perm)) {
$node->parentNode->removeChild($node);
}
}
}
}
} | php | protected function _checkRights($dom)
{
$xPath = new DomXPath($dom);
$nodeList = $xPath->query('//*[@rights or @norights]');
foreach ($nodeList as $node) {
// only allowed modules/user rights or so
if (($req = $node->getAttribute('rights'))) {
$perms = explode(',', $req);
foreach ($perms as $perm) {
if ($perm && !$this->_hasRights($perm)) {
$node->parentNode->removeChild($node);
}
}
// not allowed modules/user rights or so
} elseif (($noReq = $node->getAttribute('norights'))) {
$perms = explode(',', $noReq);
foreach ($perms as $perm) {
if ($perm && $this->_hasRights($perm)) {
$node->parentNode->removeChild($node);
}
}
}
}
} | [
"protected",
"function",
"_checkRights",
"(",
"$",
"dom",
")",
"{",
"$",
"xPath",
"=",
"new",
"DomXPath",
"(",
"$",
"dom",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"'//*[@rights or @norights]'",
")",
";",
"foreach",
"(",
"$",
"... | Removes form tree elements which does not have required user rights
@param object $dom DOMDocument | [
"Removes",
"form",
"tree",
"elements",
"which",
"does",
"not",
"have",
"required",
"user",
"rights"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L156-L180 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._checkDemoShopDenials | protected function _checkDemoShopDenials($dom)
{
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->isDemoShop()) {
// nothing to check for non demo shop
return;
}
$xPath = new DomXPath($dom);
$nodeList = $xPath->query("//*[@disableForDemoShop]");
foreach ($nodeList as $node) {
if ($node->getAttribute('disableForDemoShop')) {
$node->parentNode->removeChild($node);
}
}
} | php | protected function _checkDemoShopDenials($dom)
{
if (!\OxidEsales\Eshop\Core\Registry::getConfig()->isDemoShop()) {
// nothing to check for non demo shop
return;
}
$xPath = new DomXPath($dom);
$nodeList = $xPath->query("//*[@disableForDemoShop]");
foreach ($nodeList as $node) {
if ($node->getAttribute('disableForDemoShop')) {
$node->parentNode->removeChild($node);
}
}
} | [
"protected",
"function",
"_checkDemoShopDenials",
"(",
"$",
"dom",
")",
"{",
"if",
"(",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"isDemoShop",
"(",
")",
")",
"{",
"// nothing to check for non ... | Removes form tree elements if this is demo shop and elements have disableForDemoShop="1"
@param DOMDocument $dom document to check group
@return null | [
"Removes",
"form",
"tree",
"elements",
"if",
"this",
"is",
"demo",
"shop",
"and",
"elements",
"have",
"disableForDemoShop",
"=",
"1"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L220-L234 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._copyAttributes | protected function _copyAttributes($domElemTo, $domElemFrom)
{
foreach ($domElemFrom->attributes as $attr) {
$domElemTo->setAttribute($attr->nodeName, $attr->nodeValue);
}
} | php | protected function _copyAttributes($domElemTo, $domElemFrom)
{
foreach ($domElemFrom->attributes as $attr) {
$domElemTo->setAttribute($attr->nodeName, $attr->nodeValue);
}
} | [
"protected",
"function",
"_copyAttributes",
"(",
"$",
"domElemTo",
",",
"$",
"domElemFrom",
")",
"{",
"foreach",
"(",
"$",
"domElemFrom",
"->",
"attributes",
"as",
"$",
"attr",
")",
"{",
"$",
"domElemTo",
"->",
"setAttribute",
"(",
"$",
"attr",
"->",
"node... | Copys attributes form one element to another
@param object $domElemTo DOMElement
@param object $domElemFrom DOMElement | [
"Copys",
"attributes",
"form",
"one",
"element",
"to",
"another"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L258-L263 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._mergeNodes | protected function _mergeNodes($domElemTo, $domElemFrom, $xPathTo, $domDocTo, $queryStart)
{
foreach ($domElemFrom->childNodes as $fromNode) {
if ($fromNode->nodeType === XML_ELEMENT_NODE) {
$fromAttrName = $fromNode->getAttribute('id');
$fromNodeName = $fromNode->tagName;
// find current item
$query = "{$queryStart}/{$fromNodeName}[@id='{$fromAttrName}']";
$curNode = $xPathTo->query($query);
// if not found - append
if ($curNode->length == 0) {
$domElemTo->appendChild($domDocTo->importNode($fromNode, true));
} else {
$curNode = $curNode->item(0);
// if found copy all attributes and check childnodes
$this->_copyAttributes($curNode, $fromNode);
if ($fromNode->childNodes->length) {
$this->_mergeNodes($curNode, $fromNode, $xPathTo, $domDocTo, $query);
}
}
}
}
} | php | protected function _mergeNodes($domElemTo, $domElemFrom, $xPathTo, $domDocTo, $queryStart)
{
foreach ($domElemFrom->childNodes as $fromNode) {
if ($fromNode->nodeType === XML_ELEMENT_NODE) {
$fromAttrName = $fromNode->getAttribute('id');
$fromNodeName = $fromNode->tagName;
// find current item
$query = "{$queryStart}/{$fromNodeName}[@id='{$fromAttrName}']";
$curNode = $xPathTo->query($query);
// if not found - append
if ($curNode->length == 0) {
$domElemTo->appendChild($domDocTo->importNode($fromNode, true));
} else {
$curNode = $curNode->item(0);
// if found copy all attributes and check childnodes
$this->_copyAttributes($curNode, $fromNode);
if ($fromNode->childNodes->length) {
$this->_mergeNodes($curNode, $fromNode, $xPathTo, $domDocTo, $query);
}
}
}
}
} | [
"protected",
"function",
"_mergeNodes",
"(",
"$",
"domElemTo",
",",
"$",
"domElemFrom",
",",
"$",
"xPathTo",
",",
"$",
"domDocTo",
",",
"$",
"queryStart",
")",
"{",
"foreach",
"(",
"$",
"domElemFrom",
"->",
"childNodes",
"as",
"$",
"fromNode",
")",
"{",
... | Merges nodes of newly added menu xml file
@param object $domElemTo merge target
@param object $domElemFrom merge source
@param object $xPathTo node path
@param object $domDocTo node to append child
@param string $queryStart node query | [
"Merges",
"nodes",
"of",
"newly",
"added",
"menu",
"xml",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L274-L300 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._merge | protected function _merge($domNew, $dom)
{
$xPath = new DOMXPath($dom);
$this->_mergeNodes($dom->documentElement, $domNew->documentElement, $xPath, $dom, '/OX');
} | php | protected function _merge($domNew, $dom)
{
$xPath = new DOMXPath($dom);
$this->_mergeNodes($dom->documentElement, $domNew->documentElement, $xPath, $dom, '/OX');
} | [
"protected",
"function",
"_merge",
"(",
"$",
"domNew",
",",
"$",
"dom",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"$",
"this",
"->",
"_mergeNodes",
"(",
"$",
"dom",
"->",
"documentElement",
",",
"$",
"domNew",
"->",
... | If oDomXML exist meges nodes
@param DomDocument $domNew what to merge
@param DomDocument $dom where to merge | [
"If",
"oDomXML",
"exist",
"meges",
"nodes"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L308-L312 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getActiveTab | public function getActiveTab($id, $act)
{
$nodeList = $this->getTabs($id, $act, false);
$act = ($act > $nodeList->length) ? ($nodeList->length - 1) : $act;
if ($nodeList->length && ($node = $nodeList->item($act))) {
return $node->getAttribute('cl');
}
} | php | public function getActiveTab($id, $act)
{
$nodeList = $this->getTabs($id, $act, false);
$act = ($act > $nodeList->length) ? ($nodeList->length - 1) : $act;
if ($nodeList->length && ($node = $nodeList->item($act))) {
return $node->getAttribute('cl');
}
} | [
"public",
"function",
"getActiveTab",
"(",
"$",
"id",
",",
"$",
"act",
")",
"{",
"$",
"nodeList",
"=",
"$",
"this",
"->",
"getTabs",
"(",
"$",
"id",
",",
"$",
"act",
",",
"false",
")",
";",
"$",
"act",
"=",
"(",
"$",
"act",
">",
"$",
"nodeList"... | Returns active TAB class name
@param string $id class name
@param int $act active tab number
@return string | [
"Returns",
"active",
"TAB",
"class",
"name"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L351-L358 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._getMenuFiles | protected function _getMenuFiles()
{
$editionPathSelector = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector()));
$fullAdminDir = $editionPathSelector->getViewsDirectory() . 'admin' . DIRECTORY_SEPARATOR;
$menuFile = $fullAdminDir . 'menu.xml';
// including std file
if (file_exists($menuFile)) {
$filesToLoad[] = $menuFile;
}
// including custom file
if (file_exists($fullAdminDir . 'user.xml')) {
$filesToLoad[] = $fullAdminDir . 'user.xml';
}
// including module menu files
$path = getShopBasePath();
$modulelist = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
$activeModuleInfo = $modulelist->getActiveModuleInfo();
if (is_array($activeModuleInfo)) {
foreach ($activeModuleInfo as $modulePath) {
$fullPath = $path . "modules/" . $modulePath;
// missing file/folder?
if (is_dir($fullPath)) {
// including menu file
$menuFile = $fullPath . "/menu.xml";
if (file_exists($menuFile) && is_readable($menuFile)) {
$filesToLoad[] = $menuFile;
}
}
}
}
return $filesToLoad;
} | php | protected function _getMenuFiles()
{
$editionPathSelector = new EditionPathProvider(new EditionRootPathProvider(new EditionSelector()));
$fullAdminDir = $editionPathSelector->getViewsDirectory() . 'admin' . DIRECTORY_SEPARATOR;
$menuFile = $fullAdminDir . 'menu.xml';
// including std file
if (file_exists($menuFile)) {
$filesToLoad[] = $menuFile;
}
// including custom file
if (file_exists($fullAdminDir . 'user.xml')) {
$filesToLoad[] = $fullAdminDir . 'user.xml';
}
// including module menu files
$path = getShopBasePath();
$modulelist = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
$activeModuleInfo = $modulelist->getActiveModuleInfo();
if (is_array($activeModuleInfo)) {
foreach ($activeModuleInfo as $modulePath) {
$fullPath = $path . "modules/" . $modulePath;
// missing file/folder?
if (is_dir($fullPath)) {
// including menu file
$menuFile = $fullPath . "/menu.xml";
if (file_exists($menuFile) && is_readable($menuFile)) {
$filesToLoad[] = $menuFile;
}
}
}
}
return $filesToLoad;
} | [
"protected",
"function",
"_getMenuFiles",
"(",
")",
"{",
"$",
"editionPathSelector",
"=",
"new",
"EditionPathProvider",
"(",
"new",
"EditionRootPathProvider",
"(",
"new",
"EditionSelector",
"(",
")",
")",
")",
";",
"$",
"fullAdminDir",
"=",
"$",
"editionPathSelect... | Returns array witn pathes + names ox manu xml files. Paths are checked
@return array | [
"Returns",
"array",
"witn",
"pathes",
"+",
"names",
"ox",
"manu",
"xml",
"files",
".",
"Paths",
"are",
"checked"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L388-L423 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._getInitialDom | protected function _getInitialDom()
{
if ($this->_oInitialDom === null) {
$myOxUtlis = \OxidEsales\Eshop\Core\Registry::getUtils();
if (is_array($filesToLoad = $this->_getMenuFiles())) {
// now checking if xml files are newer than cached file
$reload = false;
$templateLanguageCode = $this->getTemplateLanguageCode();
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveShop()->getShopId();
$cacheName = 'menu_' . $templateLanguageCode . $shopId . '_xml';
$cacheFile = $myOxUtlis->getCacheFilePath($cacheName);
$cacheContents = $myOxUtlis->fromFileCache($cacheName);
if ($cacheContents && file_exists($cacheFile) && ($cacheModTime = filemtime($cacheFile))) {
foreach ($filesToLoad as $dynPath) {
if ($cacheModTime < filemtime($dynPath)) {
$reload = true;
}
}
} else {
$reload = true;
}
$this->_oInitialDom = new DOMDocument();
if ($reload) {
// fully reloading and building pathes
$this->_oInitialDom->appendChild(new DOMElement('OX'));
foreach ($filesToLoad as $dynPath) {
$this->_loadFromFile($dynPath, $this->_oInitialDom);
}
// adds links to menu items
$this->_addLinks($this->_oInitialDom);
// writing to cache
$myOxUtlis->toFileCache($cacheName, $this->_oInitialDom->saveXML());
} else {
$cacheContents = $this->_processCachedFile($cacheContents);
// loading from cached file
$this->_oInitialDom->preserveWhiteSpace = false;
$this->_oInitialDom->loadXML($cacheContents);
}
// add session params
$this->_sessionizeLocalUrls($this->_oInitialDom);
}
}
return $this->_oInitialDom;
} | php | protected function _getInitialDom()
{
if ($this->_oInitialDom === null) {
$myOxUtlis = \OxidEsales\Eshop\Core\Registry::getUtils();
if (is_array($filesToLoad = $this->_getMenuFiles())) {
// now checking if xml files are newer than cached file
$reload = false;
$templateLanguageCode = $this->getTemplateLanguageCode();
$shopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveShop()->getShopId();
$cacheName = 'menu_' . $templateLanguageCode . $shopId . '_xml';
$cacheFile = $myOxUtlis->getCacheFilePath($cacheName);
$cacheContents = $myOxUtlis->fromFileCache($cacheName);
if ($cacheContents && file_exists($cacheFile) && ($cacheModTime = filemtime($cacheFile))) {
foreach ($filesToLoad as $dynPath) {
if ($cacheModTime < filemtime($dynPath)) {
$reload = true;
}
}
} else {
$reload = true;
}
$this->_oInitialDom = new DOMDocument();
if ($reload) {
// fully reloading and building pathes
$this->_oInitialDom->appendChild(new DOMElement('OX'));
foreach ($filesToLoad as $dynPath) {
$this->_loadFromFile($dynPath, $this->_oInitialDom);
}
// adds links to menu items
$this->_addLinks($this->_oInitialDom);
// writing to cache
$myOxUtlis->toFileCache($cacheName, $this->_oInitialDom->saveXML());
} else {
$cacheContents = $this->_processCachedFile($cacheContents);
// loading from cached file
$this->_oInitialDom->preserveWhiteSpace = false;
$this->_oInitialDom->loadXML($cacheContents);
}
// add session params
$this->_sessionizeLocalUrls($this->_oInitialDom);
}
}
return $this->_oInitialDom;
} | [
"protected",
"function",
"_getInitialDom",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oInitialDom",
"===",
"null",
")",
"{",
"$",
"myOxUtlis",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtils",
"(",
")",
";",
... | get initial dom, not modified by init method
@return DOMDocument | [
"get",
"initial",
"dom",
"not",
"modified",
"by",
"init",
"method"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L442-L493 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getListNodes | public function getListNodes($nodes)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='" . implode("' or @cl='", $nodes) . "']");
return ($nodeList->length) ? $nodeList : null;
} | php | public function getListNodes($nodes)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='" . implode("' or @cl='", $nodes) . "']");
return ($nodeList->length) ? $nodeList : null;
} | [
"public",
"function",
"getListNodes",
"(",
"$",
"nodes",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"this",
"->",
"getDomXml",
"(",
")",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"\"//SUBMENU[@cl='\"",
".",
"implo... | Returns DOMNodeList of given navigation classes
@param array $nodes Node array
@return DOMNodeList | [
"Returns",
"DOMNodeList",
"of",
"given",
"navigation",
"classes"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L531-L537 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.markNodeActive | public function markNodeActive($nodeId)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//*[@cl='{$nodeId}' or @list='{$nodeId}']");
if ($nodeList->length) {
foreach ($nodeList as $node) {
// special case for external resources
$node->setAttribute('active', 1);
$node->parentNode->setAttribute('active', 1);
}
}
} | php | public function markNodeActive($nodeId)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//*[@cl='{$nodeId}' or @list='{$nodeId}']");
if ($nodeList->length) {
foreach ($nodeList as $node) {
// special case for external resources
$node->setAttribute('active', 1);
$node->parentNode->setAttribute('active', 1);
}
}
} | [
"public",
"function",
"markNodeActive",
"(",
"$",
"nodeId",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"this",
"->",
"getDomXml",
"(",
")",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"\"//*[@cl='{$nodeId}' or @list='{$... | Marks passed node as active
@param string $nodeId node id | [
"Marks",
"passed",
"node",
"as",
"active"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L544-L556 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getListUrl | public function getListUrl($id)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='{$id}']");
if ($nodeList->length && ($node = $nodeList->item(0))) {
$cl = $node->getAttribute('list');
$cl = $cl ? "cl=$cl" : '';
$params = $node->getAttribute('listparam');
$params = $params ? "&$params" : '';
return "{$cl}{$params}";
}
} | php | public function getListUrl($id)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='{$id}']");
if ($nodeList->length && ($node = $nodeList->item(0))) {
$cl = $node->getAttribute('list');
$cl = $cl ? "cl=$cl" : '';
$params = $node->getAttribute('listparam');
$params = $params ? "&$params" : '';
return "{$cl}{$params}";
}
} | [
"public",
"function",
"getListUrl",
"(",
"$",
"id",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"this",
"->",
"getDomXml",
"(",
")",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"\"//SUBMENU[@cl='{$id}']\"",
")",
";",... | Formats and returns url for list area
@param string $id tab related class
@return string | [
"Formats",
"and",
"returns",
"url",
"for",
"list",
"area"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L565-L578 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getEditUrl | public function getEditUrl($id, $actTab)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='{$id}']/TAB");
$actTab = ($actTab > $nodeList->length) ? ($nodeList->length - 1) : $actTab;
if ($nodeList->length && ($actTab = $nodeList->item($actTab))) {
// special case for external resources
if ($actTab->getAttribute('external')) {
return $actTab->getAttribute('location');
}
$cl = $actTab->getAttribute('cl');
$cl = $cl ? "cl={$cl}" : '';
$params = $actTab->getAttribute('clparam');
$params = $params ? "&{$params}" : '';
return "{$cl}{$params}";
}
} | php | public function getEditUrl($id, $actTab)
{
$xPath = new DOMXPath($this->getDomXml());
$nodeList = $xPath->query("//SUBMENU[@cl='{$id}']/TAB");
$actTab = ($actTab > $nodeList->length) ? ($nodeList->length - 1) : $actTab;
if ($nodeList->length && ($actTab = $nodeList->item($actTab))) {
// special case for external resources
if ($actTab->getAttribute('external')) {
return $actTab->getAttribute('location');
}
$cl = $actTab->getAttribute('cl');
$cl = $cl ? "cl={$cl}" : '';
$params = $actTab->getAttribute('clparam');
$params = $params ? "&{$params}" : '';
return "{$cl}{$params}";
}
} | [
"public",
"function",
"getEditUrl",
"(",
"$",
"id",
",",
"$",
"actTab",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"this",
"->",
"getDomXml",
"(",
")",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"\"//SUBMENU[@cl=... | Formats and returns url for edit area
@param string $id tab related class
@param int $actTab active tab
@return string | [
"Formats",
"and",
"returns",
"url",
"for",
"edit",
"area"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L588-L607 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree._getAdminUrl | protected function _getAdminUrl()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (($adminSslUrl = $myConfig->getConfigParam('sAdminSSLURL'))) {
$url = trim($adminSslUrl, '/');
} else {
$url = trim($myConfig->getConfigParam('sShopURL'), '/') . '/admin';
}
return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl("{$url}/index.php", false);
} | php | protected function _getAdminUrl()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if (($adminSslUrl = $myConfig->getConfigParam('sAdminSSLURL'))) {
$url = trim($adminSslUrl, '/');
} else {
$url = trim($myConfig->getConfigParam('sShopURL'), '/') . '/admin';
}
return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl("{$url}/index.php", false);
} | [
"protected",
"function",
"_getAdminUrl",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"(",
"$",
"adminSslUrl",
"=",
"$",
"myConfig",
"->",
"getConfigP... | Admin url getter
@return string | [
"Admin",
"url",
"getter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L614-L625 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getClassId | public function getClassId($className)
{
$xPath = new DOMXPath($this->_getInitialDom());
$nodeList = $xPath->query("//*[@cl='{$className}' or @list='{$className}']");
if ($nodeList->length && ($firstItem = $nodeList->item(0))) {
return $firstItem->getAttribute('id');
}
} | php | public function getClassId($className)
{
$xPath = new DOMXPath($this->_getInitialDom());
$nodeList = $xPath->query("//*[@cl='{$className}' or @list='{$className}']");
if ($nodeList->length && ($firstItem = $nodeList->item(0))) {
return $firstItem->getAttribute('id');
}
} | [
"public",
"function",
"getClassId",
"(",
"$",
"className",
")",
"{",
"$",
"xPath",
"=",
"new",
"DOMXPath",
"(",
"$",
"this",
"->",
"_getInitialDom",
"(",
")",
")",
";",
"$",
"nodeList",
"=",
"$",
"xPath",
"->",
"query",
"(",
"\"//*[@cl='{$className}' or @l... | Returns id of class assigned to current node
@param string $className active class name
@return string | [
"Returns",
"id",
"of",
"class",
"assigned",
"to",
"current",
"node"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L658-L665 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/NavigationTree.php | NavigationTree.getTemplateLanguageCode | protected function getTemplateLanguageCode()
{
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$templateLanguageCode = $language->getLanguageArray()[$language->getTplLanguage()]->abbr;
return $templateLanguageCode;
} | php | protected function getTemplateLanguageCode()
{
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$templateLanguageCode = $language->getLanguageArray()[$language->getTplLanguage()]->abbr;
return $templateLanguageCode;
} | [
"protected",
"function",
"getTemplateLanguageCode",
"(",
")",
"{",
"$",
"language",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
")",
";",
"$",
"templateLanguageCode",
"=",
"$",
"language",
"->",
"getLanguageArr... | Get template language code
@return string | [
"Get",
"template",
"language",
"code"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/NavigationTree.php#L673-L679 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/WrappingController.php | WrappingController.getBasketItems | public function getBasketItems()
{
if ($this->_aBasketItemList === null) {
$this->_aBasketItemList = false;
// passing basket articles
if ($oBasket = $this->getSession()->getBasket()) {
$this->_aBasketItemList = $oBasket->getBasketArticles();
}
}
return $this->_aBasketItemList;
} | php | public function getBasketItems()
{
if ($this->_aBasketItemList === null) {
$this->_aBasketItemList = false;
// passing basket articles
if ($oBasket = $this->getSession()->getBasket()) {
$this->_aBasketItemList = $oBasket->getBasketArticles();
}
}
return $this->_aBasketItemList;
} | [
"public",
"function",
"getBasketItems",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aBasketItemList",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aBasketItemList",
"=",
"false",
";",
"// passing basket articles",
"if",
"(",
"$",
"oBasket",
"=",
"$",
"... | Returns array of shopping basket articles
@return array | [
"Returns",
"array",
"of",
"shopping",
"basket",
"articles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/WrappingController.php#L51-L63 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/WrappingController.php | WrappingController.getWrappingList | public function getWrappingList()
{
if ($this->_oWrappings === null) {
$this->_oWrappings = new \OxidEsales\Eshop\Core\Model\ListModel();
// load wrapping papers
if ($this->getViewConfig()->getShowGiftWrapping()) {
$this->_oWrappings = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class)->getWrappingList('WRAP');
}
}
return $this->_oWrappings;
} | php | public function getWrappingList()
{
if ($this->_oWrappings === null) {
$this->_oWrappings = new \OxidEsales\Eshop\Core\Model\ListModel();
// load wrapping papers
if ($this->getViewConfig()->getShowGiftWrapping()) {
$this->_oWrappings = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class)->getWrappingList('WRAP');
}
}
return $this->_oWrappings;
} | [
"public",
"function",
"getWrappingList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oWrappings",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oWrappings",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Model",
"\\",
"ListModel",... | Return basket wrappings list if available
@return oxlist | [
"Return",
"basket",
"wrappings",
"list",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/WrappingController.php#L70-L82 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/WrappingController.php | WrappingController.getCardList | public function getCardList()
{
if ($this->_oCards === null) {
$this->_oCards = new \OxidEsales\Eshop\Core\Model\ListModel();
// load gift cards
if ($this->getViewConfig()->getShowGiftWrapping()) {
$this->_oCards = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class)->getWrappingList('CARD');
}
}
return $this->_oCards;
} | php | public function getCardList()
{
if ($this->_oCards === null) {
$this->_oCards = new \OxidEsales\Eshop\Core\Model\ListModel();
// load gift cards
if ($this->getViewConfig()->getShowGiftWrapping()) {
$this->_oCards = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class)->getWrappingList('CARD');
}
}
return $this->_oCards;
} | [
"public",
"function",
"getCardList",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oCards",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_oCards",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Model",
"\\",
"ListModel",
"(",
")... | Returns greeting cards list if available
@return oxlist | [
"Returns",
"greeting",
"cards",
"list",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/WrappingController.php#L89-L101 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures.render | public function render()
{
parent::render();
$this->_aViewData["edit"] = $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$soxId = $this->getEditObjectId();
if (isset($soxId) && $soxId != "-1") {
// load object
$oArticle->load($soxId);
$oArticle = $this->updateArticle($oArticle);
// variant handling
if ($oArticle->oxarticles__oxparentid->value) {
$oParentArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oParentArticle->load($oArticle->oxarticles__oxparentid->value);
$this->_aViewData["parentarticle"] = $oParentArticle;
$this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value;
}
}
$this->_aViewData["iPicCount"] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iPicCount');
return "article_pictures.tpl";
} | php | public function render()
{
parent::render();
$this->_aViewData["edit"] = $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$soxId = $this->getEditObjectId();
if (isset($soxId) && $soxId != "-1") {
// load object
$oArticle->load($soxId);
$oArticle = $this->updateArticle($oArticle);
// variant handling
if ($oArticle->oxarticles__oxparentid->value) {
$oParentArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oParentArticle->load($oArticle->oxarticles__oxparentid->value);
$this->_aViewData["parentarticle"] = $oParentArticle;
$this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value;
}
}
$this->_aViewData["iPicCount"] = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iPicCount');
return "article_pictures.tpl";
} | [
"public",
"function",
"render",
"(",
")",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"$",
"this",
"->",
"_aViewData",
"[",
"\"edit\"",
"]",
"=",
"$",
"oArticle",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model... | Loads article information - pictures, passes data to Smarty
engine, returns name of template file "article_pictures.tpl".
@return string | [
"Loads",
"article",
"information",
"-",
"pictures",
"passes",
"data",
"to",
"Smarty",
"engine",
"returns",
"name",
"of",
"template",
"file",
"article_pictures",
".",
"tpl",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L26-L50 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures.deletePicture | public function deletePicture()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($myConfig->isDemoShop()) {
// disabling uploading pictures if this is demo shop
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('ARTICLE_PICTURES_UPLOADISDISABLED');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
return;
}
$sOxId = $this->getEditObjectId();
$iIndex = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("masterPicIndex");
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sOxId);
if ($iIndex == "ICO") {
// deleting main icon
$this->_deleteMainIcon($oArticle);
} elseif ($iIndex == "TH") {
// deleting thumbnail
$this->_deleteThumbnail($oArticle);
} else {
$iIndex = (int) $iIndex;
if ($iIndex > 0) {
// deleting master picture
$this->_resetMasterPicture($oArticle, $iIndex, true);
}
}
$oArticle->save();
} | php | public function deletePicture()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
if ($myConfig->isDemoShop()) {
// disabling uploading pictures if this is demo shop
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('ARTICLE_PICTURES_UPLOADISDISABLED');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
return;
}
$sOxId = $this->getEditObjectId();
$iIndex = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("masterPicIndex");
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sOxId);
if ($iIndex == "ICO") {
// deleting main icon
$this->_deleteMainIcon($oArticle);
} elseif ($iIndex == "TH") {
// deleting thumbnail
$this->_deleteThumbnail($oArticle);
} else {
$iIndex = (int) $iIndex;
if ($iIndex > 0) {
// deleting master picture
$this->_resetMasterPicture($oArticle, $iIndex, true);
}
}
$oArticle->save();
} | [
"public",
"function",
"deletePicture",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"myConfig",
"->",
"isDemoShop",
"(",
")",
")",
"{",
"// dis... | Deletes selected master picture and all other master pictures
where master picture index is higher than currently deleted index.
Also deletes custom icon and thumbnail.
@return null | [
"Deletes",
"selected",
"master",
"picture",
"and",
"all",
"other",
"master",
"pictures",
"where",
"master",
"picture",
"index",
"is",
"higher",
"than",
"currently",
"deleted",
"index",
".",
"Also",
"deletes",
"custom",
"icon",
"and",
"thumbnail",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L95-L129 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures._resetMasterPicture | protected function _resetMasterPicture($oArticle, $iIndex, $blDeleteMaster = false)
{
if ($this->canResetMasterPicture($oArticle, $iIndex)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteArticleMasterPicture($oArticle, $iIndex, $blDeleteMaster);
}
if ($blDeleteMaster) {
//reseting master picture field
$oArticle->{"oxarticles__oxpic" . $iIndex} = new \OxidEsales\Eshop\Core\Field();
}
// cleaning oxzoom fields
if (isset($oArticle->{"oxarticles__oxzoom" . $iIndex})) {
$oArticle->{"oxarticles__oxzoom" . $iIndex} = new \OxidEsales\Eshop\Core\Field();
}
if ($iIndex == 1) {
$this->_cleanupCustomFields($oArticle);
}
}
} | php | protected function _resetMasterPicture($oArticle, $iIndex, $blDeleteMaster = false)
{
if ($this->canResetMasterPicture($oArticle, $iIndex)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteArticleMasterPicture($oArticle, $iIndex, $blDeleteMaster);
}
if ($blDeleteMaster) {
//reseting master picture field
$oArticle->{"oxarticles__oxpic" . $iIndex} = new \OxidEsales\Eshop\Core\Field();
}
// cleaning oxzoom fields
if (isset($oArticle->{"oxarticles__oxzoom" . $iIndex})) {
$oArticle->{"oxarticles__oxzoom" . $iIndex} = new \OxidEsales\Eshop\Core\Field();
}
if ($iIndex == 1) {
$this->_cleanupCustomFields($oArticle);
}
}
} | [
"protected",
"function",
"_resetMasterPicture",
"(",
"$",
"oArticle",
",",
"$",
"iIndex",
",",
"$",
"blDeleteMaster",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canResetMasterPicture",
"(",
"$",
"oArticle",
",",
"$",
"iIndex",
")",
")",
"{",
... | Deletes selected master picture and all pictures generated
from master picture
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object
@param int $iIndex master picture index
@param bool $blDeleteMaster if TRUE - deletes and unsets master image file | [
"Deletes",
"selected",
"master",
"picture",
"and",
"all",
"pictures",
"generated",
"from",
"master",
"picture"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L139-L161 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures._deleteMainIcon | protected function _deleteMainIcon($oArticle)
{
if ($this->canDeleteMainIcon($oArticle)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteMainIcon($oArticle);
}
//reseting field
$oArticle->oxarticles__oxicon = new \OxidEsales\Eshop\Core\Field();
}
} | php | protected function _deleteMainIcon($oArticle)
{
if ($this->canDeleteMainIcon($oArticle)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteMainIcon($oArticle);
}
//reseting field
$oArticle->oxarticles__oxicon = new \OxidEsales\Eshop\Core\Field();
}
} | [
"protected",
"function",
"_deleteMainIcon",
"(",
"$",
"oArticle",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canDeleteMainIcon",
"(",
"$",
"oArticle",
")",
")",
"{",
"if",
"(",
"!",
"$",
"oArticle",
"->",
"isDerived",
"(",
")",
")",
"{",
"$",
"oPicHandle... | Deletes main icon file
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object | [
"Deletes",
"main",
"icon",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L168-L179 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures._deleteThumbnail | protected function _deleteThumbnail($oArticle)
{
if ($this->canDeleteThumbnail($oArticle)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteThumbnail($oArticle);
}
//reseting field
$oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
}
} | php | protected function _deleteThumbnail($oArticle)
{
if ($this->canDeleteThumbnail($oArticle)) {
if (!$oArticle->isDerived()) {
$oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
$oPicHandler->deleteThumbnail($oArticle);
}
//reseting field
$oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
}
} | [
"protected",
"function",
"_deleteThumbnail",
"(",
"$",
"oArticle",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canDeleteThumbnail",
"(",
"$",
"oArticle",
")",
")",
"{",
"if",
"(",
"!",
"$",
"oArticle",
"->",
"isDerived",
"(",
")",
")",
"{",
"$",
"oPicHand... | Deletes thumbnail file
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object | [
"Deletes",
"thumbnail",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L186-L197 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticlePictures.php | ArticlePictures._cleanupCustomFields | protected function _cleanupCustomFields($oArticle)
{
$sIcon = $oArticle->oxarticles__oxicon->value;
$sThumb = $oArticle->oxarticles__oxthumb->value;
if ($sIcon == "nopic.jpg") {
$oArticle->oxarticles__oxicon = new \OxidEsales\Eshop\Core\Field();
}
if ($sThumb == "nopic.jpg") {
$oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
}
} | php | protected function _cleanupCustomFields($oArticle)
{
$sIcon = $oArticle->oxarticles__oxicon->value;
$sThumb = $oArticle->oxarticles__oxthumb->value;
if ($sIcon == "nopic.jpg") {
$oArticle->oxarticles__oxicon = new \OxidEsales\Eshop\Core\Field();
}
if ($sThumb == "nopic.jpg") {
$oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
}
} | [
"protected",
"function",
"_cleanupCustomFields",
"(",
"$",
"oArticle",
")",
"{",
"$",
"sIcon",
"=",
"$",
"oArticle",
"->",
"oxarticles__oxicon",
"->",
"value",
";",
"$",
"sThumb",
"=",
"$",
"oArticle",
"->",
"oxarticles__oxthumb",
"->",
"value",
";",
"if",
"... | Cleans up article custom fields oxicon and oxthumb. If there is custom
icon or thumb picture, leaves records untouched.
@param \OxidEsales\Eshop\Application\Model\Article $oArticle article object | [
"Cleans",
"up",
"article",
"custom",
"fields",
"oxicon",
"and",
"oxthumb",
".",
"If",
"there",
"is",
"custom",
"icon",
"or",
"thumb",
"picture",
"leaves",
"records",
"untouched",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticlePictures.php#L205-L217 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket._insert | protected function _insert()
{
// marking basket as not new any more
$this->_blNewBasket = false;
if (!isset($this->oxuserbaskets__oxpublic->value)) {
$this->oxuserbaskets__oxpublic = new \OxidEsales\Eshop\Core\Field(1, \OxidEsales\Eshop\Core\Field::T_RAW);
}
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$this->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
return parent::_insert();
} | php | protected function _insert()
{
// marking basket as not new any more
$this->_blNewBasket = false;
if (!isset($this->oxuserbaskets__oxpublic->value)) {
$this->oxuserbaskets__oxpublic = new \OxidEsales\Eshop\Core\Field(1, \OxidEsales\Eshop\Core\Field::T_RAW);
}
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$this->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
return parent::_insert();
} | [
"protected",
"function",
"_insert",
"(",
")",
"{",
"// marking basket as not new any more",
"$",
"this",
"->",
"_blNewBasket",
"=",
"false",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"oxuserbaskets__oxpublic",
"->",
"value",
")",
")",
"{",
"$",
"... | Inserts object data to DB, returns true on success.
@return mixed | [
"Inserts",
"object",
"data",
"to",
"DB",
"returns",
"true",
"on",
"success",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L65-L78 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket.setIsNewBasket | public function setIsNewBasket()
{
$this->_blNewBasket = true;
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$this->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
} | php | public function setIsNewBasket()
{
$this->_blNewBasket = true;
$iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
$this->oxuserbaskets__oxupdate = new \OxidEsales\Eshop\Core\Field($iTime);
} | [
"public",
"function",
"setIsNewBasket",
"(",
")",
"{",
"$",
"this",
"->",
"_blNewBasket",
"=",
"true",
";",
"$",
"iTime",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsDate",
"(",
")",
"->",
"getTime",
"(",
")",
... | Sets basket as newly created. This usually means that it is not
yet stored in DB and will only be stored if some item is added | [
"Sets",
"basket",
"as",
"newly",
"created",
".",
"This",
"usually",
"means",
"that",
"it",
"is",
"not",
"yet",
"stored",
"in",
"DB",
"and",
"will",
"only",
"be",
"stored",
"if",
"some",
"item",
"is",
"added"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L84-L89 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket.getArticles | public function getArticles()
{
$aRes = [];
$aItems = $this->getItems();
if (is_array($aItems)) {
foreach ($aItems as $sId => $oItem) {
$oArticle = $oItem->getArticle($sId);
$aRes[$this->_getItemKey($oArticle->getId(), $oItem->getSelList(), $oItem->getPersParams())] = $oArticle;
}
}
return $aRes;
} | php | public function getArticles()
{
$aRes = [];
$aItems = $this->getItems();
if (is_array($aItems)) {
foreach ($aItems as $sId => $oItem) {
$oArticle = $oItem->getArticle($sId);
$aRes[$this->_getItemKey($oArticle->getId(), $oItem->getSelList(), $oItem->getPersParams())] = $oArticle;
}
}
return $aRes;
} | [
"public",
"function",
"getArticles",
"(",
")",
"{",
"$",
"aRes",
"=",
"[",
"]",
";",
"$",
"aItems",
"=",
"$",
"this",
"->",
"getItems",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"aItems",
")",
")",
"{",
"foreach",
"(",
"$",
"aItems",
"as",
... | Returns an array of articles belonging to the Items in the basket
@return array of oxArticle | [
"Returns",
"an",
"array",
"of",
"articles",
"belonging",
"to",
"the",
"Items",
"in",
"the",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L120-L132 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket.getItems | public function getItems($blReload = false, $blActiveCheck = true)
{
// cached ?
if ($this->_aBasketItems !== null && !$blReload) {
return $this->_aBasketItems;
}
// initializing
$this->_aBasketItems = [];
// loading basket items
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$sViewName = $oArticle->getViewName();
$sSelect = "select oxuserbasketitems.* from oxuserbasketitems left join $sViewName on oxuserbasketitems.oxartid = $sViewName.oxid ";
if ($blActiveCheck) {
$sSelect .= 'and ' . $oArticle->getSqlActiveSnippet() . ' ';
}
$sSelect .= "where oxuserbasketitems.oxbasketid = '" . $this->getId() . "' and $sViewName.oxid is not null ";
$sSelect .= " order by oxartnum, oxsellist, oxpersparam ";
$oItems = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oItems->init('oxuserbasketitem');
$oItems->selectstring($sSelect);
foreach ($oItems as $oItem) {
$sKey = $this->_getItemKey($oItem->oxuserbasketitems__oxartid->value, $oItem->getSelList(), $oItem->getPersParams());
$this->_aBasketItems[$sKey] = $oItem;
}
return $this->_aBasketItems;
} | php | public function getItems($blReload = false, $blActiveCheck = true)
{
// cached ?
if ($this->_aBasketItems !== null && !$blReload) {
return $this->_aBasketItems;
}
// initializing
$this->_aBasketItems = [];
// loading basket items
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$sViewName = $oArticle->getViewName();
$sSelect = "select oxuserbasketitems.* from oxuserbasketitems left join $sViewName on oxuserbasketitems.oxartid = $sViewName.oxid ";
if ($blActiveCheck) {
$sSelect .= 'and ' . $oArticle->getSqlActiveSnippet() . ' ';
}
$sSelect .= "where oxuserbasketitems.oxbasketid = '" . $this->getId() . "' and $sViewName.oxid is not null ";
$sSelect .= " order by oxartnum, oxsellist, oxpersparam ";
$oItems = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oItems->init('oxuserbasketitem');
$oItems->selectstring($sSelect);
foreach ($oItems as $oItem) {
$sKey = $this->_getItemKey($oItem->oxuserbasketitems__oxartid->value, $oItem->getSelList(), $oItem->getPersParams());
$this->_aBasketItems[$sKey] = $oItem;
}
return $this->_aBasketItems;
} | [
"public",
"function",
"getItems",
"(",
"$",
"blReload",
"=",
"false",
",",
"$",
"blActiveCheck",
"=",
"true",
")",
"{",
"// cached ?",
"if",
"(",
"$",
"this",
"->",
"_aBasketItems",
"!==",
"null",
"&&",
"!",
"$",
"blReload",
")",
"{",
"return",
"$",
"t... | Returns list of basket items
@param bool $blReload if TRUE forces to reload list
@param bool $blActiveCheck should articles be checked for active state?
@return array of oxUserBasketItems | [
"Returns",
"list",
"of",
"basket",
"items"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L142-L174 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket._createItem | protected function _createItem($sProductId, $aSelList = null, $aPersParams = null)
{
$oNewItem = oxNew(\OxidEsales\Eshop\Application\Model\UserBasketItem::class);
$oNewItem->oxuserbasketitems__oxartid = new \OxidEsales\Eshop\Core\Field($sProductId, \OxidEsales\Eshop\Core\Field::T_RAW);
$oNewItem->oxuserbasketitems__oxbasketid = new \OxidEsales\Eshop\Core\Field($this->getId(), \OxidEsales\Eshop\Core\Field::T_RAW);
if ($aPersParams && count($aPersParams)) {
$oNewItem->setPersParams($aPersParams);
}
if (!$aSelList) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sProductId);
$aSelectLists = $oArticle->getSelectLists();
if (($iSelCnt = count($aSelectLists))) {
$aSelList = array_fill(0, $iSelCnt, '0');
}
}
$oNewItem->setSelList($aSelList);
return $oNewItem;
} | php | protected function _createItem($sProductId, $aSelList = null, $aPersParams = null)
{
$oNewItem = oxNew(\OxidEsales\Eshop\Application\Model\UserBasketItem::class);
$oNewItem->oxuserbasketitems__oxartid = new \OxidEsales\Eshop\Core\Field($sProductId, \OxidEsales\Eshop\Core\Field::T_RAW);
$oNewItem->oxuserbasketitems__oxbasketid = new \OxidEsales\Eshop\Core\Field($this->getId(), \OxidEsales\Eshop\Core\Field::T_RAW);
if ($aPersParams && count($aPersParams)) {
$oNewItem->setPersParams($aPersParams);
}
if (!$aSelList) {
$oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oArticle->load($sProductId);
$aSelectLists = $oArticle->getSelectLists();
if (($iSelCnt = count($aSelectLists))) {
$aSelList = array_fill(0, $iSelCnt, '0');
}
}
$oNewItem->setSelList($aSelList);
return $oNewItem;
} | [
"protected",
"function",
"_createItem",
"(",
"$",
"sProductId",
",",
"$",
"aSelList",
"=",
"null",
",",
"$",
"aPersParams",
"=",
"null",
")",
"{",
"$",
"oNewItem",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
... | Creates and returns oxuserbasketitem object
@param string $sProductId Product Id
@param array $aSelList product select lists
@param string $aPersParams persistent parameters
@return oxUserBasketItem | [
"Creates",
"and",
"returns",
"oxuserbasketitem",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L185-L206 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket.getItem | public function getItem($sProductId, $aSelList, $aPersParams = null)
{
// loading basket item list
$aItems = $this->getItems();
$sItemKey = $this->_getItemKey($sProductId, $aSelList, $aPersParams);
$oItem = null;
// returning existing item
if (isset($aItems[$sProductId])) {
$oItem = $aItems[$sProductId];
} elseif (isset($aItems[$sItemKey])) {
$oItem = $aItems[$sItemKey];
} else {
$oItem = $this->_createItem($sProductId, $aSelList, $aPersParams);
}
return $oItem;
} | php | public function getItem($sProductId, $aSelList, $aPersParams = null)
{
// loading basket item list
$aItems = $this->getItems();
$sItemKey = $this->_getItemKey($sProductId, $aSelList, $aPersParams);
$oItem = null;
// returning existing item
if (isset($aItems[$sProductId])) {
$oItem = $aItems[$sProductId];
} elseif (isset($aItems[$sItemKey])) {
$oItem = $aItems[$sItemKey];
} else {
$oItem = $this->_createItem($sProductId, $aSelList, $aPersParams);
}
return $oItem;
} | [
"public",
"function",
"getItem",
"(",
"$",
"sProductId",
",",
"$",
"aSelList",
",",
"$",
"aPersParams",
"=",
"null",
")",
"{",
"// loading basket item list",
"$",
"aItems",
"=",
"$",
"this",
"->",
"getItems",
"(",
")",
";",
"$",
"sItemKey",
"=",
"$",
"th... | Searches for item in basket items array and returns it. If not item was
found - new item is created.
@param string $sProductId product id, basket item id or basket item index
@param array $aSelList select lists
@param string $aPersParams persistent parameters
@return oxUserBasketItem | [
"Searches",
"for",
"item",
"in",
"basket",
"items",
"array",
"and",
"returns",
"it",
".",
"If",
"not",
"item",
"was",
"found",
"-",
"new",
"item",
"is",
"created",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L219-L235 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket._getItemKey | protected function _getItemKey($sProductId, $aSel = null, $aPersParam = null)
{
$aSel = ($aSel != null) ? $aSel : [0 => '0'];
return md5($sProductId . '|' . serialize($aSel) . '|' . serialize($aPersParam));
} | php | protected function _getItemKey($sProductId, $aSel = null, $aPersParam = null)
{
$aSel = ($aSel != null) ? $aSel : [0 => '0'];
return md5($sProductId . '|' . serialize($aSel) . '|' . serialize($aPersParam));
} | [
"protected",
"function",
"_getItemKey",
"(",
"$",
"sProductId",
",",
"$",
"aSel",
"=",
"null",
",",
"$",
"aPersParam",
"=",
"null",
")",
"{",
"$",
"aSel",
"=",
"(",
"$",
"aSel",
"!=",
"null",
")",
"?",
"$",
"aSel",
":",
"[",
"0",
"=>",
"'0'",
"]"... | Returns unique item key according to its ID and user chosen select
@param string $sProductId Product Id
@param array $aSel product select lists
@param array $aPersParam basket item persistent parameters
@return string | [
"Returns",
"unique",
"item",
"key",
"according",
"to",
"its",
"ID",
"and",
"user",
"chosen",
"select"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L246-L251 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/UserBasket.php | UserBasket.delete | public function delete($sOXID = null)
{
if (!$sOXID) {
$sOXID = $this->getId();
}
$blDelete = false;
if ($sOXID && ($blDelete = parent::delete($sOXID))) {
// cleaning up related data
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "delete from oxuserbasketitems where oxbasketid = " . $oDb->quote($sOXID);
$oDb->execute($sQ);
$this->_aBasketItems = null;
}
return $blDelete;
} | php | public function delete($sOXID = null)
{
if (!$sOXID) {
$sOXID = $this->getId();
}
$blDelete = false;
if ($sOXID && ($blDelete = parent::delete($sOXID))) {
// cleaning up related data
$oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$sQ = "delete from oxuserbasketitems where oxbasketid = " . $oDb->quote($sOXID);
$oDb->execute($sQ);
$this->_aBasketItems = null;
}
return $blDelete;
} | [
"public",
"function",
"delete",
"(",
"$",
"sOXID",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"sOXID",
")",
"{",
"$",
"sOXID",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"}",
"$",
"blDelete",
"=",
"false",
";",
"if",
"(",
"$",
"sOXID",
... | Deletes current basket history
@param string $sOXID Object ID(default null)
@return bool | [
"Deletes",
"current",
"basket",
"history"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/UserBasket.php#L318-L334 | train |
OXID-eSales/oxideshop_ce | source/Internal/Review/Bridge/UserReviewBridge.php | UserReviewBridge.deleteReview | public function deleteReview($userId, $reviewId)
{
$review = $this->getReviewById($reviewId);
$this->validateUserPermissionsToManageReview($review, $userId);
$review->delete();
} | php | public function deleteReview($userId, $reviewId)
{
$review = $this->getReviewById($reviewId);
$this->validateUserPermissionsToManageReview($review, $userId);
$review->delete();
} | [
"public",
"function",
"deleteReview",
"(",
"$",
"userId",
",",
"$",
"reviewId",
")",
"{",
"$",
"review",
"=",
"$",
"this",
"->",
"getReviewById",
"(",
"$",
"reviewId",
")",
";",
"$",
"this",
"->",
"validateUserPermissionsToManageReview",
"(",
"$",
"review",
... | Delete a Review.
@param string $userId
@param string $reviewId
@throws ReviewPermissionException | [
"Delete",
"a",
"Review",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Internal/Review/Bridge/UserReviewBridge.php#L43-L50 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/ForgotPasswordController.php | ForgotPasswordController.updatePassword | public function updatePassword()
{
$sNewPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('password_new', true);
$sConfPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('password_new_confirm', true);
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
/** @var \OxidEsales\Eshop\Core\InputValidator $oInputValidator */
$oInputValidator = \OxidEsales\Eshop\Core\Registry::getInputValidator();
if (($oExcp = $oInputValidator->checkPassword($oUser, $sNewPass, $sConfPass, true))) {
return \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oExcp->getMessage(), false, true);
}
// passwords are fine - updating and loggin user in
if ($oUser->loadUserByUpdateId($this->getUpdateId())) {
// setting new pass ..
$oUser->setPassword($sNewPass);
// resetting update pass params
$oUser->setUpdateKey(true);
// saving ..
$oUser->save();
// forcing user login
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('usr', $oUser->getId());
return 'forgotpwd?success=1';
} else {
// expired reminder
$oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_PASSWORD_LINK_EXPIRED', false, true);
}
} | php | public function updatePassword()
{
$sNewPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('password_new', true);
$sConfPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('password_new_confirm', true);
$oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
/** @var \OxidEsales\Eshop\Core\InputValidator $oInputValidator */
$oInputValidator = \OxidEsales\Eshop\Core\Registry::getInputValidator();
if (($oExcp = $oInputValidator->checkPassword($oUser, $sNewPass, $sConfPass, true))) {
return \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oExcp->getMessage(), false, true);
}
// passwords are fine - updating and loggin user in
if ($oUser->loadUserByUpdateId($this->getUpdateId())) {
// setting new pass ..
$oUser->setPassword($sNewPass);
// resetting update pass params
$oUser->setUpdateKey(true);
// saving ..
$oUser->save();
// forcing user login
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('usr', $oUser->getId());
return 'forgotpwd?success=1';
} else {
// expired reminder
$oUtilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView();
return $oUtilsView->addErrorToDisplay('ERROR_MESSAGE_PASSWORD_LINK_EXPIRED', false, true);
}
} | [
"public",
"function",
"updatePassword",
"(",
")",
"{",
"$",
"sNewPass",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'password_new'",
",",
"true",
")",
";",
"$",
"sC... | Checks if password is fine and updates old one with new
password. On success user is redirected to success page
@return string | [
"Checks",
"if",
"password",
"is",
"fine",
"and",
"updates",
"old",
"one",
"with",
"new",
"password",
".",
"On",
"success",
"user",
"is",
"redirected",
"to",
"success",
"page"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ForgotPasswordController.php#L86-L120 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/ForgotPasswordController.php | ForgotPasswordController.isExpiredLink | public function isExpiredLink()
{
if (($sKey = $this->getUpdateId())) {
$blExpired = oxNew(\OxidEsales\Eshop\Application\Model\User::class)->isExpiredUpdateId($sKey);
}
return $blExpired;
} | php | public function isExpiredLink()
{
if (($sKey = $this->getUpdateId())) {
$blExpired = oxNew(\OxidEsales\Eshop\Application\Model\User::class)->isExpiredUpdateId($sKey);
}
return $blExpired;
} | [
"public",
"function",
"isExpiredLink",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"sKey",
"=",
"$",
"this",
"->",
"getUpdateId",
"(",
")",
")",
")",
"{",
"$",
"blExpired",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Mod... | Returns password update link expiration status
@return bool | [
"Returns",
"password",
"update",
"link",
"expiration",
"status"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ForgotPasswordController.php#L157-L164 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/ForgotPasswordController.php | ForgotPasswordController.getTitle | public function getTitle()
{
$sTitle = 'FORGOT_PASSWORD';
if ($this->showUpdateScreen()) {
$sTitle = 'NEW_PASSWORD';
} elseif ($this->updateSuccess()) {
$sTitle = 'CHANGE_PASSWORD';
}
return \OxidEsales\Eshop\Core\Registry::getLang()->translateString($sTitle, \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage(), false);
} | php | public function getTitle()
{
$sTitle = 'FORGOT_PASSWORD';
if ($this->showUpdateScreen()) {
$sTitle = 'NEW_PASSWORD';
} elseif ($this->updateSuccess()) {
$sTitle = 'CHANGE_PASSWORD';
}
return \OxidEsales\Eshop\Core\Registry::getLang()->translateString($sTitle, \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage(), false);
} | [
"public",
"function",
"getTitle",
"(",
")",
"{",
"$",
"sTitle",
"=",
"'FORGOT_PASSWORD'",
";",
"if",
"(",
"$",
"this",
"->",
"showUpdateScreen",
"(",
")",
")",
"{",
"$",
"sTitle",
"=",
"'NEW_PASSWORD'",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"upda... | Get password reminder page title
@return string | [
"Get",
"password",
"reminder",
"page",
"title"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/ForgotPasswordController.php#L199-L210 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopMain.php | ShopMain.save | public function save()
{
parent::save();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$shopId = $this->getEditObjectId();
$parameters = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$user = $this->getUser();
$shopId = $this->updateShopIdByUser($user, $shopId, false);
// #918 S
// checkbox handling
$parameters['oxshops__oxactive'] = (isset($parameters['oxshops__oxactive']) && $parameters['oxshops__oxactive'] == true) ? 1 : 0;
$parameters['oxshops__oxproductive'] = (isset($parameters['oxshops__oxproductive']) && $parameters['oxshops__oxproductive'] == true) ? 1 : 0;
$subjLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("subjlang");
$shopLanguageId = ($subjLang && $subjLang > 0) ? $subjLang : 0;
$shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
if ($shopId != self::NEW_SHOP_ID) {
$shop->loadInLang($shopLanguageId, $shopId);
} else {
$parameters = $this->updateParameters($parameters);
}
if ($parameters['oxshops__oxsmtp']) {
$parameters['oxshops__oxsmtp'] = trim($parameters['oxshops__oxsmtp']);
}
$shop->setLanguage(0);
$shop->assign($parameters);
$shop->setLanguage($shopLanguageId);
if (($newSMPTPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("oxsmtppwd"))) {
$shop->oxshops__oxsmtppwd->setValue($newSMPTPass == '-' ? "" : $newSMPTPass);
}
$canCreateShop = $this->canCreateShop($shopId, $shop, $config);
if (!$canCreateShop) {
return;
}
try {
$shop->save();
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $e) {
$this->checkExceptionType($e);
return;
}
$this->_aViewData["updatelist"] = "1";
$this->updateShopInformation($config, $shop, $shopId);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("actshop", $shopId);
} | php | public function save()
{
parent::save();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$shopId = $this->getEditObjectId();
$parameters = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$user = $this->getUser();
$shopId = $this->updateShopIdByUser($user, $shopId, false);
// #918 S
// checkbox handling
$parameters['oxshops__oxactive'] = (isset($parameters['oxshops__oxactive']) && $parameters['oxshops__oxactive'] == true) ? 1 : 0;
$parameters['oxshops__oxproductive'] = (isset($parameters['oxshops__oxproductive']) && $parameters['oxshops__oxproductive'] == true) ? 1 : 0;
$subjLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("subjlang");
$shopLanguageId = ($subjLang && $subjLang > 0) ? $subjLang : 0;
$shop = oxNew(\OxidEsales\Eshop\Application\Model\Shop::class);
if ($shopId != self::NEW_SHOP_ID) {
$shop->loadInLang($shopLanguageId, $shopId);
} else {
$parameters = $this->updateParameters($parameters);
}
if ($parameters['oxshops__oxsmtp']) {
$parameters['oxshops__oxsmtp'] = trim($parameters['oxshops__oxsmtp']);
}
$shop->setLanguage(0);
$shop->assign($parameters);
$shop->setLanguage($shopLanguageId);
if (($newSMPTPass = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("oxsmtppwd"))) {
$shop->oxshops__oxsmtppwd->setValue($newSMPTPass == '-' ? "" : $newSMPTPass);
}
$canCreateShop = $this->canCreateShop($shopId, $shop, $config);
if (!$canCreateShop) {
return;
}
try {
$shop->save();
} catch (\OxidEsales\Eshop\Core\Exception\StandardException $e) {
$this->checkExceptionType($e);
return;
}
$this->_aViewData["updatelist"] = "1";
$this->updateShopInformation($config, $shop, $shopId);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("actshop", $shopId);
} | [
"public",
"function",
"save",
"(",
")",
"{",
"parent",
"::",
"save",
"(",
")",
";",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"shopId",
"=",
"$",
"this",
"->",
"get... | Saves changed main shop configuration parameters.
@return null | [
"Saves",
"changed",
"main",
"shop",
"configuration",
"parameters",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopMain.php#L87-L143 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopMain.php | ShopMain._getNonCopyConfigVars | protected function _getNonCopyConfigVars()
{
$nonCopyVars = ["aSerials", "IMS", "IMD", "IMA", "sBackTag", "sUtilModule", "aModulePaths", "aModuleFiles", "aModuleEvents", "aModuleVersions", "aModuleTemplates", "aModules", "aDisabledModules"];
//adding non copable multishop field options
$multiShopTables = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aMultiShopTables');
foreach ($multiShopTables as $multishopTable) {
$nonCopyVars[] = 'blMallInherit_' . strtolower($multishopTable);
}
return $nonCopyVars;
} | php | protected function _getNonCopyConfigVars()
{
$nonCopyVars = ["aSerials", "IMS", "IMD", "IMA", "sBackTag", "sUtilModule", "aModulePaths", "aModuleFiles", "aModuleEvents", "aModuleVersions", "aModuleTemplates", "aModules", "aDisabledModules"];
//adding non copable multishop field options
$multiShopTables = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aMultiShopTables');
foreach ($multiShopTables as $multishopTable) {
$nonCopyVars[] = 'blMallInherit_' . strtolower($multishopTable);
}
return $nonCopyVars;
} | [
"protected",
"function",
"_getNonCopyConfigVars",
"(",
")",
"{",
"$",
"nonCopyVars",
"=",
"[",
"\"aSerials\"",
",",
"\"IMS\"",
",",
"\"IMD\"",
",",
"\"IMA\"",
",",
"\"sBackTag\"",
",",
"\"sUtilModule\"",
",",
"\"aModulePaths\"",
",",
"\"aModuleFiles\"",
",",
"\"aM... | Returns array of config variables which cannot be copied
@return array | [
"Returns",
"array",
"of",
"config",
"variables",
"which",
"cannot",
"be",
"copied"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopMain.php#L150-L160 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ShopMain.php | ShopMain._copyConfigVars | protected function _copyConfigVars($shop)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$utilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject();
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$nonCopyVars = $this->_getNonCopyConfigVars();
$selectShopConfigurationQuery =
"select oxvarname, oxvartype,
DECODE( oxvarvalue, " . $db->quote($config->getConfigParam('sConfigKey')) . ") as oxvarvalue, oxmodule
from oxconfig where oxshopid = '1'";
$shopConfiguration = $db->select($selectShopConfigurationQuery);
if ($shopConfiguration != false && $shopConfiguration->count() > 0) {
while (!$shopConfiguration->EOF) {
$configName = $shopConfiguration->fields[0];
if (!in_array($configName, $nonCopyVars)) {
$newId = $utilsObject->generateUID();
$insertNewConfigQuery =
"insert into oxconfig
(oxid, oxshopid, oxvarname, oxvartype, oxvarvalue, oxmodule) values ( '$newId', " . $db->quote($shop->getId())
. ", " . $db->quote($shopConfiguration->fields[0])
. ", " . $db->quote($shopConfiguration->fields[1])
. ", ENCODE( " . $db->quote($shopConfiguration->fields[2])
. ", '" . $config->getConfigParam('sConfigKey')
. "')"
. ", " . $db->quote($shopConfiguration->fields[3]) . " )";
$db->execute($insertNewConfigQuery);
}
$shopConfiguration->fetchRow();
}
}
$inheritAll = $shop->oxshops__oxisinherited->value ? "true" : "false";
$multiShopTables = $config->getConfigParam('aMultiShopTables');
foreach ($multiShopTables as $multishopTable) {
$config->saveShopConfVar("bool", 'blMallInherit_' . strtolower($multishopTable), $inheritAll, $shop->oxshops__oxid->value);
}
} | php | protected function _copyConfigVars($shop)
{
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$utilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject();
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$nonCopyVars = $this->_getNonCopyConfigVars();
$selectShopConfigurationQuery =
"select oxvarname, oxvartype,
DECODE( oxvarvalue, " . $db->quote($config->getConfigParam('sConfigKey')) . ") as oxvarvalue, oxmodule
from oxconfig where oxshopid = '1'";
$shopConfiguration = $db->select($selectShopConfigurationQuery);
if ($shopConfiguration != false && $shopConfiguration->count() > 0) {
while (!$shopConfiguration->EOF) {
$configName = $shopConfiguration->fields[0];
if (!in_array($configName, $nonCopyVars)) {
$newId = $utilsObject->generateUID();
$insertNewConfigQuery =
"insert into oxconfig
(oxid, oxshopid, oxvarname, oxvartype, oxvarvalue, oxmodule) values ( '$newId', " . $db->quote($shop->getId())
. ", " . $db->quote($shopConfiguration->fields[0])
. ", " . $db->quote($shopConfiguration->fields[1])
. ", ENCODE( " . $db->quote($shopConfiguration->fields[2])
. ", '" . $config->getConfigParam('sConfigKey')
. "')"
. ", " . $db->quote($shopConfiguration->fields[3]) . " )";
$db->execute($insertNewConfigQuery);
}
$shopConfiguration->fetchRow();
}
}
$inheritAll = $shop->oxshops__oxisinherited->value ? "true" : "false";
$multiShopTables = $config->getConfigParam('aMultiShopTables');
foreach ($multiShopTables as $multishopTable) {
$config->saveShopConfVar("bool", 'blMallInherit_' . strtolower($multishopTable), $inheritAll, $shop->oxshops__oxid->value);
}
} | [
"protected",
"function",
"_copyConfigVars",
"(",
"$",
"shop",
")",
"{",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"utilsObject",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"... | Copies base shop config variables to current
@param \OxidEsales\Eshop\Application\Model\Shop $shop new shop object | [
"Copies",
"base",
"shop",
"config",
"variables",
"to",
"current"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ShopMain.php#L167-L205 | train |
OXID-eSales/oxideshop_ce | source/Core/DataObject/ApplicationServer.php | ApplicationServer.needToUpdate | public function needToUpdate($currentTimestamp)
{
return ($this->hasLifetimeExpired($currentTimestamp, self::SERVER_INFO_UPDATE_PERIOD)
|| !$this->isServerTimeValid($currentTimestamp));
} | php | public function needToUpdate($currentTimestamp)
{
return ($this->hasLifetimeExpired($currentTimestamp, self::SERVER_INFO_UPDATE_PERIOD)
|| !$this->isServerTimeValid($currentTimestamp));
} | [
"public",
"function",
"needToUpdate",
"(",
"$",
"currentTimestamp",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"hasLifetimeExpired",
"(",
"$",
"currentTimestamp",
",",
"self",
"::",
"SERVER_INFO_UPDATE_PERIOD",
")",
"||",
"!",
"$",
"this",
"->",
"isServerTimeVa... | Check if application server information must be updated.
@param int $currentTimestamp The current timestamp.
@return bool | [
"Check",
"if",
"application",
"server",
"information",
"must",
"be",
"updated",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DataObject/ApplicationServer.php#L194-L198 | train |
OXID-eSales/oxideshop_ce | source/Core/DataObject/ApplicationServer.php | ApplicationServer.hasLifetimeExpired | private function hasLifetimeExpired($currentTimestamp, $periodTimestamp)
{
$timestamp = $this->getTimestamp();
return (bool) ($currentTimestamp - $timestamp >= $periodTimestamp);
} | php | private function hasLifetimeExpired($currentTimestamp, $periodTimestamp)
{
$timestamp = $this->getTimestamp();
return (bool) ($currentTimestamp - $timestamp >= $periodTimestamp);
} | [
"private",
"function",
"hasLifetimeExpired",
"(",
"$",
"currentTimestamp",
",",
"$",
"periodTimestamp",
")",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"getTimestamp",
"(",
")",
";",
"return",
"(",
"bool",
")",
"(",
"$",
"currentTimestamp",
"-",
"$",
"... | Compare if the application server lifetime has exceeded given period.
@param int $currentTimestamp The current timestamp.
@param int $periodTimestamp The timestamp of period to check.
@return bool | [
"Compare",
"if",
"the",
"application",
"server",
"lifetime",
"has",
"exceeded",
"given",
"period",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Core/DataObject/ApplicationServer.php#L221-L225 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._getCsvFieldsNames | protected function _getCsvFieldsNames()
{
$blCsvContainsHeader = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blContainsHeader');
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('blCsvContainsHeader', $blCsvContainsHeader);
$this->_getUploadedCsvFilePath();
$aFirstRow = $this->_getCsvFirstRow();
if (!$blCsvContainsHeader) {
$iIndex = 1;
foreach ($aFirstRow as $sValue) {
$aCsvFields[$iIndex] = 'Column ' . $iIndex++;
}
} else {
foreach ($aFirstRow as $sKey => $sValue) {
$aFirstRow[$sKey] = \OxidEsales\Eshop\Core\Str::getStr()->htmlentities($sValue);
}
$aCsvFields = $aFirstRow;
}
return $aCsvFields;
} | php | protected function _getCsvFieldsNames()
{
$blCsvContainsHeader = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blContainsHeader');
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('blCsvContainsHeader', $blCsvContainsHeader);
$this->_getUploadedCsvFilePath();
$aFirstRow = $this->_getCsvFirstRow();
if (!$blCsvContainsHeader) {
$iIndex = 1;
foreach ($aFirstRow as $sValue) {
$aCsvFields[$iIndex] = 'Column ' . $iIndex++;
}
} else {
foreach ($aFirstRow as $sKey => $sValue) {
$aFirstRow[$sKey] = \OxidEsales\Eshop\Core\Str::getStr()->htmlentities($sValue);
}
$aCsvFields = $aFirstRow;
}
return $aCsvFields;
} | [
"protected",
"function",
"_getCsvFieldsNames",
"(",
")",
"{",
"$",
"blCsvContainsHeader",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'blContainsHeader'",
")",
";",
"\\",... | Get columns names from CSV file header. If file has no header
returns default columns names Column 1, Column 2..
@return array | [
"Get",
"columns",
"names",
"from",
"CSV",
"file",
"header",
".",
"If",
"file",
"has",
"no",
"header",
"returns",
"default",
"columns",
"names",
"Column",
"1",
"Column",
"2",
".."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L182-L204 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._getCsvFirstRow | protected function _getCsvFirstRow()
{
$sPath = $this->_getUploadedCsvFilePath();
$iMaxLineLength = 8192;
//getting first row
if (($rFile = @fopen($sPath, "r")) !== false) {
$aRow = fgetcsv($rFile, $iMaxLineLength, $this->_getCsvFieldsTerminator(), $this->_getCsvFieldsEncolser());
fclose($rFile);
}
return $aRow;
} | php | protected function _getCsvFirstRow()
{
$sPath = $this->_getUploadedCsvFilePath();
$iMaxLineLength = 8192;
//getting first row
if (($rFile = @fopen($sPath, "r")) !== false) {
$aRow = fgetcsv($rFile, $iMaxLineLength, $this->_getCsvFieldsTerminator(), $this->_getCsvFieldsEncolser());
fclose($rFile);
}
return $aRow;
} | [
"protected",
"function",
"_getCsvFirstRow",
"(",
")",
"{",
"$",
"sPath",
"=",
"$",
"this",
"->",
"_getUploadedCsvFilePath",
"(",
")",
";",
"$",
"iMaxLineLength",
"=",
"8192",
";",
"//getting first row",
"if",
"(",
"(",
"$",
"rFile",
"=",
"@",
"fopen",
"(",... | Get first row from uploaded CSV file
@return array | [
"Get",
"first",
"row",
"from",
"uploaded",
"CSV",
"file"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L211-L223 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._resetUploadedCsvData | protected function _resetUploadedCsvData()
{
$this->_sCsvFilePath = null;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sCsvFilePath', null);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('blCsvContainsHeader', null);
} | php | protected function _resetUploadedCsvData()
{
$this->_sCsvFilePath = null;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sCsvFilePath', null);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('blCsvContainsHeader', null);
} | [
"protected",
"function",
"_resetUploadedCsvData",
"(",
")",
"{",
"$",
"this",
"->",
"_sCsvFilePath",
"=",
"null",
";",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"setVariable",
"(",
"'sCsvFilePath'",
... | Resets CSV parameters stored in session | [
"Resets",
"CSV",
"parameters",
"stored",
"in",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L228-L233 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._checkErrors | protected function _checkErrors($iNavStep)
{
if ($iNavStep == 2) {
if (!$this->_getUploadedCsvFilePath()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('GENIMPORT_ERRORUPLOADINGFILE');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
return 1;
}
}
if ($iNavStep == 3) {
$blIsEmpty = true;
$aCsvFields = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aCsvFields');
foreach ($aCsvFields as $sValue) {
if ($sValue) {
$blIsEmpty = false;
break;
}
}
if ($blIsEmpty) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('GENIMPORT_ERRORASSIGNINGFIELDS');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
return 2;
}
}
return $iNavStep;
} | php | protected function _checkErrors($iNavStep)
{
if ($iNavStep == 2) {
if (!$this->_getUploadedCsvFilePath()) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('GENIMPORT_ERRORUPLOADINGFILE');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
return 1;
}
}
if ($iNavStep == 3) {
$blIsEmpty = true;
$aCsvFields = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aCsvFields');
foreach ($aCsvFields as $sValue) {
if ($sValue) {
$blIsEmpty = false;
break;
}
}
if ($blIsEmpty) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage('GENIMPORT_ERRORASSIGNINGFIELDS');
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
return 2;
}
}
return $iNavStep;
} | [
"protected",
"function",
"_checkErrors",
"(",
"$",
"iNavStep",
")",
"{",
"if",
"(",
"$",
"iNavStep",
"==",
"2",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_getUploadedCsvFilePath",
"(",
")",
")",
"{",
"$",
"oEx",
"=",
"oxNew",
"(",
"\\",
"OxidEsal... | Checks current import navigation step errors.
Returns step id in which error occured.
@param int $iNavStep Navigation step id
@return int | [
"Checks",
"current",
"import",
"navigation",
"step",
"errors",
".",
"Returns",
"step",
"id",
"in",
"which",
"error",
"occured",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L243-L275 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._getUploadedCsvFilePath | protected function _getUploadedCsvFilePath()
{
//try to get uploaded csv file path
if ($this->_sCsvFilePath !== null) {
return $this->_sCsvFilePath;
} elseif ($this->_sCsvFilePath = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('sCsvFilePath')) {
return $this->_sCsvFilePath;
}
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aFile = $oConfig->getUploadedFile('csvfile');
if (isset($aFile['name']) && $aFile['name']) {
$this->_sCsvFilePath = $oConfig->getConfigParam('sCompileDir') . basename($aFile['tmp_name']);
move_uploaded_file($aFile['tmp_name'], $this->_sCsvFilePath);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sCsvFilePath', $this->_sCsvFilePath);
return $this->_sCsvFilePath;
}
} | php | protected function _getUploadedCsvFilePath()
{
//try to get uploaded csv file path
if ($this->_sCsvFilePath !== null) {
return $this->_sCsvFilePath;
} elseif ($this->_sCsvFilePath = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('sCsvFilePath')) {
return $this->_sCsvFilePath;
}
$oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$aFile = $oConfig->getUploadedFile('csvfile');
if (isset($aFile['name']) && $aFile['name']) {
$this->_sCsvFilePath = $oConfig->getConfigParam('sCompileDir') . basename($aFile['tmp_name']);
move_uploaded_file($aFile['tmp_name'], $this->_sCsvFilePath);
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sCsvFilePath', $this->_sCsvFilePath);
return $this->_sCsvFilePath;
}
} | [
"protected",
"function",
"_getUploadedCsvFilePath",
"(",
")",
"{",
"//try to get uploaded csv file path",
"if",
"(",
"$",
"this",
"->",
"_sCsvFilePath",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_sCsvFilePath",
";",
"}",
"elseif",
"(",
"$",
"this",
... | Checks if CSV file was uploaded. If uploaded - moves it to temp dir
and stores path to file in session. Return path to uploaded file.
@return string | [
"Checks",
"if",
"CSV",
"file",
"was",
"uploaded",
".",
"If",
"uploaded",
"-",
"moves",
"it",
"to",
"temp",
"dir",
"and",
"stores",
"path",
"to",
"file",
"in",
"session",
".",
"Return",
"path",
"to",
"uploaded",
"file",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L283-L301 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._checkImportErrors | protected function _checkImportErrors($oErpImport)
{
foreach ($oErpImport->getStatistics() as $aValue) {
if (!$aValue ['r']) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage($aValue ['m']);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
}
}
} | php | protected function _checkImportErrors($oErpImport)
{
foreach ($oErpImport->getStatistics() as $aValue) {
if (!$aValue ['r']) {
$oEx = oxNew(\OxidEsales\Eshop\Core\Exception\ExceptionToDisplay::class);
$oEx->setMessage($aValue ['m']);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'genimport');
}
}
} | [
"protected",
"function",
"_checkImportErrors",
"(",
"$",
"oErpImport",
")",
"{",
"foreach",
"(",
"$",
"oErpImport",
"->",
"getStatistics",
"(",
")",
"as",
"$",
"aValue",
")",
"{",
"if",
"(",
"!",
"$",
"aValue",
"[",
"'r'",
"]",
")",
"{",
"$",
"oEx",
... | Checks if any error occured during import and displays them
@param object $oErpImport Import object | [
"Checks",
"if",
"any",
"error",
"occured",
"during",
"import",
"and",
"displays",
"them"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L308-L317 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._getCsvFieldsTerminator | protected function _getCsvFieldsTerminator()
{
if ($this->_sStringTerminator === null) {
$this->_sStringTerminator = $this->_sDefaultStringTerminator;
if ($char = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sGiCsvFieldTerminator')) {
$this->_sStringTerminator = $char;
}
}
return $this->_sStringTerminator;
} | php | protected function _getCsvFieldsTerminator()
{
if ($this->_sStringTerminator === null) {
$this->_sStringTerminator = $this->_sDefaultStringTerminator;
if ($char = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sGiCsvFieldTerminator')) {
$this->_sStringTerminator = $char;
}
}
return $this->_sStringTerminator;
} | [
"protected",
"function",
"_getCsvFieldsTerminator",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sStringTerminator",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_sStringTerminator",
"=",
"$",
"this",
"->",
"_sDefaultStringTerminator",
";",
"if",
"(",
"$",
... | Get csv field terminator symbol
@return string | [
"Get",
"csv",
"field",
"terminator",
"symbol"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L324-L334 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/GenericImportMain.php | GenericImportMain._getCsvFieldsEncolser | protected function _getCsvFieldsEncolser()
{
if ($this->_sStringEncloser === null) {
$this->_sStringEncloser = $this->_sDefaultStringEncloser;
if ($char = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sGiCsvFieldEncloser')) {
$this->_sStringEncloser = $char;
}
}
return $this->_sStringEncloser;
} | php | protected function _getCsvFieldsEncolser()
{
if ($this->_sStringEncloser === null) {
$this->_sStringEncloser = $this->_sDefaultStringEncloser;
if ($char = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sGiCsvFieldEncloser')) {
$this->_sStringEncloser = $char;
}
}
return $this->_sStringEncloser;
} | [
"protected",
"function",
"_getCsvFieldsEncolser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_sStringEncloser",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_sStringEncloser",
"=",
"$",
"this",
"->",
"_sDefaultStringEncloser",
";",
"if",
"(",
"$",
"char",... | Get csv field encloser symbol
@return string | [
"Get",
"csv",
"field",
"encloser",
"symbol"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/GenericImportMain.php#L341-L351 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleExtend.php | ArticleExtend.render | public function render()
{
parent::render();
$this->_aViewData['edit'] = $article = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oxId = $this->getEditObjectId();
$this->_createCategoryTree("artcattree");
// all categories
if (isset($oxId) && $oxId != "-1") {
// load object
$article->loadInLang($this->_iEditLang, $oxId);
$article = $this->updateArticle($article);
// load object in other languages
$otherLang = $article->getAvailableInLangs();
if (!isset($otherLang[$this->_iEditLang])) {
$article->loadInLang(key($otherLang), $oxId);
}
foreach ($otherLang as $id => $language) {
$lang = new stdClass();
$lang->sLangDesc = $language;
$lang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $lang;
}
// variant handling
if ($article->oxarticles__oxparentid->value) {
$parentArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$parentArticle->load($article->oxarticles__oxparentid->value);
$this->_aViewData["parentarticle"] = $parentArticle;
$this->_aViewData["oxparentid"] = $article->oxarticles__oxparentid->value;
}
}
$this->prepareBundledArticlesDataForView($article);
$iAoc = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("aoc");
if ($iAoc == 1) {
$oArticleExtendAjax = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\ArticleExtendAjax::class);
$this->_aViewData['oxajax'] = $oArticleExtendAjax->getColumns();
return "popups/article_extend.tpl";
} elseif ($iAoc == 2) {
$oArticleBundleAjax = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\ArticleBundleAjax::class);
$this->_aViewData['oxajax'] = $oArticleBundleAjax->getColumns();
return "popups/article_bundle.tpl";
}
//load media files
$this->_aViewData['aMediaUrls'] = $article->getMediaUrls();
return "article_extend.tpl";
} | php | public function render()
{
parent::render();
$this->_aViewData['edit'] = $article = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$oxId = $this->getEditObjectId();
$this->_createCategoryTree("artcattree");
// all categories
if (isset($oxId) && $oxId != "-1") {
// load object
$article->loadInLang($this->_iEditLang, $oxId);
$article = $this->updateArticle($article);
// load object in other languages
$otherLang = $article->getAvailableInLangs();
if (!isset($otherLang[$this->_iEditLang])) {
$article->loadInLang(key($otherLang), $oxId);
}
foreach ($otherLang as $id => $language) {
$lang = new stdClass();
$lang->sLangDesc = $language;
$lang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $lang;
}
// variant handling
if ($article->oxarticles__oxparentid->value) {
$parentArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
$parentArticle->load($article->oxarticles__oxparentid->value);
$this->_aViewData["parentarticle"] = $parentArticle;
$this->_aViewData["oxparentid"] = $article->oxarticles__oxparentid->value;
}
}
$this->prepareBundledArticlesDataForView($article);
$iAoc = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("aoc");
if ($iAoc == 1) {
$oArticleExtendAjax = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\ArticleExtendAjax::class);
$this->_aViewData['oxajax'] = $oArticleExtendAjax->getColumns();
return "popups/article_extend.tpl";
} elseif ($iAoc == 2) {
$oArticleBundleAjax = oxNew(\OxidEsales\Eshop\Application\Controller\Admin\ArticleBundleAjax::class);
$this->_aViewData['oxajax'] = $oArticleBundleAjax->getColumns();
return "popups/article_bundle.tpl";
}
//load media files
$this->_aViewData['aMediaUrls'] = $article->getMediaUrls();
return "article_extend.tpl";
} | [
"public",
"function",
"render",
"(",
")",
"{",
"parent",
"::",
"render",
"(",
")",
";",
"$",
"this",
"->",
"_aViewData",
"[",
"'edit'",
"]",
"=",
"$",
"article",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
... | Collects available article extended parameters, passes them to
Smarty engine and returns template file name "article_extend.tpl".
@return string | [
"Collects",
"available",
"article",
"extended",
"parameters",
"passes",
"them",
"to",
"Smarty",
"engine",
"and",
"returns",
"template",
"file",
"name",
"article_extend",
".",
"tpl",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleExtend.php#L37-L95 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleExtend.php | ArticleExtend.updateMedia | public function updateMedia()
{
$aMediaUrls = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aMediaUrls');
if (is_array($aMediaUrls)) {
foreach ($aMediaUrls as $sMediaId => $aMediaParams) {
$oMedia = oxNew(\OxidEsales\Eshop\Application\Model\MediaUrl::class);
if ($oMedia->load($sMediaId)) {
$oMedia->setLanguage(0);
$oMedia->assign($aMediaParams);
$oMedia->setLanguage($this->_iEditLang);
$oMedia->save();
}
}
}
} | php | public function updateMedia()
{
$aMediaUrls = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aMediaUrls');
if (is_array($aMediaUrls)) {
foreach ($aMediaUrls as $sMediaId => $aMediaParams) {
$oMedia = oxNew(\OxidEsales\Eshop\Application\Model\MediaUrl::class);
if ($oMedia->load($sMediaId)) {
$oMedia->setLanguage(0);
$oMedia->assign($aMediaParams);
$oMedia->setLanguage($this->_iEditLang);
$oMedia->save();
}
}
}
} | [
"public",
"function",
"updateMedia",
"(",
")",
"{",
"$",
"aMediaUrls",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getRequestParameter",
"(",
"'aMediaUrls'",
")",
";",
"if",
"(",
"is_array",
"... | Updates existing media descriptions | [
"Updates",
"existing",
"media",
"descriptions"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleExtend.php#L221-L235 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleExtend.php | ArticleExtend.getUnitsArray | public function getUnitsArray()
{
if ($this->_aUnitsArray === null) {
$this->_aUnitsArray = \OxidEsales\Eshop\Core\Registry::getLang()->getSimilarByKey("_UNIT_", $this->_iEditLang, false);
}
return $this->_aUnitsArray;
} | php | public function getUnitsArray()
{
if ($this->_aUnitsArray === null) {
$this->_aUnitsArray = \OxidEsales\Eshop\Core\Registry::getLang()->getSimilarByKey("_UNIT_", $this->_iEditLang, false);
}
return $this->_aUnitsArray;
} | [
"public",
"function",
"getUnitsArray",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_aUnitsArray",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_aUnitsArray",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getLang",
"(",
... | Returns array of possible unit combination and its translation for edit language
@return array | [
"Returns",
"array",
"of",
"possible",
"unit",
"combination",
"and",
"its",
"translation",
"for",
"edit",
"language"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleExtend.php#L242-L249 | train |
OXID-eSales/oxideshop_ce | source/Application/Controller/Admin/ArticleExtend.php | ArticleExtend.prepareBundledArticlesDataForView | protected function prepareBundledArticlesDataForView($article)
{
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDB();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$articleTable = getViewName('oxarticles', $this->_iEditLang);
$query = "select {$articleTable}.oxtitle, {$articleTable}.oxartnum, {$articleTable}.oxvarselect " .
"from {$articleTable} where 1 ";
// #546
$isVariantSelectionEnabled = $config->getConfigParam('blVariantsSelection');
$bundleIdField = 'oxarticles__oxbundleid';
$query .= $isVariantSelectionEnabled ? '' : " and {$articleTable}.oxparentid = '' ";
$query .= " and {$articleTable}.oxid = " . $database->quote($article->$bundleIdField->value);
$resultFromDatabase = $database->select($query);
if ($resultFromDatabase != false && $resultFromDatabase->count() > 0) {
while (!$resultFromDatabase->EOF) {
$articleNumber = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[1]);
$articleTitle = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[0] . " " . $resultFromDatabase->fields[2]);
$resultFromDatabase->fetchRow();
}
}
$this->_aViewData['bundle_artnum'] = $articleNumber;
$this->_aViewData['bundle_title'] = $articleTitle;
} | php | protected function prepareBundledArticlesDataForView($article)
{
$database = \OxidEsales\Eshop\Core\DatabaseProvider::getDB();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$articleTable = getViewName('oxarticles', $this->_iEditLang);
$query = "select {$articleTable}.oxtitle, {$articleTable}.oxartnum, {$articleTable}.oxvarselect " .
"from {$articleTable} where 1 ";
// #546
$isVariantSelectionEnabled = $config->getConfigParam('blVariantsSelection');
$bundleIdField = 'oxarticles__oxbundleid';
$query .= $isVariantSelectionEnabled ? '' : " and {$articleTable}.oxparentid = '' ";
$query .= " and {$articleTable}.oxid = " . $database->quote($article->$bundleIdField->value);
$resultFromDatabase = $database->select($query);
if ($resultFromDatabase != false && $resultFromDatabase->count() > 0) {
while (!$resultFromDatabase->EOF) {
$articleNumber = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[1]);
$articleTitle = new \OxidEsales\Eshop\Core\Field($resultFromDatabase->fields[0] . " " . $resultFromDatabase->fields[2]);
$resultFromDatabase->fetchRow();
}
}
$this->_aViewData['bundle_artnum'] = $articleNumber;
$this->_aViewData['bundle_title'] = $articleTitle;
} | [
"protected",
"function",
"prepareBundledArticlesDataForView",
"(",
"$",
"article",
")",
"{",
"$",
"database",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDB",
"(",
")",
";",
"$",
"config",
"=",
"\\",
"OxidEsales",
... | Adds data to _aViewData for later use in templates.
@param \OxidEsales\Eshop\Application\Model\Article $article | [
"Adds",
"data",
"to",
"_aViewData",
"for",
"later",
"use",
"in",
"templates",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Controller/Admin/ArticleExtend.php#L268-L292 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.isSaveToDataBaseEnabled | public function isSaveToDataBaseEnabled()
{
if (is_null($this->_blSaveToDataBase)) {
$this->_blSaveToDataBase = (bool) !\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPerfNoBasketSaving');
}
return $this->_blSaveToDataBase;
} | php | public function isSaveToDataBaseEnabled()
{
if (is_null($this->_blSaveToDataBase)) {
$this->_blSaveToDataBase = (bool) !\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPerfNoBasketSaving');
}
return $this->_blSaveToDataBase;
} | [
"public",
"function",
"isSaveToDataBaseEnabled",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_blSaveToDataBase",
")",
")",
"{",
"$",
"this",
"->",
"_blSaveToDataBase",
"=",
"(",
"bool",
")",
"!",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
... | Returns true if saving to data base enabled
@return boolean | [
"Returns",
"true",
"if",
"saving",
"to",
"data",
"base",
"enabled"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L301-L308 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.isCalculationModeNetto | public function isCalculationModeNetto()
{
if ($this->_isCalculationModeNetto === null) {
$this->setCalculationModeNetto($this->isPriceViewModeNetto());
}
return $this->_isCalculationModeNetto;
} | php | public function isCalculationModeNetto()
{
if ($this->_isCalculationModeNetto === null) {
$this->setCalculationModeNetto($this->isPriceViewModeNetto());
}
return $this->_isCalculationModeNetto;
} | [
"public",
"function",
"isCalculationModeNetto",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isCalculationModeNetto",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setCalculationModeNetto",
"(",
"$",
"this",
"->",
"isPriceViewModeNetto",
"(",
")",
")",
";",
... | Return true if calculation mode is netto
@return bool | [
"Return",
"true",
"if",
"calculation",
"mode",
"is",
"netto"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L316-L323 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._changeBasketItemKey | protected function _changeBasketItemKey($sOldKey, $sNewKey, $value = null)
{
reset($this->_aBasketContents);
$iOldKeyPlace = 0;
while (key($this->_aBasketContents) != $sOldKey && next($this->_aBasketContents)) {
++$iOldKeyPlace;
}
$aNewCopy = array_merge(
array_slice($this->_aBasketContents, 0, $iOldKeyPlace, true),
[$sNewKey => $value],
array_slice($this->_aBasketContents, $iOldKeyPlace + 1, count($this->_aBasketContents) - $iOldKeyPlace, true)
);
$this->_aBasketContents = $aNewCopy;
} | php | protected function _changeBasketItemKey($sOldKey, $sNewKey, $value = null)
{
reset($this->_aBasketContents);
$iOldKeyPlace = 0;
while (key($this->_aBasketContents) != $sOldKey && next($this->_aBasketContents)) {
++$iOldKeyPlace;
}
$aNewCopy = array_merge(
array_slice($this->_aBasketContents, 0, $iOldKeyPlace, true),
[$sNewKey => $value],
array_slice($this->_aBasketContents, $iOldKeyPlace + 1, count($this->_aBasketContents) - $iOldKeyPlace, true)
);
$this->_aBasketContents = $aNewCopy;
} | [
"protected",
"function",
"_changeBasketItemKey",
"(",
"$",
"sOldKey",
",",
"$",
"sNewKey",
",",
"$",
"value",
"=",
"null",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"_aBasketContents",
")",
";",
"$",
"iOldKeyPlace",
"=",
"0",
";",
"while",
"(",
"key",
... | change old key to new one but retain key position in array
@param string $sOldKey old key
@param string $sNewKey new key to place in old one's place
@param mixed $value (optional) | [
"change",
"old",
"key",
"to",
"new",
"one",
"but",
"retain",
"key",
"position",
"in",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L392-L405 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getItemKey | public function getItemKey($sProductId, $aSel = null, $aPersParam = null, $blBundle = false, $sAdditionalParam = '')
{
$aSel = ($aSel != null) ? $aSel : [0 => '0'];
$sItemKey = md5($sProductId . '|' . serialize($aSel) . '|' . serialize($aPersParam) . '|' . ( int ) $blBundle . '|' . serialize($sAdditionalParam));
return $sItemKey;
} | php | public function getItemKey($sProductId, $aSel = null, $aPersParam = null, $blBundle = false, $sAdditionalParam = '')
{
$aSel = ($aSel != null) ? $aSel : [0 => '0'];
$sItemKey = md5($sProductId . '|' . serialize($aSel) . '|' . serialize($aPersParam) . '|' . ( int ) $blBundle . '|' . serialize($sAdditionalParam));
return $sItemKey;
} | [
"public",
"function",
"getItemKey",
"(",
"$",
"sProductId",
",",
"$",
"aSel",
"=",
"null",
",",
"$",
"aPersParam",
"=",
"null",
",",
"$",
"blBundle",
"=",
"false",
",",
"$",
"sAdditionalParam",
"=",
"''",
")",
"{",
"$",
"aSel",
"=",
"(",
"$",
"aSel",... | Returns unique basket item identifier which consist from product ID,
select lists data, persistent info and bundle property
@param string $sProductId basket item id
@param array $aSel basket item selectlists
@param array $aPersParam basket item persistent parameters
@param bool $blBundle bundle marker
@param string $sAdditionalParam possible additional information
@return string | [
"Returns",
"unique",
"basket",
"item",
"identifier",
"which",
"consist",
"from",
"product",
"ID",
"select",
"lists",
"data",
"persistent",
"info",
"and",
"bundle",
"property"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L581-L588 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.removeItem | public function removeItem($sItemKey)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPsBasketReservationEnabled')) {
if (isset($this->_aBasketContents[$sItemKey])) {
$sArticleId = $this->_aBasketContents[$sItemKey]->getProductId();
if ($sArticleId) {
$this->getSession()
->getBasketReservations()
->discardArticleReservation($sArticleId);
}
}
}
unset($this->_aBasketContents[$sItemKey]);
// basket exclude
if (!count($this->_aBasketContents) && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blBasketExcludeEnabled')) {
$this->setBasketRootCatId(null);
}
} | php | public function removeItem($sItemKey)
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPsBasketReservationEnabled')) {
if (isset($this->_aBasketContents[$sItemKey])) {
$sArticleId = $this->_aBasketContents[$sItemKey]->getProductId();
if ($sArticleId) {
$this->getSession()
->getBasketReservations()
->discardArticleReservation($sArticleId);
}
}
}
unset($this->_aBasketContents[$sItemKey]);
// basket exclude
if (!count($this->_aBasketContents) && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blBasketExcludeEnabled')) {
$this->setBasketRootCatId(null);
}
} | [
"public",
"function",
"removeItem",
"(",
"$",
"sItemKey",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blPsBasketReservationEnabled'",
")",
")",
"{",
"if",... | Removes item from basket
@param string $sItemKey basket item key | [
"Removes",
"item",
"from",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L596-L614 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._clearBundles | protected function _clearBundles()
{
reset($this->_aBasketContents);
foreach ($this->_aBasketContents as $sItemKey => $oBasketItem) {
if ($oBasketItem->isBundle()) {
$this->removeItem($sItemKey);
}
}
} | php | protected function _clearBundles()
{
reset($this->_aBasketContents);
foreach ($this->_aBasketContents as $sItemKey => $oBasketItem) {
if ($oBasketItem->isBundle()) {
$this->removeItem($sItemKey);
}
}
} | [
"protected",
"function",
"_clearBundles",
"(",
")",
"{",
"reset",
"(",
"$",
"this",
"->",
"_aBasketContents",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_aBasketContents",
"as",
"$",
"sItemKey",
"=>",
"$",
"oBasketItem",
")",
"{",
"if",
"(",
"$",
"oBa... | Unsets bundled basket items from basket contents array | [
"Unsets",
"bundled",
"basket",
"items",
"from",
"basket",
"contents",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L619-L627 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._getArticleBundles | protected function _getArticleBundles($oBasketItem)
{
$aBundles = [];
if ($oBasketItem->isBundle()) {
return $aBundles;
}
$oArticle = $oBasketItem->getArticle(true);
if ($oArticle && $oArticle->oxarticles__oxbundleid->value) {
$aBundles[$oArticle->oxarticles__oxbundleid->value] = 1;
}
return $aBundles;
} | php | protected function _getArticleBundles($oBasketItem)
{
$aBundles = [];
if ($oBasketItem->isBundle()) {
return $aBundles;
}
$oArticle = $oBasketItem->getArticle(true);
if ($oArticle && $oArticle->oxarticles__oxbundleid->value) {
$aBundles[$oArticle->oxarticles__oxbundleid->value] = 1;
}
return $aBundles;
} | [
"protected",
"function",
"_getArticleBundles",
"(",
"$",
"oBasketItem",
")",
"{",
"$",
"aBundles",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"oBasketItem",
"->",
"isBundle",
"(",
")",
")",
"{",
"return",
"$",
"aBundles",
";",
"}",
"$",
"oArticle",
"=",
"$",
... | Returns array of bundled articles IDs for basket item
@param object $oBasketItem basket item object
@return array | [
"Returns",
"array",
"of",
"bundled",
"articles",
"IDs",
"for",
"basket",
"item"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L636-L650 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._getItemBundles | protected function _getItemBundles($oBasketItem, $aBundles = [])
{
if ($oBasketItem->isBundle()) {
return [];
}
// does this object still exists ?
if ($oArticle = $oBasketItem->getArticle()) {
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketItemBundleDiscounts($oArticle, $this, $this->getBasketUser());
foreach ($aDiscounts as $oDiscount) {
$iAmnt = $oDiscount->getBundleAmount($oBasketItem->getAmount());
if ($iAmnt) {
//init array element
if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
}
if ($oDiscount->oxdiscount__oxitmmultiple->value) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $iAmnt;
} else {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = $iAmnt;
}
}
}
}
return $aBundles;
} | php | protected function _getItemBundles($oBasketItem, $aBundles = [])
{
if ($oBasketItem->isBundle()) {
return [];
}
// does this object still exists ?
if ($oArticle = $oBasketItem->getArticle()) {
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketItemBundleDiscounts($oArticle, $this, $this->getBasketUser());
foreach ($aDiscounts as $oDiscount) {
$iAmnt = $oDiscount->getBundleAmount($oBasketItem->getAmount());
if ($iAmnt) {
//init array element
if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
}
if ($oDiscount->oxdiscount__oxitmmultiple->value) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $iAmnt;
} else {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = $iAmnt;
}
}
}
}
return $aBundles;
} | [
"protected",
"function",
"_getItemBundles",
"(",
"$",
"oBasketItem",
",",
"$",
"aBundles",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"oBasketItem",
"->",
"isBundle",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// does this object still exists ?",
"if... | Returns array of bundled discount articles
@param object $oBasketItem basket item object
@param array $aBundles array of found bundles
@return array | [
"Returns",
"array",
"of",
"bundled",
"discount",
"articles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L660-L688 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._getBasketBundles | protected function _getBasketBundles($aBundles = [])
{
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketBundleDiscounts($this, $this->getBasketUser());
// calculating amount of non bundled/discount items
$dAmount = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
if (!($oBasketItem->isBundle() || $oBasketItem->isDiscountArticle())) {
$dAmount += $oBasketItem->getAmount();
}
}
foreach ($aDiscounts as $oDiscount) {
if ($oDiscount->oxdiscount__oxitmartid->value) {
if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
}
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $oDiscount->getBundleAmount($dAmount);
}
}
return $aBundles;
} | php | protected function _getBasketBundles($aBundles = [])
{
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketBundleDiscounts($this, $this->getBasketUser());
// calculating amount of non bundled/discount items
$dAmount = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
if (!($oBasketItem->isBundle() || $oBasketItem->isDiscountArticle())) {
$dAmount += $oBasketItem->getAmount();
}
}
foreach ($aDiscounts as $oDiscount) {
if ($oDiscount->oxdiscount__oxitmartid->value) {
if (!isset($aBundles[$oDiscount->oxdiscount__oxitmartid->value])) {
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] = 0;
}
$aBundles[$oDiscount->oxdiscount__oxitmartid->value] += $oDiscount->getBundleAmount($dAmount);
}
}
return $aBundles;
} | [
"protected",
"function",
"_getBasketBundles",
"(",
"$",
"aBundles",
"=",
"[",
"]",
")",
"{",
"$",
"aDiscounts",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"get",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application"... | Returns array of bundled discount articles for whole basket
@param array $aBundles array of found bundles
@return array | [
"Returns",
"array",
"of",
"bundled",
"discount",
"articles",
"for",
"whole",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L697-L720 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._addBundles | protected function _addBundles()
{
$aBundles = [];
// iterating through articles and binding bundles
foreach ($this->_aBasketContents as $key => $oBasketItem) {
try {
// adding discount type bundles
if (!$oBasketItem->isDiscountArticle() && !$oBasketItem->isBundle()) {
$aBundles = $this->_getItemBundles($oBasketItem, $aBundles);
} else {
continue;
}
// adding item type bundles
$aArtBundles = $this->_getArticleBundles($oBasketItem);
// adding bundles to basket
$this->_addBundlesToBasket($aArtBundles);
} catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $oEx) {
$this->removeItem($key);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
} catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx) {
$this->removeItem($key);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
}
}
// adding global basket bundles
$aBundles = $this->_getBasketBundles($aBundles);
// adding all bundles to basket
if ($aBundles) {
$this->_addBundlesToBasket($aBundles);
}
} | php | protected function _addBundles()
{
$aBundles = [];
// iterating through articles and binding bundles
foreach ($this->_aBasketContents as $key => $oBasketItem) {
try {
// adding discount type bundles
if (!$oBasketItem->isDiscountArticle() && !$oBasketItem->isBundle()) {
$aBundles = $this->_getItemBundles($oBasketItem, $aBundles);
} else {
continue;
}
// adding item type bundles
$aArtBundles = $this->_getArticleBundles($oBasketItem);
// adding bundles to basket
$this->_addBundlesToBasket($aArtBundles);
} catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $oEx) {
$this->removeItem($key);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
} catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx) {
$this->removeItem($key);
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
}
}
// adding global basket bundles
$aBundles = $this->_getBasketBundles($aBundles);
// adding all bundles to basket
if ($aBundles) {
$this->_addBundlesToBasket($aBundles);
}
} | [
"protected",
"function",
"_addBundles",
"(",
")",
"{",
"$",
"aBundles",
"=",
"[",
"]",
";",
"// iterating through articles and binding bundles",
"foreach",
"(",
"$",
"this",
"->",
"_aBasketContents",
"as",
"$",
"key",
"=>",
"$",
"oBasketItem",
")",
"{",
"try",
... | Iterates through basket contents and adds bundles to items + adds
global basket bundles | [
"Iterates",
"through",
"basket",
"contents",
"and",
"adds",
"bundles",
"to",
"items",
"+",
"adds",
"global",
"basket",
"bundles"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L726-L759 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._addBundlesToBasket | protected function _addBundlesToBasket($aBundles)
{
foreach ($aBundles as $sBundleId => $dAmount) {
if ($dAmount) {
try {
if ($oBundleItem = $this->addToBasket($sBundleId, $dAmount, null, null, false, true)) {
$oBundleItem->setAsDiscountArticle(true);
}
} catch (\OxidEsales\Eshop\Core\Exception\ArticleException $oEx) {
// caught and ignored
if ($oEx instanceof \OxidEsales\Eshop\Core\Exception\OutOfStockException && $oEx->getRemainingAmount() > 0) {
$sItemId = $this->getItemKey($sBundleId, null, null, true);
$this->_aBasketContents[$sItemId]->setAsDiscountArticle(true);
}
}
}
}
} | php | protected function _addBundlesToBasket($aBundles)
{
foreach ($aBundles as $sBundleId => $dAmount) {
if ($dAmount) {
try {
if ($oBundleItem = $this->addToBasket($sBundleId, $dAmount, null, null, false, true)) {
$oBundleItem->setAsDiscountArticle(true);
}
} catch (\OxidEsales\Eshop\Core\Exception\ArticleException $oEx) {
// caught and ignored
if ($oEx instanceof \OxidEsales\Eshop\Core\Exception\OutOfStockException && $oEx->getRemainingAmount() > 0) {
$sItemId = $this->getItemKey($sBundleId, null, null, true);
$this->_aBasketContents[$sItemId]->setAsDiscountArticle(true);
}
}
}
}
} | [
"protected",
"function",
"_addBundlesToBasket",
"(",
"$",
"aBundles",
")",
"{",
"foreach",
"(",
"$",
"aBundles",
"as",
"$",
"sBundleId",
"=>",
"$",
"dAmount",
")",
"{",
"if",
"(",
"$",
"dAmount",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"oBundleItem",
"="... | Adds bundles to basket
@param array $aBundles added bundle articles | [
"Adds",
"bundles",
"to",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L766-L783 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcItemsPrice | protected function _calcItemsPrice()
{
// resetting
$this->setSkipDiscounts(false);
$this->_iProductsCnt = 0; // count different types
$this->_dItemsCnt = 0; // count of item units
$this->_dWeight = 0; // basket weight
$this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $oBasketItem) {
$this->_iProductsCnt++;
$this->_dItemsCnt += $oBasketItem->getAmount();
$this->_dWeight += $oBasketItem->getWeight();
if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
$oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
$oBasketItem->setRegularUnitPrice(clone $oBasketPrice);
if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
// apply basket type discounts for item
$aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
reset($aDiscounts);
/** @var \oxDiscount $oDiscount */
foreach ($aDiscounts as $oDiscount) {
$oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
}
$oBasketPrice->calculateDiscount();
} else {
$oBasketItem->setSkipDiscounts(true);
$this->setSkipDiscounts(true);
}
$oBasketItem->setPrice($oBasketPrice);
$this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());
//P collect discount values for basket items which are discountable
if (!$oArticle->skipDiscounts()) {
$this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
} else {
$this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
$oBasketItem->setSkipDiscounts(true);
$this->setSkipDiscounts(true);
}
} elseif ($oBasketItem->isBundle()) {
// if bundles price is set to zero
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oBasketItem->setPrice($oPrice);
}
}
} | php | protected function _calcItemsPrice()
{
// resetting
$this->setSkipDiscounts(false);
$this->_iProductsCnt = 0; // count different types
$this->_dItemsCnt = 0; // count of item units
$this->_dWeight = 0; // basket weight
$this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$this->_oDiscountProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$this->_oNotDiscountedProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
$oDiscountList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class);
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $oBasketItem) {
$this->_iProductsCnt++;
$this->_dItemsCnt += $oBasketItem->getAmount();
$this->_dWeight += $oBasketItem->getWeight();
if (!$oBasketItem->isDiscountArticle() && ($oArticle = $oBasketItem->getArticle(true))) {
$oBasketPrice = $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $this);
$oBasketItem->setRegularUnitPrice(clone $oBasketPrice);
if (!$oArticle->skipDiscounts() && $this->canCalcDiscounts()) {
// apply basket type discounts for item
$aDiscounts = $oDiscountList->getBasketItemDiscounts($oArticle, $this, $this->getBasketUser());
reset($aDiscounts);
/** @var \oxDiscount $oDiscount */
foreach ($aDiscounts as $oDiscount) {
$oBasketPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
}
$oBasketPrice->calculateDiscount();
} else {
$oBasketItem->setSkipDiscounts(true);
$this->setSkipDiscounts(true);
}
$oBasketItem->setPrice($oBasketPrice);
$this->_oProductsPriceList->addToPriceList($oBasketItem->getPrice());
//P collect discount values for basket items which are discountable
if (!$oArticle->skipDiscounts()) {
$this->_oDiscountProductsPriceList->addToPriceList($oBasketItem->getPrice());
} else {
$this->_oNotDiscountedProductsPriceList->addToPriceList($oBasketItem->getPrice());
$oBasketItem->setSkipDiscounts(true);
$this->setSkipDiscounts(true);
}
} elseif ($oBasketItem->isBundle()) {
// if bundles price is set to zero
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oBasketItem->setPrice($oPrice);
}
}
} | [
"protected",
"function",
"_calcItemsPrice",
"(",
")",
"{",
"// resetting",
"$",
"this",
"->",
"setSkipDiscounts",
"(",
"false",
")",
";",
"$",
"this",
"->",
"_iProductsCnt",
"=",
"0",
";",
"// count different types",
"$",
"this",
"->",
"_dItemsCnt",
"=",
"0",
... | Iterates through basket items and calculates its prices and discounts | [
"Iterates",
"through",
"basket",
"items",
"and",
"calculates",
"its",
"prices",
"and",
"discounts"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L788-L843 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._mergeDiscounts | protected function _mergeDiscounts($aDiscounts, $aItemDiscounts)
{
foreach ($aItemDiscounts as $sKey => $oDiscount) {
// add prices of the same discounts
if (array_key_exists($sKey, $aDiscounts)) {
$aDiscounts[$sKey]->dDiscount += $oDiscount->dDiscount;
} else {
$aDiscounts[$sKey] = $oDiscount;
}
}
return $aDiscounts;
} | php | protected function _mergeDiscounts($aDiscounts, $aItemDiscounts)
{
foreach ($aItemDiscounts as $sKey => $oDiscount) {
// add prices of the same discounts
if (array_key_exists($sKey, $aDiscounts)) {
$aDiscounts[$sKey]->dDiscount += $oDiscount->dDiscount;
} else {
$aDiscounts[$sKey] = $oDiscount;
}
}
return $aDiscounts;
} | [
"protected",
"function",
"_mergeDiscounts",
"(",
"$",
"aDiscounts",
",",
"$",
"aItemDiscounts",
")",
"{",
"foreach",
"(",
"$",
"aItemDiscounts",
"as",
"$",
"sKey",
"=>",
"$",
"oDiscount",
")",
"{",
"// add prices of the same discounts",
"if",
"(",
"array_key_exist... | Merges two discount arrays. If there are two the same
discounts, discount values will be added.
@param array $aDiscounts Discount array
@param array $aItemDiscounts Discount array
@return array $aDiscounts | [
"Merges",
"two",
"discount",
"arrays",
".",
"If",
"there",
"are",
"two",
"the",
"same",
"discounts",
"discount",
"values",
"will",
"be",
"added",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L874-L886 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcDeliveryCost | protected function _calcDeliveryCost()
{
if ($this->_oDeliveryPrice !== null) {
return $this->_oDeliveryPrice;
}
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oDeliveryPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blDeliveryVatOnTop')) {
$oDeliveryPrice->setNettoPriceMode();
} else {
$oDeliveryPrice->setBruttoPriceMode();
}
// don't calculate if not logged in
$oUser = $this->getBasketUser();
if (!$oUser && !$myConfig->getConfigParam('blCalculateDelCostIfNotLoggedIn')) {
return $oDeliveryPrice;
}
$fDelVATPercent = $this->getAdditionalServicesVatPercent();
$oDeliveryPrice->setVat($fDelVATPercent);
// list of active delivery costs
if ($myConfig->getConfigParam('bl_perfLoadDelivery')) {
$aDeliveryList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliveryList::class)->getDeliveryList(
$this,
$oUser,
$this->_findDelivCountry(),
$this->getShippingId()
);
if (count($aDeliveryList) > 0) {
foreach ($aDeliveryList as $oDelivery) {
//debug trace
if ($myConfig->getConfigParam('iDebug') == 5) {
echo("DelCost : " . $oDelivery->oxdelivery__oxtitle->value . "<br>");
}
$oDeliveryPrice->addPrice($oDelivery->getDeliveryPrice($fDelVATPercent));
}
}
}
return $oDeliveryPrice;
} | php | protected function _calcDeliveryCost()
{
if ($this->_oDeliveryPrice !== null) {
return $this->_oDeliveryPrice;
}
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oDeliveryPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blDeliveryVatOnTop')) {
$oDeliveryPrice->setNettoPriceMode();
} else {
$oDeliveryPrice->setBruttoPriceMode();
}
// don't calculate if not logged in
$oUser = $this->getBasketUser();
if (!$oUser && !$myConfig->getConfigParam('blCalculateDelCostIfNotLoggedIn')) {
return $oDeliveryPrice;
}
$fDelVATPercent = $this->getAdditionalServicesVatPercent();
$oDeliveryPrice->setVat($fDelVATPercent);
// list of active delivery costs
if ($myConfig->getConfigParam('bl_perfLoadDelivery')) {
$aDeliveryList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliveryList::class)->getDeliveryList(
$this,
$oUser,
$this->_findDelivCountry(),
$this->getShippingId()
);
if (count($aDeliveryList) > 0) {
foreach ($aDeliveryList as $oDelivery) {
//debug trace
if ($myConfig->getConfigParam('iDebug') == 5) {
echo("DelCost : " . $oDelivery->oxdelivery__oxtitle->value . "<br>");
}
$oDeliveryPrice->addPrice($oDelivery->getDeliveryPrice($fDelVATPercent));
}
}
}
return $oDeliveryPrice;
} | [
"protected",
"function",
"_calcDeliveryCost",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oDeliveryPrice",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_oDeliveryPrice",
";",
"}",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
... | Iterates through basket items and calculates its delivery costs
@return \OxidEsales\Eshop\Core\Price | [
"Iterates",
"through",
"basket",
"items",
"and",
"calculates",
"its",
"delivery",
"costs"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L893-L938 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcTotalPrice | protected function _calcTotalPrice()
{
// 1. add products price
$dPrice = $this->_dBruttoSum;
/** @var \OxidEsales\Eshop\Core\Price $oTotalPrice */
$oTotalPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oTotalPrice->setBruttoPriceMode();
$oTotalPrice->setPrice($dPrice);
// 2. subtract discounts
if ($dPrice && !$this->isCalculationModeNetto()) {
// 2.2 applying basket discounts
$oTotalPrice->subtract($this->_oTotalDiscount->getBruttoPrice());
// 2.3 applying voucher discounts
if ($oVoucherDisc = $this->getVoucherDiscount()) {
$oTotalPrice->subtract($oVoucherDisc->getBruttoPrice());
}
}
// 2.3 add delivery cost
if (isset($this->_aCosts['oxdelivery'])) {
$oTotalPrice->add($this->_aCosts['oxdelivery']->getBruttoPrice());
}
// 2.4 add wrapping price
if (isset($this->_aCosts['oxwrapping'])) {
$oTotalPrice->add($this->_aCosts['oxwrapping']->getBruttoPrice());
}
if (isset($this->_aCosts['oxgiftcard'])) {
$oTotalPrice->add($this->_aCosts['oxgiftcard']->getBruttoPrice());
}
// 2.5 add payment price
if (isset($this->_aCosts['oxpayment'])) {
$oTotalPrice->add($this->_aCosts['oxpayment']->getBruttoPrice());
}
$this->setPrice($oTotalPrice);
} | php | protected function _calcTotalPrice()
{
// 1. add products price
$dPrice = $this->_dBruttoSum;
/** @var \OxidEsales\Eshop\Core\Price $oTotalPrice */
$oTotalPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
$oTotalPrice->setBruttoPriceMode();
$oTotalPrice->setPrice($dPrice);
// 2. subtract discounts
if ($dPrice && !$this->isCalculationModeNetto()) {
// 2.2 applying basket discounts
$oTotalPrice->subtract($this->_oTotalDiscount->getBruttoPrice());
// 2.3 applying voucher discounts
if ($oVoucherDisc = $this->getVoucherDiscount()) {
$oTotalPrice->subtract($oVoucherDisc->getBruttoPrice());
}
}
// 2.3 add delivery cost
if (isset($this->_aCosts['oxdelivery'])) {
$oTotalPrice->add($this->_aCosts['oxdelivery']->getBruttoPrice());
}
// 2.4 add wrapping price
if (isset($this->_aCosts['oxwrapping'])) {
$oTotalPrice->add($this->_aCosts['oxwrapping']->getBruttoPrice());
}
if (isset($this->_aCosts['oxgiftcard'])) {
$oTotalPrice->add($this->_aCosts['oxgiftcard']->getBruttoPrice());
}
// 2.5 add payment price
if (isset($this->_aCosts['oxpayment'])) {
$oTotalPrice->add($this->_aCosts['oxpayment']->getBruttoPrice());
}
$this->setPrice($oTotalPrice);
} | [
"protected",
"function",
"_calcTotalPrice",
"(",
")",
"{",
"// 1. add products price",
"$",
"dPrice",
"=",
"$",
"this",
"->",
"_dBruttoSum",
";",
"/** @var \\OxidEsales\\Eshop\\Core\\Price $oTotalPrice */",
"$",
"oTotalPrice",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\"... | Performs final sum calculation and rounding. | [
"Performs",
"final",
"sum",
"calculation",
"and",
"rounding",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1011-L1052 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.setVoucherDiscount | public function setVoucherDiscount($dDiscount)
{
$this->_oVoucherDiscount = oxNew(\OxidEsales\Eshop\Core\Price::class);
$this->_oVoucherDiscount->setBruttoPriceMode();
$this->_oVoucherDiscount->add($dDiscount);
} | php | public function setVoucherDiscount($dDiscount)
{
$this->_oVoucherDiscount = oxNew(\OxidEsales\Eshop\Core\Price::class);
$this->_oVoucherDiscount->setBruttoPriceMode();
$this->_oVoucherDiscount->add($dDiscount);
} | [
"public",
"function",
"setVoucherDiscount",
"(",
"$",
"dDiscount",
")",
"{",
"$",
"this",
"->",
"_oVoucherDiscount",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Price",
"::",
"class",
")",
";",
"$",
"this",
"->",
"_oVoucherDi... | Voucher discount setter
@param double $dDiscount voucher discount value | [
"Voucher",
"discount",
"setter"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1059-L1064 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcVoucherDiscount | protected function _calcVoucherDiscount()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_showVouchers') && ($this->_oVoucherDiscount === null || ($this->_blUpdateNeeded && !$this->isAdmin()))) {
$this->_oVoucherDiscount = $this->_getPriceObject();
// calculating price to apply discount
$dPrice = $this->_oDiscountProductsPriceList->getSum($this->isCalculationModeNetto()) - $this->_oTotalDiscount->getPrice();
// recalculating
if (count($this->_aVouchers)) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
foreach ($this->_aVouchers as $sVoucherId => $oStdVoucher) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
try { // checking
$oVoucher->load($oStdVoucher->sVoucherId);
if (!$this->_blSkipVouchersAvailabilityChecking) {
$oVoucher->checkBasketVoucherAvailability($this->_aVouchers, $dPrice);
$oVoucher->checkUserAvailability($this->getBasketUser());
}
// assigning real voucher discount value as this is the only place where real value is calculated
$dVoucherdiscount = $oVoucher->getDiscountValue($dPrice);
if ($dVoucherdiscount > 0) {
$dVatPart = ($dPrice - $dVoucherdiscount) / $dPrice * 100;
if (!$this->_aDiscountedVats) {
if ($oPriceList = $this->getDiscountProductsPrice()) {
$this->_aDiscountedVats = $oPriceList->getVatInfo($this->isCalculationModeNetto());
}
}
// apply discount to vat
foreach ($this->_aDiscountedVats as $sKey => $dVat) {
$this->_aDiscountedVats[$sKey] = \OxidEsales\Eshop\Core\Price::percent($dVat, $dVatPart);
}
}
// accumulating discount value
$this->_oVoucherDiscount->add($dVoucherdiscount);
// collecting formatted for preview
$oStdVoucher->fVoucherdiscount = $oLang->formatCurrency($dVoucherdiscount, $this->getBasketCurrency());
$oStdVoucher->dVoucherdiscount = $dVoucherdiscount;
// subtracting voucher discount
$dPrice = $dPrice - $dVoucherdiscount;
} catch (\OxidEsales\Eshop\Core\Exception\VoucherException $oEx) {
// removing voucher on error
$oVoucher->unMarkAsReserved();
unset($this->_aVouchers[$sVoucherId]);
// storing voucher error info
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true);
}
}
}
}
} | php | protected function _calcVoucherDiscount()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_showVouchers') && ($this->_oVoucherDiscount === null || ($this->_blUpdateNeeded && !$this->isAdmin()))) {
$this->_oVoucherDiscount = $this->_getPriceObject();
// calculating price to apply discount
$dPrice = $this->_oDiscountProductsPriceList->getSum($this->isCalculationModeNetto()) - $this->_oTotalDiscount->getPrice();
// recalculating
if (count($this->_aVouchers)) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
foreach ($this->_aVouchers as $sVoucherId => $oStdVoucher) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
try { // checking
$oVoucher->load($oStdVoucher->sVoucherId);
if (!$this->_blSkipVouchersAvailabilityChecking) {
$oVoucher->checkBasketVoucherAvailability($this->_aVouchers, $dPrice);
$oVoucher->checkUserAvailability($this->getBasketUser());
}
// assigning real voucher discount value as this is the only place where real value is calculated
$dVoucherdiscount = $oVoucher->getDiscountValue($dPrice);
if ($dVoucherdiscount > 0) {
$dVatPart = ($dPrice - $dVoucherdiscount) / $dPrice * 100;
if (!$this->_aDiscountedVats) {
if ($oPriceList = $this->getDiscountProductsPrice()) {
$this->_aDiscountedVats = $oPriceList->getVatInfo($this->isCalculationModeNetto());
}
}
// apply discount to vat
foreach ($this->_aDiscountedVats as $sKey => $dVat) {
$this->_aDiscountedVats[$sKey] = \OxidEsales\Eshop\Core\Price::percent($dVat, $dVatPart);
}
}
// accumulating discount value
$this->_oVoucherDiscount->add($dVoucherdiscount);
// collecting formatted for preview
$oStdVoucher->fVoucherdiscount = $oLang->formatCurrency($dVoucherdiscount, $this->getBasketCurrency());
$oStdVoucher->dVoucherdiscount = $dVoucherdiscount;
// subtracting voucher discount
$dPrice = $dPrice - $dVoucherdiscount;
} catch (\OxidEsales\Eshop\Core\Exception\VoucherException $oEx) {
// removing voucher on error
$oVoucher->unMarkAsReserved();
unset($this->_aVouchers[$sVoucherId]);
// storing voucher error info
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true);
}
}
}
}
} | [
"protected",
"function",
"_calcVoucherDiscount",
"(",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'bl_showVouchers'",
")",
"&&",
"(",
"$",
"this",
"->",
... | Calculates voucher discount | [
"Calculates",
"voucher",
"discount"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1069-L1128 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._applyDiscounts | protected function _applyDiscounts()
{
//apply discounts for brutto price
$dDiscountedSum = $this->_getDiscountedProductsSum();
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$dVatSum = 0;
foreach ($this->_aDiscountedVats as $dVat) {
$dVatSum += $oUtils->fRound($dVat, $this->_oCurrency);
}
$oNotDiscounted = $this->getNotDiscountProductsPrice();
if ($this->isCalculationModeNetto()) {
// netto view mode
$this->setNettoSum($this->getProductsPrice()->getSum());
$this->setBruttoSum($oNotDiscounted->getSum(false) + $dDiscountedSum + $dVatSum);
} else {
// brutto view mode
$this->setNettoSum($oNotDiscounted->getSum() + $dDiscountedSum - $dVatSum);
$this->setBruttoSum($this->getProductsPrice()->getSum(false));
}
} | php | protected function _applyDiscounts()
{
//apply discounts for brutto price
$dDiscountedSum = $this->_getDiscountedProductsSum();
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
$dVatSum = 0;
foreach ($this->_aDiscountedVats as $dVat) {
$dVatSum += $oUtils->fRound($dVat, $this->_oCurrency);
}
$oNotDiscounted = $this->getNotDiscountProductsPrice();
if ($this->isCalculationModeNetto()) {
// netto view mode
$this->setNettoSum($this->getProductsPrice()->getSum());
$this->setBruttoSum($oNotDiscounted->getSum(false) + $dDiscountedSum + $dVatSum);
} else {
// brutto view mode
$this->setNettoSum($oNotDiscounted->getSum() + $dDiscountedSum - $dVatSum);
$this->setBruttoSum($this->getProductsPrice()->getSum(false));
}
} | [
"protected",
"function",
"_applyDiscounts",
"(",
")",
"{",
"//apply discounts for brutto price",
"$",
"dDiscountedSum",
"=",
"$",
"this",
"->",
"_getDiscountedProductsSum",
"(",
")",
";",
"$",
"oUtils",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
... | Performs netto price and VATs calculations including discounts and vouchers. | [
"Performs",
"netto",
"price",
"and",
"VATs",
"calculations",
"including",
"discounts",
"and",
"vouchers",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1133-L1155 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.isPriceViewModeNetto | public function isPriceViewModeNetto()
{
$blResult = (bool) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blShowNetPrice');
$oUser = $this->getBasketUser();
if ($oUser) {
$blResult = $oUser->isPriceViewModeNetto();
}
return $blResult;
} | php | public function isPriceViewModeNetto()
{
$blResult = (bool) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blShowNetPrice');
$oUser = $this->getBasketUser();
if ($oUser) {
$blResult = $oUser->isPriceViewModeNetto();
}
return $blResult;
} | [
"public",
"function",
"isPriceViewModeNetto",
"(",
")",
"{",
"$",
"blResult",
"=",
"(",
"bool",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'blShowNetPrice'",
")",
";",
... | Returns true if view mode is netto
@return bool | [
"Returns",
"true",
"if",
"view",
"mode",
"is",
"netto"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1162-L1171 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._getPriceObject | protected function _getPriceObject()
{
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
if ($this->isCalculationModeNetto()) {
$oPrice->setNettoPriceMode();
} else {
$oPrice->setBruttoPriceMode();
}
return $oPrice;
} | php | protected function _getPriceObject()
{
$oPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
if ($this->isCalculationModeNetto()) {
$oPrice->setNettoPriceMode();
} else {
$oPrice->setBruttoPriceMode();
}
return $oPrice;
} | [
"protected",
"function",
"_getPriceObject",
"(",
")",
"{",
"$",
"oPrice",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Price",
"::",
"class",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isCalculationModeNetto",
"(",
")",
")",
... | Returns prepared price object depending on view mode
@return \OxidEsales\Eshop\Core\Price | [
"Returns",
"prepared",
"price",
"object",
"depending",
"on",
"view",
"mode"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1178-L1189 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcBasketDiscount | protected function _calcBasketDiscount()
{
// resetting
$this->_aDiscounts = [];
// P using prices sum which has discount, not sum of skipped discounts
$dOldPrice = $this->_oDiscountProductsPriceList->getSum($this->isCalculationModeNetto());
// add basket discounts
if ($this->_oTotalDiscount !== null && isset($this->_isForOrderRecalculation) && $this->_isForOrderRecalculation) {
//if total discount was set on order recalculation
$oTotalPrice = $this->getTotalDiscount();
$oDiscount = oxNew(\OxidEsales\Eshop\Application\Model\Discount::class);
$oDiscount->oxdiscount__oxaddsum = new \OxidEsales\Eshop\Core\Field($oTotalPrice->getPrice());
$oDiscount->oxdiscount__oxaddsumtype = new \OxidEsales\Eshop\Core\Field('abs');
$aDiscounts[] = $oDiscount;
} else {
// discounts for basket
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketDiscounts($this, $this->getBasketUser());
}
if ($oPriceList = $this->getDiscountProductsPrice()) {
$this->_aDiscountedVats = $oPriceList->getVatInfo($this->isCalculationModeNetto());
}
/** @var \oxDiscount $oDiscount */
foreach ($aDiscounts as $oDiscount) {
// storing applied discounts
$oStdDiscount = $oDiscount->getSimpleDiscount();
// skipping bundle discounts
if ($oDiscount->oxdiscount__oxaddsumtype->value == 'itm') {
continue;
}
// saving discount info
$oStdDiscount->dDiscount = $oDiscount->getAbsValue($dOldPrice);
$dVatPart = 100 - $oDiscount->getPercentage($dOldPrice);
// if discount is more than basket sum
if ($dOldPrice < $oStdDiscount->dDiscount) {
$oStdDiscount->dDiscount = $dOldPrice;
$dVatPart = 0;
}
// apply discount to vat
foreach ($this->_aDiscountedVats as $sKey => $dVat) {
$this->_aDiscountedVats[$sKey] = \OxidEsales\Eshop\Core\Price::percent($dVat, $dVatPart);
}
//storing discount
if ($oStdDiscount->dDiscount != 0) {
$this->_aDiscounts[$oDiscount->getId()] = $oStdDiscount;
// subtracting product price after discount
$dOldPrice = $dOldPrice - $oStdDiscount->dDiscount;
}
}
} | php | protected function _calcBasketDiscount()
{
// resetting
$this->_aDiscounts = [];
// P using prices sum which has discount, not sum of skipped discounts
$dOldPrice = $this->_oDiscountProductsPriceList->getSum($this->isCalculationModeNetto());
// add basket discounts
if ($this->_oTotalDiscount !== null && isset($this->_isForOrderRecalculation) && $this->_isForOrderRecalculation) {
//if total discount was set on order recalculation
$oTotalPrice = $this->getTotalDiscount();
$oDiscount = oxNew(\OxidEsales\Eshop\Application\Model\Discount::class);
$oDiscount->oxdiscount__oxaddsum = new \OxidEsales\Eshop\Core\Field($oTotalPrice->getPrice());
$oDiscount->oxdiscount__oxaddsumtype = new \OxidEsales\Eshop\Core\Field('abs');
$aDiscounts[] = $oDiscount;
} else {
// discounts for basket
$aDiscounts = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DiscountList::class)->getBasketDiscounts($this, $this->getBasketUser());
}
if ($oPriceList = $this->getDiscountProductsPrice()) {
$this->_aDiscountedVats = $oPriceList->getVatInfo($this->isCalculationModeNetto());
}
/** @var \oxDiscount $oDiscount */
foreach ($aDiscounts as $oDiscount) {
// storing applied discounts
$oStdDiscount = $oDiscount->getSimpleDiscount();
// skipping bundle discounts
if ($oDiscount->oxdiscount__oxaddsumtype->value == 'itm') {
continue;
}
// saving discount info
$oStdDiscount->dDiscount = $oDiscount->getAbsValue($dOldPrice);
$dVatPart = 100 - $oDiscount->getPercentage($dOldPrice);
// if discount is more than basket sum
if ($dOldPrice < $oStdDiscount->dDiscount) {
$oStdDiscount->dDiscount = $dOldPrice;
$dVatPart = 0;
}
// apply discount to vat
foreach ($this->_aDiscountedVats as $sKey => $dVat) {
$this->_aDiscountedVats[$sKey] = \OxidEsales\Eshop\Core\Price::percent($dVat, $dVatPart);
}
//storing discount
if ($oStdDiscount->dDiscount != 0) {
$this->_aDiscounts[$oDiscount->getId()] = $oStdDiscount;
// subtracting product price after discount
$dOldPrice = $dOldPrice - $oStdDiscount->dDiscount;
}
}
} | [
"protected",
"function",
"_calcBasketDiscount",
"(",
")",
"{",
"// resetting",
"$",
"this",
"->",
"_aDiscounts",
"=",
"[",
"]",
";",
"// P using prices sum which has discount, not sum of skipped discounts",
"$",
"dOldPrice",
"=",
"$",
"this",
"->",
"_oDiscountProductsPric... | Loads basket discounts and calculates discount values. | [
"Loads",
"basket",
"discounts",
"and",
"calculates",
"discount",
"values",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1194-L1252 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcBasketTotalDiscount | protected function _calcBasketTotalDiscount()
{
if ($this->_oTotalDiscount === null || (!$this->isAdmin())) {
$this->_oTotalDiscount = $this->_getPriceObject();
if (is_array($this->_aDiscounts)) {
foreach ($this->_aDiscounts as $oDiscount) {
// skipping bundle discounts
if ($oDiscount->sType == 'itm') {
continue;
}
// add discount value to total basket discount
$this->_oTotalDiscount->add($oDiscount->dDiscount);
}
}
}
} | php | protected function _calcBasketTotalDiscount()
{
if ($this->_oTotalDiscount === null || (!$this->isAdmin())) {
$this->_oTotalDiscount = $this->_getPriceObject();
if (is_array($this->_aDiscounts)) {
foreach ($this->_aDiscounts as $oDiscount) {
// skipping bundle discounts
if ($oDiscount->sType == 'itm') {
continue;
}
// add discount value to total basket discount
$this->_oTotalDiscount->add($oDiscount->dDiscount);
}
}
}
} | [
"protected",
"function",
"_calcBasketTotalDiscount",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_oTotalDiscount",
"===",
"null",
"||",
"(",
"!",
"$",
"this",
"->",
"isAdmin",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"_oTotalDiscount",
"=",
"$",
"... | Calculates total basket discount value. | [
"Calculates",
"total",
"basket",
"discount",
"value",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1257-L1274 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._calcPaymentCost | protected function _calcPaymentCost()
{
// resetting values
$oPaymentPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
// payment
if (($this->_sPaymentId = $this->getPaymentId())) {
$oPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$oPayment->load($this->_sPaymentId);
$oPayment->calculate($this);
$oPaymentPrice = $oPayment->getPrice();
}
return $oPaymentPrice;
} | php | protected function _calcPaymentCost()
{
// resetting values
$oPaymentPrice = oxNew(\OxidEsales\Eshop\Core\Price::class);
// payment
if (($this->_sPaymentId = $this->getPaymentId())) {
$oPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$oPayment->load($this->_sPaymentId);
$oPayment->calculate($this);
$oPaymentPrice = $oPayment->getPrice();
}
return $oPaymentPrice;
} | [
"protected",
"function",
"_calcPaymentCost",
"(",
")",
"{",
"// resetting values",
"$",
"oPaymentPrice",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Price",
"::",
"class",
")",
";",
"// payment",
"if",
"(",
"(",
"$",
"this",
... | Payment cost calculation, applying payment discount if available.
@return \OxidEsales\Eshop\Core\Price | [
"Payment",
"cost",
"calculation",
"applying",
"payment",
"discount",
"if",
"available",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1340-L1355 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.calculateBasket | public function calculateBasket($blForceUpdate = false)
{
/*
//would be good to perform the reset of previous calculation
//at least you can use it for the debug
$this->_aDiscounts = array();
$this->_aItemDiscounts = array();
$this->_oTotalDiscount = null;
$this->_dDiscountedProductNettoPrice = 0;
$this->_aDiscountedVats = array();
$this->_oPrice = null;
$this->_oNotDiscountedProductsPriceList = null;
$this->_oProductsPriceList = null;
$this->_oDiscountProductsPriceList = null;*/
if (!$this->isEnabled()) {
return;
}
if ($blForceUpdate) {
$this->onUpdate();
}
if (!($this->_blUpdateNeeded || $blForceUpdate)) {
return;
}
$this->_aCosts = [];
// 1. saving basket to the database
$this->_save();
// 2. remove all bundles
$this->_clearBundles();
// 3. generate bundle items
$this->_addBundles();
// 4. calculating item prices
$this->_calcItemsPrice();
// 5. calculating/applying discounts
$this->_calcBasketDiscount();
// 6. calculating basket total discount
$this->_calcBasketTotalDiscount();
// 7. check for vouchers
$this->_calcVoucherDiscount();
// 8. applies all discounts to pricelist
$this->_applyDiscounts();
// 9. calculating additional costs:
// 9.1: delivery
$this->setCost('oxdelivery', $this->_calcDeliveryCost());
// 9.2: adding wrapping and gift card costs
$this->setCost('oxwrapping', $this->_calcBasketWrapping());
$this->setCost('oxgiftcard', $this->_calcBasketGiftCard());
// 9.3: adding payment cost
$this->setCost('oxpayment', $this->_calcPaymentCost());
// 10. calculate total price
$this->_calcTotalPrice();
// 11. formatting discounts
$this->formatDiscount();
// 12.setting to up-to-date status
$this->afterUpdate();
} | php | public function calculateBasket($blForceUpdate = false)
{
/*
//would be good to perform the reset of previous calculation
//at least you can use it for the debug
$this->_aDiscounts = array();
$this->_aItemDiscounts = array();
$this->_oTotalDiscount = null;
$this->_dDiscountedProductNettoPrice = 0;
$this->_aDiscountedVats = array();
$this->_oPrice = null;
$this->_oNotDiscountedProductsPriceList = null;
$this->_oProductsPriceList = null;
$this->_oDiscountProductsPriceList = null;*/
if (!$this->isEnabled()) {
return;
}
if ($blForceUpdate) {
$this->onUpdate();
}
if (!($this->_blUpdateNeeded || $blForceUpdate)) {
return;
}
$this->_aCosts = [];
// 1. saving basket to the database
$this->_save();
// 2. remove all bundles
$this->_clearBundles();
// 3. generate bundle items
$this->_addBundles();
// 4. calculating item prices
$this->_calcItemsPrice();
// 5. calculating/applying discounts
$this->_calcBasketDiscount();
// 6. calculating basket total discount
$this->_calcBasketTotalDiscount();
// 7. check for vouchers
$this->_calcVoucherDiscount();
// 8. applies all discounts to pricelist
$this->_applyDiscounts();
// 9. calculating additional costs:
// 9.1: delivery
$this->setCost('oxdelivery', $this->_calcDeliveryCost());
// 9.2: adding wrapping and gift card costs
$this->setCost('oxwrapping', $this->_calcBasketWrapping());
$this->setCost('oxgiftcard', $this->_calcBasketGiftCard());
// 9.3: adding payment cost
$this->setCost('oxpayment', $this->_calcPaymentCost());
// 10. calculate total price
$this->_calcTotalPrice();
// 11. formatting discounts
$this->formatDiscount();
// 12.setting to up-to-date status
$this->afterUpdate();
} | [
"public",
"function",
"calculateBasket",
"(",
"$",
"blForceUpdate",
"=",
"false",
")",
"{",
"/*\n //would be good to perform the reset of previous calculation\n //at least you can use it for the debug\n $this->_aDiscounts = array();\n $this->_aItemDiscounts = array();... | Executes all needed functions to calculate basket price and other needed
info
@param bool $blForceUpdate set this parameter to TRUE to force basket recalculation
@return null | [
"Executes",
"all",
"needed",
"functions",
"to",
"calculate",
"basket",
"price",
"and",
"other",
"needed",
"info"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1376-L1449 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.removeVoucher | public function removeVoucher($sVoucherId)
{
// removing if it exists
if (isset($this->_aVouchers[$sVoucherId])) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oVoucher->load($sVoucherId);
$oVoucher->unMarkAsReserved();
// unset it if exists this voucher in DB or not
unset($this->_aVouchers[$sVoucherId]);
$this->onUpdate();
}
} | php | public function removeVoucher($sVoucherId)
{
// removing if it exists
if (isset($this->_aVouchers[$sVoucherId])) {
$oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
$oVoucher->load($sVoucherId);
$oVoucher->unMarkAsReserved();
// unset it if exists this voucher in DB or not
unset($this->_aVouchers[$sVoucherId]);
$this->onUpdate();
}
} | [
"public",
"function",
"removeVoucher",
"(",
"$",
"sVoucherId",
")",
"{",
"// removing if it exists",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_aVouchers",
"[",
"$",
"sVoucherId",
"]",
")",
")",
"{",
"$",
"oVoucher",
"=",
"oxNew",
"(",
"\\",
"OxidEsales... | Removes voucher from basket and unreserved it.
@param string $sVoucherId removable voucher ID | [
"Removes",
"voucher",
"from",
"basket",
"and",
"unreserved",
"it",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1589-L1602 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.load | public function load()
{
$oUser = $this->getBasketUser();
if (!$oUser) {
return;
}
$oBasket = $oUser->getBasket('savedbasket');
// restoring from saved history
$aSavedItems = $oBasket->getItems();
foreach ($aSavedItems as $oItem) {
try {
$oSelList = $oItem->getSelList();
$this->addToBasket($oItem->oxuserbasketitems__oxartid->value, $oItem->oxuserbasketitems__oxamount->value, $oSelList, $oItem->getPersParams(), true);
} catch (\OxidEsales\Eshop\Core\Exception\ArticleException $oEx) {
// caught and ignored
}
}
} | php | public function load()
{
$oUser = $this->getBasketUser();
if (!$oUser) {
return;
}
$oBasket = $oUser->getBasket('savedbasket');
// restoring from saved history
$aSavedItems = $oBasket->getItems();
foreach ($aSavedItems as $oItem) {
try {
$oSelList = $oItem->getSelList();
$this->addToBasket($oItem->oxuserbasketitems__oxartid->value, $oItem->oxuserbasketitems__oxamount->value, $oSelList, $oItem->getPersParams(), true);
} catch (\OxidEsales\Eshop\Core\Exception\ArticleException $oEx) {
// caught and ignored
}
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getBasketUser",
"(",
")",
";",
"if",
"(",
"!",
"$",
"oUser",
")",
"{",
"return",
";",
"}",
"$",
"oBasket",
"=",
"$",
"oUser",
"->",
"getBasket",
"(",
"'savedbasket'... | Populates current basket from the saved one.
@return null | [
"Populates",
"current",
"basket",
"from",
"the",
"saved",
"one",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1646-L1666 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._save | protected function _save()
{
if ($this->isSaveToDataBaseEnabled()) {
if ($oUser = $this->getBasketUser()) {
//first delete all contents
//#2039
$oSavedBasket = $oUser->getBasket('savedbasket');
$oSavedBasket->delete();
//then save
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $oBasketItem) {
// discount or bundled products will be added automatically if available
if (!$oBasketItem->isBundle() && !$oBasketItem->isDiscountArticle()) {
$oSavedBasket->addItemToBasket($oBasketItem->getProductId(), $oBasketItem->getAmount(), $oBasketItem->getSelList(), true, $oBasketItem->getPersParams());
}
}
}
}
} | php | protected function _save()
{
if ($this->isSaveToDataBaseEnabled()) {
if ($oUser = $this->getBasketUser()) {
//first delete all contents
//#2039
$oSavedBasket = $oUser->getBasket('savedbasket');
$oSavedBasket->delete();
//then save
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $oBasketItem) {
// discount or bundled products will be added automatically if available
if (!$oBasketItem->isBundle() && !$oBasketItem->isDiscountArticle()) {
$oSavedBasket->addItemToBasket($oBasketItem->getProductId(), $oBasketItem->getAmount(), $oBasketItem->getSelList(), true, $oBasketItem->getPersParams());
}
}
}
}
} | [
"protected",
"function",
"_save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSaveToDataBaseEnabled",
"(",
")",
")",
"{",
"if",
"(",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getBasketUser",
"(",
")",
")",
"{",
"//first delete all contents",
"//#2039",
... | Saves existing basket to database | [
"Saves",
"existing",
"basket",
"to",
"database"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1671-L1690 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket._findDelivCountry | protected function _findDelivCountry()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = $this->getBasketUser();
$sDeliveryCountry = null;
if (!$oUser) {
// don't calculate if not logged in unless specified otherwise
$aHomeCountry = $myConfig->getConfigParam('aHomeCountry');
if ($myConfig->getConfigParam('blCalculateDelCostIfNotLoggedIn') && is_array($aHomeCountry)) {
$sDeliveryCountry = current($aHomeCountry);
}
} else {
// ok, logged in
if ($sCountryId = $myConfig->getGlobalParameter('delcountryid')) {
$sDeliveryCountry = $sCountryId;
} elseif ($sAddressId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('deladrid')) {
$oDeliveryAddress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
if ($oDeliveryAddress->load($sAddressId)) {
$sDeliveryCountry = $oDeliveryAddress->oxaddress__oxcountryid->value;
}
}
// still not found ?
if (!$sDeliveryCountry) {
$sDeliveryCountry = $oUser->oxuser__oxcountryid->value;
}
}
return $sDeliveryCountry;
} | php | protected function _findDelivCountry()
{
$myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
$oUser = $this->getBasketUser();
$sDeliveryCountry = null;
if (!$oUser) {
// don't calculate if not logged in unless specified otherwise
$aHomeCountry = $myConfig->getConfigParam('aHomeCountry');
if ($myConfig->getConfigParam('blCalculateDelCostIfNotLoggedIn') && is_array($aHomeCountry)) {
$sDeliveryCountry = current($aHomeCountry);
}
} else {
// ok, logged in
if ($sCountryId = $myConfig->getGlobalParameter('delcountryid')) {
$sDeliveryCountry = $sCountryId;
} elseif ($sAddressId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('deladrid')) {
$oDeliveryAddress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
if ($oDeliveryAddress->load($sAddressId)) {
$sDeliveryCountry = $oDeliveryAddress->oxaddress__oxcountryid->value;
}
}
// still not found ?
if (!$sDeliveryCountry) {
$sDeliveryCountry = $oUser->oxuser__oxcountryid->value;
}
}
return $sDeliveryCountry;
} | [
"protected",
"function",
"_findDelivCountry",
"(",
")",
"{",
"$",
"myConfig",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"oUser",
"=",
"$",
"this",
"->",
"getBasketUser",
"(",
")",
";",
... | Tries to fetch user delivery country ID
@return string | [
"Tries",
"to",
"fetch",
"user",
"delivery",
"country",
"ID"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1715-L1746 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.deleteBasket | public function deleteBasket()
{
$this->_aBasketContents = [];
$this->getSession()->delBasket();
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPsBasketReservationEnabled')) {
$this->getSession()->getBasketReservations()->discardReservations();
}
// merging basket history
$this->_deleteSavedBasket();
} | php | public function deleteBasket()
{
$this->_aBasketContents = [];
$this->getSession()->delBasket();
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blPsBasketReservationEnabled')) {
$this->getSession()->getBasketReservations()->discardReservations();
}
// merging basket history
$this->_deleteSavedBasket();
} | [
"public",
"function",
"deleteBasket",
"(",
")",
"{",
"$",
"this",
"->",
"_aBasketContents",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"delBasket",
"(",
")",
";",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"... | Deletes user basket object from session | [
"Deletes",
"user",
"basket",
"object",
"from",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1751-L1762 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getPaymentId | public function getPaymentId()
{
if (!$this->_sPaymentId) {
$this->_sPaymentId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('paymentid');
}
return $this->_sPaymentId;
} | php | public function getPaymentId()
{
if (!$this->_sPaymentId) {
$this->_sPaymentId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('paymentid');
}
return $this->_sPaymentId;
} | [
"public",
"function",
"getPaymentId",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sPaymentId",
")",
"{",
"$",
"this",
"->",
"_sPaymentId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->... | Get basket payment, if payment id is not set, try to get it from session
@return string | [
"Get",
"basket",
"payment",
"if",
"payment",
"id",
"is",
"not",
"set",
"try",
"to",
"get",
"it",
"from",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1779-L1786 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.setShipping | public function setShipping($sShippingSetId = null)
{
$this->_sShippingSetId = $sShippingSetId;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sShipSet', $sShippingSetId);
} | php | public function setShipping($sShippingSetId = null)
{
$this->_sShippingSetId = $sShippingSetId;
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sShipSet', $sShippingSetId);
} | [
"public",
"function",
"setShipping",
"(",
"$",
"sShippingSetId",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_sShippingSetId",
"=",
"$",
"sShippingSetId",
";",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
... | Set basket shipping set ID
@param string $sShippingSetId delivery set id | [
"Set",
"basket",
"shipping",
"set",
"ID"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1793-L1797 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getShippingId | public function getShippingId()
{
if (!$this->_sShippingSetId) {
$this->_sShippingSetId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('sShipSet');
}
$sActPaymentId = $this->getPaymentId();
// setting default if none is set
if (!$this->_sShippingSetId && $sActPaymentId != 'oxempty') {
$oUser = $this->getUser();
// choosing first preferred delivery set
list(, $sActShipSet) = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliverySetList::class)->getDeliverySetData(null, $oUser, $this);
// in case nothing was found and no user set - choosing default
$this->_sShippingSetId = $sActShipSet ? $sActShipSet : ($oUser ? null : 'oxidstandard');
} elseif (!$this->isAdmin() && $sActPaymentId == 'oxempty') {
// in case 'oxempty' is payment id - delivery set must be reset
$this->_sShippingSetId = null;
}
return $this->_sShippingSetId;
} | php | public function getShippingId()
{
if (!$this->_sShippingSetId) {
$this->_sShippingSetId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('sShipSet');
}
$sActPaymentId = $this->getPaymentId();
// setting default if none is set
if (!$this->_sShippingSetId && $sActPaymentId != 'oxempty') {
$oUser = $this->getUser();
// choosing first preferred delivery set
list(, $sActShipSet) = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\DeliverySetList::class)->getDeliverySetData(null, $oUser, $this);
// in case nothing was found and no user set - choosing default
$this->_sShippingSetId = $sActShipSet ? $sActShipSet : ($oUser ? null : 'oxidstandard');
} elseif (!$this->isAdmin() && $sActPaymentId == 'oxempty') {
// in case 'oxempty' is payment id - delivery set must be reset
$this->_sShippingSetId = null;
}
return $this->_sShippingSetId;
} | [
"public",
"function",
"getShippingId",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sShippingSetId",
")",
"{",
"$",
"this",
"->",
"_sShippingSetId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
"... | Get basket shipping set, if shipping set id is not set, try to get it from session
@return string oxDeliverySet | [
"Get",
"basket",
"shipping",
"set",
"if",
"shipping",
"set",
"id",
"is",
"not",
"set",
"try",
"to",
"get",
"it",
"from",
"session"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1814-L1835 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getBasketArticles | public function getBasketArticles()
{
$aBasketArticles = [];
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $sItemKey => $oBasketItem) {
try {
$oProduct = $oBasketItem->getArticle(true);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadSelectLists')) {
// marking chosen select list
$aSelList = $oBasketItem->getSelList();
if (is_array($aSelList) && ($aSelectlist = $oProduct->getSelectLists($sItemKey))) {
reset($aSelList);
foreach ($aSelList as $conkey => $iSel) {
$aSelectlist[$conkey][$iSel]->selected = 1;
}
$oProduct->setSelectlist($aSelectlist);
}
}
} catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $oEx) {
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
$this->removeItem($sItemKey);
$this->calculateBasket(true);
continue;
} catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx) {
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
$this->removeItem($sItemKey);
$this->calculateBasket(true);
continue;
}
$aBasketArticles[$sItemKey] = $oProduct;
}
return $aBasketArticles;
} | php | public function getBasketArticles()
{
$aBasketArticles = [];
/** @var \oxBasketItem $oBasketItem */
foreach ($this->_aBasketContents as $sItemKey => $oBasketItem) {
try {
$oProduct = $oBasketItem->getArticle(true);
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadSelectLists')) {
// marking chosen select list
$aSelList = $oBasketItem->getSelList();
if (is_array($aSelList) && ($aSelectlist = $oProduct->getSelectLists($sItemKey))) {
reset($aSelList);
foreach ($aSelList as $conkey => $iSel) {
$aSelectlist[$conkey][$iSel]->selected = 1;
}
$oProduct->setSelectlist($aSelectlist);
}
}
} catch (\OxidEsales\Eshop\Core\Exception\NoArticleException $oEx) {
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
$this->removeItem($sItemKey);
$this->calculateBasket(true);
continue;
} catch (\OxidEsales\Eshop\Core\Exception\ArticleInputException $oEx) {
\OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx);
$this->removeItem($sItemKey);
$this->calculateBasket(true);
continue;
}
$aBasketArticles[$sItemKey] = $oProduct;
}
return $aBasketArticles;
} | [
"public",
"function",
"getBasketArticles",
"(",
")",
"{",
"$",
"aBasketArticles",
"=",
"[",
"]",
";",
"/** @var \\oxBasketItem $oBasketItem */",
"foreach",
"(",
"$",
"this",
"->",
"_aBasketContents",
"as",
"$",
"sItemKey",
"=>",
"$",
"oBasketItem",
")",
"{",
"tr... | Returns array of basket oxarticle objects
@return array | [
"Returns",
"array",
"of",
"basket",
"oxarticle",
"objects"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1842-L1877 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getProductsPrice | public function getProductsPrice()
{
if (is_null($this->_oProductsPriceList)) {
$this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
}
return $this->_oProductsPriceList;
} | php | public function getProductsPrice()
{
if (is_null($this->_oProductsPriceList)) {
$this->_oProductsPriceList = oxNew(\OxidEsales\Eshop\Core\PriceList::class);
}
return $this->_oProductsPriceList;
} | [
"public",
"function",
"getProductsPrice",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_oProductsPriceList",
")",
")",
"{",
"$",
"this",
"->",
"_oProductsPriceList",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",... | Returns basket products price list object
@return \OxidEsales\Eshop\Core\PriceList | [
"Returns",
"basket",
"products",
"price",
"list",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1894-L1901 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getPrice | public function getPrice()
{
if (is_null($this->_oPrice)) {
/** @var \OxidEsales\Eshop\Core\Price $price */
$price = oxNew(\OxidEsales\Eshop\Core\Price::class);
$this->setPrice($price);
}
return $this->_oPrice;
} | php | public function getPrice()
{
if (is_null($this->_oPrice)) {
/** @var \OxidEsales\Eshop\Core\Price $price */
$price = oxNew(\OxidEsales\Eshop\Core\Price::class);
$this->setPrice($price);
}
return $this->_oPrice;
} | [
"public",
"function",
"getPrice",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_oPrice",
")",
")",
"{",
"/** @var \\OxidEsales\\Eshop\\Core\\Price $price */",
"$",
"price",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
... | Returns basket price object
@return \OxidEsales\Eshop\Core\Price | [
"Returns",
"basket",
"price",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1908-L1917 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getCosts | public function getCosts($sId = null)
{
// if user want some specific cost - return it
if ($sId) {
return isset($this->_aCosts[$sId]) ? $this->_aCosts[$sId] : null;
}
return $this->_aCosts;
} | php | public function getCosts($sId = null)
{
// if user want some specific cost - return it
if ($sId) {
return isset($this->_aCosts[$sId]) ? $this->_aCosts[$sId] : null;
}
return $this->_aCosts;
} | [
"public",
"function",
"getCosts",
"(",
"$",
"sId",
"=",
"null",
")",
"{",
"// if user want some specific cost - return it",
"if",
"(",
"$",
"sId",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_aCosts",
"[",
"$",
"sId",
"]",
")",
"?",
"$",
"this"... | Returns array of basket costs. By passing cost identifier method will return
this cost if available
@param string $sId cost id ( optional )
@return array|\OxidEsales\Eshop\Core\Price|null | [
"Returns",
"array",
"of",
"basket",
"costs",
".",
"By",
"passing",
"cost",
"identifier",
"method",
"will",
"return",
"this",
"cost",
"if",
"available"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1959-L1967 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getItemsCount | public function getItemsCount()
{
$itemsCount = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
$itemsCount += $oBasketItem->getAmount();
}
return $itemsCount;
} | php | public function getItemsCount()
{
$itemsCount = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
$itemsCount += $oBasketItem->getAmount();
}
return $itemsCount;
} | [
"public",
"function",
"getItemsCount",
"(",
")",
"{",
"$",
"itemsCount",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"_aBasketContents",
"as",
"$",
"oBasketItem",
")",
"{",
"$",
"itemsCount",
"+=",
"$",
"oBasketItem",
"->",
"getAmount",
"(",
")",
"... | Returns count of items stored in basket.
@return double | [
"Returns",
"count",
"of",
"items",
"stored",
"in",
"basket",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L1994-L2003 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getWeight | public function getWeight()
{
$weight = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
$weight += $oBasketItem->getWeight();
}
return $weight;
} | php | public function getWeight()
{
$weight = 0;
foreach ($this->_aBasketContents as $oBasketItem) {
$weight += $oBasketItem->getWeight();
}
return $weight;
} | [
"public",
"function",
"getWeight",
"(",
")",
"{",
"$",
"weight",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"_aBasketContents",
"as",
"$",
"oBasketItem",
")",
"{",
"$",
"weight",
"+=",
"$",
"oBasketItem",
"->",
"getWeight",
"(",
")",
";",
"}",
... | Returns total basket weight.
@return double | [
"Returns",
"total",
"basket",
"weight",
"."
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L2010-L2019 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getProductVats | public function getProductVats($blFormatCurrency = true)
{
if (!$this->_oNotDiscountedProductsPriceList) {
return [];
}
$aVats = $this->_oNotDiscountedProductsPriceList->getVatInfo($this->isCalculationModeNetto());
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
foreach ((array)$this->_aDiscountedVats as $sKey => $dVat) {
if (!isset($aVats[$sKey])) {
$aVats[$sKey] = 0;
}
// add prices of the same discounts
$aVats[$sKey] += $oUtils->fRound($dVat, $this->_oCurrency);
}
if ($blFormatCurrency) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
foreach ($aVats as $sKey => $dVat) {
$aVats[$sKey] = $oLang->formatCurrency($dVat, $this->getBasketCurrency());
}
}
return $aVats;
} | php | public function getProductVats($blFormatCurrency = true)
{
if (!$this->_oNotDiscountedProductsPriceList) {
return [];
}
$aVats = $this->_oNotDiscountedProductsPriceList->getVatInfo($this->isCalculationModeNetto());
$oUtils = \OxidEsales\Eshop\Core\Registry::getUtils();
foreach ((array)$this->_aDiscountedVats as $sKey => $dVat) {
if (!isset($aVats[$sKey])) {
$aVats[$sKey] = 0;
}
// add prices of the same discounts
$aVats[$sKey] += $oUtils->fRound($dVat, $this->_oCurrency);
}
if ($blFormatCurrency) {
$oLang = \OxidEsales\Eshop\Core\Registry::getLang();
foreach ($aVats as $sKey => $dVat) {
$aVats[$sKey] = $oLang->formatCurrency($dVat, $this->getBasketCurrency());
}
}
return $aVats;
} | [
"public",
"function",
"getProductVats",
"(",
"$",
"blFormatCurrency",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_oNotDiscountedProductsPriceList",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"aVats",
"=",
"$",
"this",
"->",
"_oNotDiscount... | Returns array of plain of formatted VATs which were calculated for basket
@param bool $blFormatCurrency enables currency formatting
@return array | [
"Returns",
"array",
"of",
"plain",
"of",
"formatted",
"VATs",
"which",
"were",
"calculated",
"for",
"basket"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L2038-L2063 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getDiscounts | public function getDiscounts()
{
if ($this->getTotalDiscount() && $this->getTotalDiscount()->getBruttoPrice() == 0 && count($this->_aItemDiscounts) == 0) {
return [];
}
return array_merge($this->_aItemDiscounts, $this->_aDiscounts);
} | php | public function getDiscounts()
{
if ($this->getTotalDiscount() && $this->getTotalDiscount()->getBruttoPrice() == 0 && count($this->_aItemDiscounts) == 0) {
return [];
}
return array_merge($this->_aItemDiscounts, $this->_aDiscounts);
} | [
"public",
"function",
"getDiscounts",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getTotalDiscount",
"(",
")",
"&&",
"$",
"this",
"->",
"getTotalDiscount",
"(",
")",
"->",
"getBruttoPrice",
"(",
")",
"==",
"0",
"&&",
"count",
"(",
"$",
"this",
"->",
... | Returns applied discount information array
@return array | [
"Returns",
"applied",
"discount",
"information",
"array"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L2137-L2144 | train |
OXID-eSales/oxideshop_ce | source/Application/Model/Basket.php | Basket.getVoucherDiscount | public function getVoucherDiscount()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_showVouchers')) {
return $this->_oVoucherDiscount;
}
return null;
} | php | public function getVoucherDiscount()
{
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_showVouchers')) {
return $this->_oVoucherDiscount;
}
return null;
} | [
"public",
"function",
"getVoucherDiscount",
"(",
")",
"{",
"if",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'bl_showVouchers'",
")",
")",
"{",
"return",
"$",
"this",
"-... | Returns basket voucher discount price object
@return \OxidEsales\Eshop\Core\Price | [
"Returns",
"basket",
"voucher",
"discount",
"price",
"object"
] | acd72f4a7c5c7340d70b191e081e4a24b74887cc | https://github.com/OXID-eSales/oxideshop_ce/blob/acd72f4a7c5c7340d70b191e081e4a24b74887cc/source/Application/Model/Basket.php#L2151-L2158 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.