54 $sUserId = $oUser ? $oUser->getId() :
'';
56 if ($this->_blReload || $sUserId !== $this->_sUserId) {
61 $this->_blReload =
false;
62 $this->_sUserId = $sUserId;
82 $sCountryId = $oUser->getActiveCountry();
93 $this->_blReload =
true;
107 $sTable = $oBaseObject->getViewName();
108 $sQ =
"select " . $oBaseObject->getSelectFields() .
" from $sTable ";
109 $sQ .=
"where " . $oBaseObject->getSqlActiveSnippet() .
' ';
122 $sUserId = $oUser->getId();
125 foreach ($oUser->getUserGroups() as $oGroup) {
129 $sGroupIds .= $oDb->quote($oGroup->getId());
133 $sUserTable = getViewName(
'oxuser');
134 $sGroupTable = getViewName(
'oxgroups');
135 $sCountryTable = getViewName(
'oxcountry');
137 $sCountrySql = $sCountryId ?
"EXISTS(select oxobject2discount.oxid from oxobject2discount where oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxcountry' and oxobject2discount.OXOBJECTID=" . $oDb->quote($sCountryId) .
")" :
'0';
138 $sUserSql = $sUserId ?
"EXISTS(select oxobject2discount.oxid from oxobject2discount where oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxuser' and oxobject2discount.OXOBJECTID=" . $oDb->quote($sUserId) .
")" :
'0';
139 $sGroupSql = $sGroupIds ?
"EXISTS(select oxobject2discount.oxid from oxobject2discount where oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxgroups' and oxobject2discount.OXOBJECTID in ($sGroupIds) )" :
'0';
143 if(EXISTS(select 1 from oxobject2discount, $sCountryTable where $sCountryTable.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxcountry' LIMIT 1),
146 if(EXISTS(select 1 from oxobject2discount, $sUserTable where $sUserTable.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxuser' LIMIT 1),
149 if(EXISTS(select 1 from oxobject2discount, $sGroupTable where $sGroupTable.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=$sTable.OXID and oxobject2discount.oxtype='oxgroups' LIMIT 1),
168 $aDiscList = $this->
_getList($oUser)->getArray();
169 foreach ($aDiscList as $oDiscount) {
170 if ($oDiscount->isForArticle($oArticle)) {
171 $aList[$oDiscount->getId()] = $oDiscount;
190 $aDiscList = $this->
_getList($oUser)->getArray();
191 foreach ($aDiscList as $oDiscount) {
192 if ($oDiscount->isForBasketItem($oArticle) && $oDiscount->isForBasketAmount($oBasket)) {
193 $aList[$oDiscount->getId()] = $oDiscount;
211 $aDiscList = $this->
_getList($oUser)->getArray();
212 foreach ($aDiscList as $oDiscount) {
213 if ($oDiscount->isForBasket($oBasket)) {
214 $aList[$oDiscount->getId()] = $oDiscount;
233 $aDiscList = $this->
_getList($oUser)->getArray();
234 foreach ($aDiscList as $oDiscount) {
235 if ($oDiscount->isForBundleItem($oArticle, $oBasket) && $oDiscount->isForBasketAmount($oBasket)) {
236 $aList[$oDiscount->getId()] = $oDiscount;
254 $aDiscList = $this->
_getList($oUser)->getArray();
255 foreach ($aDiscList as $oDiscount) {
256 if ($oDiscount->isForBundleBasket($oBasket)) {
257 $aList[$oDiscount->getId()] = $oDiscount;
271 if ($this->_hasSkipDiscountCategories === null || $this->_blReload) {
272 $sViewName = getViewName(
'oxcategories');
273 $sQ =
"select 1 from {$sViewName} where {$sViewName}.oxactive = 1 and {$sViewName}.oxskipdiscounts = '1' ";
275 $this->_hasSkipDiscountCategories = (bool)
oxDb::getDb()->getOne($sQ);