/** * Tear down the fixture. * * @return null */ protected function tearDown() { $this->getConfig()->setGlobalParameter('listtype', null); oxRemClassModule('oxCacheHelper'); $this->cleanUpTable('oxobject2attribute'); // ensure modules detached oxTestModules::cleanAllModules(); $oDB = oxDb::getDB(); $oDB->execute('delete from oxaccessoire2article where oxarticlenid="_testArt" '); $oDB->execute("update oxattribute set oxdisplayinbasket = 0 where oxid = '8a142c3f0b9527634.96987022' "); $this->cleanUpTable('oxarticles'); $this->cleanUpTable('oxartextends'); $this->cleanUpTable('oxcategories'); $this->cleanUpTable('oxorderarticles'); $this->cleanUpTable('oxprice2article', 'oxartid'); $this->cleanUpTable('oxobject2category'); $this->cleanUpTable('oxobject2category', 'oxobjectid'); $this->cleanUpTable('oxobject2category', 'oxcatnid'); $this->cleanUpTable('oxreviews'); $this->cleanUpTable('oxdiscount'); $oDB->Execute('delete from oxselectlist where oxid = "_testoxsellist" '); $oDB->Execute('delete from oxobject2selectlist where oxselnid = "_testoxsellist" '); oxDb::getInstance()->resetTblDescCache(); parent::tearDown(); }
/** * Performs full view update * * @return mixed */ public function updateViews() { //preventing edit for anyone except malladmin if (oxSession::getVar("malladmin")) { oxDb::getInstance()->updateViews(); $this->_aViewData["blViewSuccess"] = true; } }
/** * Remove this delivery cost from these sets */ public function removeFromSet() { $aRemoveGroups = $this->_getActionIds('oxdel2delset.oxid'); if ($this->getConfig()->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxdel2delset.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif ($aRemoveGroups && is_array($aRemoveGroups)) { $sQ = "delete from oxdel2delset where oxdel2delset.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aRemoveGroups)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes article from Selection list */ public function removeArtFromSel() { $aChosenArt = $this->_getActionIds('oxobject2selectlist.oxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sQ = parent::_addFilter("delete oxobject2selectlist.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sQ = "delete from oxobject2selectlist where oxobject2selectlist.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Remove these payments from this set * * @return null */ public function removepayfromset() { $aChosenCntr = $this->_getActionIds('oxobject2payment.oxid'); if (oxConfig::getParameter('all')) { $sQ = $this->_addFilter("delete oxobject2payment.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCntr)) { $sQ = "delete from oxobject2payment where oxobject2payment.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenCntr)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes user from selected user group(s). * * @return null */ public function removeuserfromgroup() { $aRemoveGroups = $this->_getActionIds('oxobject2group.oxid'); if (oxConfig::getParameter('all')) { $sQ = $this->_addFilter("delete oxobject2group.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif ($aRemoveGroups && is_array($aRemoveGroups)) { $sQ = "delete from oxobject2group where oxobject2group.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aRemoveGroups)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes chosen countries from delivery list */ public function removeCountryFromDel() { $aChosenCntr = $this->_getActionIds('oxobject2delivery.oxid'); if ($this->getConfig()->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxobject2delivery.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCntr)) { $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenCntr)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes category from delivery configuration * * @return null */ public function removecatfromdel() { $aChosenCat = $this->_getActionIds('oxobject2delivery.oxid'); // removing all if (oxConfig::getParameter('all')) { $sQ = $this->_addFilter("delete oxobject2delivery.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCat)) { $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenCat)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes category from Attributes list * * @return null */ public function removecatfromattr() { $aChosenCat = $this->_getActionIds('oxcategory2attribute.oxid'); if (oxConfig::getParameter('all')) { $sQ = $this->_addFilter("delete oxcategory2attribute.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCat)) { $sQ = "delete from oxcategory2attribute where oxcategory2attribute.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenCat)) . ") "; oxDb::getDb()->Execute($sQ); } $this->resetContentCache(); }
/** * Removes user group from promotion */ public function removePromotionGroup() { $aRemoveGroups = $this->_getActionIds('oxobject2action.oxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxobject2action.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif ($aRemoveGroups && is_array($aRemoveGroups)) { $sRemoveGroups = implode(", ", oxDb::getInstance()->quoteArray($aRemoveGroups)); $sQ = "delete from oxobject2action where oxobject2action.oxid in (" . $sRemoveGroups . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes selected category (categories) from discount list */ public function removeDiscCat() { $oConfig = $this->getConfig(); $aChosenCat = $this->_getActionIds('oxobject2discount.oxid'); if ($oConfig->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxobject2discount.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCat)) { $sChosenCategories = implode(", ", oxDb::getInstance()->quoteArray($aChosenCat)); $sQ = "delete from oxobject2discount where oxobject2discount.oxid in (" . $sChosenCategories . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes article attributes. * * @return null */ public function removeattr() { $aChosenArt = $this->_getActionIds('oxobject2attribute.oxid'); $sOxid = oxConfig::getParameter('oxid'); if (oxConfig::getParameter('all')) { $sO2AViewName = $this->_getViewName('oxobject2attribute'); $sQ = $this->_addFilter("delete {$sO2AViewName}.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sQ = "delete from oxobject2attribute where oxobject2attribute.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removing article form accessories article list */ public function removeArticleAcc() { $aChosenArt = $this->_getActionIds('oxaccessoire2article.oxid'); // removing all if (oxRegistry::getConfig()->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxaccessoire2article.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sChosenArticles = implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)); $sQ = "delete from oxaccessoire2article where oxaccessoire2article.oxid in ({$sChosenArticles}) "; oxDb::getDb()->Execute($sQ); } }
/** * Removes user group from discount config */ public function removeDiscGroup() { $config = $this->getConfig(); $groupIds = $this->_getActionIds('oxobject2discount.oxid'); if ($config->getRequestParameter('all')) { $query = $this->_addFilter("delete oxobject2discount.* " . $this->_getQuery()); oxDb::getDb()->Execute($query); } elseif ($groupIds && is_array($groupIds)) { $groupIdsQuoted = implode(", ", oxDb::getInstance()->quoteArray($groupIds)); $query = "delete from oxobject2discount where oxobject2discount.oxid in (" . $groupIdsQuoted . ") "; oxDb::getDb()->Execute($query); } }
/** * Load searched user list with wishlist * * @param string $sSearchStr Search string * * @return null; */ public function loadWishlistUsers($sSearchStr) { $sSearchStr = oxDb::getInstance()->escapeString($sSearchStr); if (!$sSearchStr) { return; } $sSelect = "select oxuser.oxid, oxuser.oxfname, oxuser.oxlname from oxuser "; $sSelect .= "left join oxuserbaskets on oxuserbaskets.oxuserid = oxuser.oxid "; $sSelect .= "where oxuserbaskets.oxid is not null and oxuserbaskets.oxtitle = 'wishlist' "; $sSelect .= "and oxuserbaskets.oxpublic = 1 "; $sSelect .= "and ( oxuser.oxusername like '%{$sSearchStr}%' or oxuser.oxlname like '%{$sSearchStr}%')"; $sSelect .= "and ( select 1 from oxuserbasketitems where oxuserbasketitems.oxbasketid = oxuserbaskets.oxid limit 1)"; $this->selectString($sSelect); }
/** * Collects articles base data and passes them according to filtering rules, * returns name of template file "article_list.tpl". * * @return string */ public function render() { $myConfig = $this->getConfig(); $sPwrSearchFld = oxConfig::getParameter("pwrsearchfld"); $sPwrSearchFld = $sPwrSearchFld ? strtolower($sPwrSearchFld) : "oxtitle"; $oArticle = null; $oList = $this->getItemList(); if ($oList) { foreach ($oList as $key => $oArticle) { $sFieldName = "oxarticles__{$sPwrSearchFld}"; // formatting view if (!$myConfig->getConfigParam('blSkipFormatConversion')) { if ($oArticle->{$sFieldName}->fldtype == "datetime") { oxDb::getInstance()->convertDBDateTime($oArticle->{$sFieldName}); } elseif ($oArticle->{$sFieldName}->fldtype == "timestamp") { oxDb::getInstance()->convertDBTimestamp($oArticle->{$sFieldName}); } elseif ($oArticle->{$sFieldName}->fldtype == "date") { oxDb::getInstance()->convertDBDate($oArticle->{$sFieldName}); } } $oArticle->pwrsearchval = $oArticle->{$sFieldName}->value; $oList[$key] = $oArticle; } } parent::render(); // load fields if (!$oArticle && $oList) { $oArticle = $oList->getBaseObject(); } $this->_aViewData["pwrsearchfields"] = $oArticle ? $this->getSearchFields() : null; $this->_aViewData["pwrsearchfld"] = strtoupper($sPwrSearchFld); $aFilter = $this->getListFilter(); if (isset($aFilter["oxarticles"][$sPwrSearchFld])) { $this->_aViewData["pwrsearchinput"] = $aFilter["oxarticles"][$sPwrSearchFld]; } $sType = ''; $sValue = ''; $sArtCat = oxConfig::getParameter("art_category"); if ($sArtCat && strstr($sArtCat, "@@") !== false) { list($sType, $sValue) = explode("@@", $sArtCat); } $this->_aViewData["art_category"] = $sArtCat; // parent categorie tree $this->_aViewData["cattree"] = $this->getCategoryList($sType, $sValue); // manufacturer list $this->_aViewData["mnftree"] = $this->getManufacturerlist($sType, $sValue); // vendor list $this->_aViewData["vndtree"] = $this->getVendorList($sType, $sValue); return "article_list.tpl"; }
/** * Removes article selection lists. */ public function removeSel() { $aChosenArt = $this->_getActionIds('oxobject2selectlist.oxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sQ = $this->_addFilter("delete oxobject2selectlist.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sChosenArticles = implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)); $sQ = "delete from oxobject2selectlist " . "where oxobject2selectlist.oxid in (" . $sChosenArticles . ") "; oxDb::getDb()->Execute($sQ); } $articleId = oxRegistry::getConfig()->getRequestParameter('oxid'); $this->onArticleSelectionListChange($articleId); }
/** * Removes article attributes. */ public function removeAttr() { $aChosenArt = $this->_getActionIds('oxobject2attribute.oxid'); $sOxid = oxRegistry::getConfig()->getRequestParameter('oxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sO2AViewName = $this->_getViewName('oxobject2attribute'); $sQ = $this->_addFilter("delete {$sO2AViewName}.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sChosenArticles = implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)); $sQ = "delete from oxobject2attribute where oxobject2attribute.oxid in ({$sChosenArticles}) "; oxDb::getDb()->Execute($sQ); } $this->onArticleAttributeRelationChange($sOxid); }
/** * Load all attributes by article Id's * * @param array $aIds article id's * * @return array $aAttributes; */ public function loadAttributesByIds($aIds) { if (!count($aIds)) { return; } foreach ($aIds as $iKey => $sVal) { $aIds[$iKey] = oxDb::getInstance()->escapeString($sVal); } $sAttrViewName = getViewName('oxattribute'); $sViewName = getViewName('oxobject2attribute'); $sSelect = "select {$sAttrViewName}.oxid, {$sAttrViewName}.oxtitle, {$sViewName}.oxvalue, {$sViewName}.oxobjectid "; $sSelect .= "from {$sViewName} left join {$sAttrViewName} on {$sAttrViewName}.oxid = {$sViewName}.oxattrid "; $sSelect .= "where {$sViewName}.oxobjectid in ( '" . implode("','", $aIds) . "' ) "; $sSelect .= "order by {$sViewName}.oxpos, {$sAttrViewName}.oxpos"; return $this->_createAttributeListFromSql($sSelect); }
/** * Smarty modifier * ------------------------------------------------------------- * Name: smarty_modifier_oxformdate<br> * Purpose: Conterts date/timestamp/datetime type value to user defined format * Example: {$object|oxformdate:"foo"} * ------------------------------------------------------------- * * @param object $oConvObject oxField object * @param string $sFieldType additional type if field (this may help to force formatting) * @param bool $blPassedValue bool if true, will simulate object as sometimes we need to apply formatting to some regulat values * * @return string */ function smarty_modifier_oxformdate($oConvObject, $sFieldType = null, $blPassedValue = false) { // creating fake bject if ($blPassedValue || is_string($oConvObject)) { $sValue = $oConvObject; $oConvObject = new oxField(); $oConvObject->fldmax_length = "0"; $oConvObject->fldtype = $sFieldType; $oConvObject->setValue($sValue); } $myConfig = oxConfig::getInstance(); // if such format applies to this type of field - sets formatted value to passed object if (!$myConfig->getConfigParam('blSkipFormatConversion')) { if ($oConvObject->fldtype == "datetime" || $sFieldType == "datetime") { oxDb::getInstance()->convertDBDateTime($oConvObject); } elseif ($oConvObject->fldtype == "timestamp" || $sFieldType == "timestamp") { oxDb::getInstance()->convertDBTimestamp($oConvObject); } elseif ($oConvObject->fldtype == "date" || $sFieldType == "date") { oxDb::getInstance()->convertDBDate($oConvObject); } } return $oConvObject->value; }
/** * Creates Array with [iLanguage][sFieldName] * * @return array */ private function _getMultilangualFields() { $aRet = array(); $aData = oxDb::getInstance()->getTableDescription($this->_sTableName); foreach ($aData as $key => $oADODBField) { $iLang = substr($oADODBField->name, strlen($oADODBField->name) - 1, 1); if (is_numeric($iLang) && substr($oADODBField->name, strlen($oADODBField->name) - 2, 1) == '_') { // multilangual field $sMainFld = str_replace('_' . $iLang, "", $oADODBField->name); $aRet[$iLang][$sMainFld] = $oADODBField->name . ' as ' . $sMainFld; } } return $aRet; }
/** * Returns default category sorting for selected category * * @return array */ public function getUserSelectedSorting() { $aSorting = null; $oStr = getStr(); $oConfig = oxRegistry::getConfig(); $aSortDirections = array('desc', 'asc'); $sSortBy = $oConfig->getRequestParameter($this->getSortOrderByParameterName()); $sSortDir = $oConfig->getRequestParameter($this->getSortOrderParameterName()); if ($sSortBy && oxDb::getInstance()->isValidFieldName($sSortBy) && $sSortDir && oxRegistry::getUtils()->isValidAlpha($sSortDir) && in_array($oStr->strtolower($sSortDir), $aSortDirections)) { $aSorting = array('sortby' => $sSortBy, 'sortdir' => $sSortDir); } return $aSorting; }
/** * Removes article from Attribute list */ public function removeAttrArticle() { $aChosenCat = $this->_getActionIds('oxobject2attribute.oxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sO2AttributeView = $this->_getViewName('oxobject2attribute'); $sQ = parent::_addFilter("delete {$sO2AttributeView}.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCat)) { $sChosenCategories = implode(", ", oxDb::getInstance()->quoteArray($aChosenCat)); $sQ = "delete from oxobject2attribute where oxobject2attribute.oxid in (" . $sChosenCategories . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Load the list by article ids * * @param array $aIds Article ID array * * @return null; */ public function loadIds($aIds) { if (!count($aIds)) { $this->clear(); return; } foreach ($aIds as $iKey => $sVal) { $aIds[$iKey] = oxDb::getInstance()->escapeString($sVal); } $oBaseObject = $this->getBaseObject(); $sArticleTable = $oBaseObject->getViewName(); $sArticleFields = $oBaseObject->getSelectFields(); $sSelect = "select {$sArticleFields} from {$sArticleTable} "; $sSelect .= "where {$sArticleTable}.oxid in ( '" . implode("','", $aIds) . "' ) and "; $sSelect .= $oBaseObject->getSqlActiveSnippet(); $this->selectString($sSelect); }
/** * Adds article to Manufacturer config */ public function addManufacturer() { $myConfig = $this->getConfig(); $aAddArticle = $this->_getActionIds('oxarticles.oxid'); $sSynchOxid = $myConfig->getRequestParameter('synchoxid'); if ($myConfig->getRequestParameter('all')) { $sArtTable = $this->_getViewName('oxarticles'); $aAddArticle = $this->_getAll($this->_addFilter("select {$sArtTable}.oxid " . $this->_getQuery())); } if ($sSynchOxid && $sSynchOxid != "-1" && is_array($aAddArticle)) { $oDb = oxDb::getDb(); $sSelect = "update oxarticles set oxmanufacturerid = " . $oDb->quote($sSynchOxid) . " where oxid in ( " . implode(", ", oxDb::getInstance()->quoteArray($aAddArticle)) . " )"; $oDb->Execute($sSelect); $this->resetCounter("manufacturerArticle", $sSynchOxid); } }
/** * loads first articles to recomm list also ordering them and clearing not usable list objects * ordering priorities: * 1. first show articles from our search * 2. do not shown articles as 1st, which are shown in other recomm lists as 1st * * @param oxList $oRecommList recommendation list * @param array $aIds article ids * * @return null */ protected function _loadFirstArticles(oxList $oRecommList, $aIds) { $aIds = oxDb::getInstance()->quoteArray($aIds); $sIds = implode(", ", $aIds); $aPrevIds = array(); $sArtView = getViewName('oxarticles'); foreach ($oRecommList as $key => $oRecomm) { if (count($aPrevIds)) { $sNegateSql = " AND {$sArtView}.oxid not in ( '" . implode("','", $aPrevIds) . "' ) "; } else { $sNegateSql = ''; } $sArticlesFilter = "{$sNegateSql} ORDER BY {$sArtView}.oxid in ( {$sIds} ) desc"; $oRecomm->setArticlesFilter($sArticlesFilter); $oArtList = oxNew('oxarticlelist'); $oArtList->setSqlLimit(0, 1); $oArtList->loadRecommArticles($oRecomm->getId(), $sArticlesFilter); if (count($oArtList) == 1) { $oArtList->rewind(); $oArticle = $oArtList->current(); $sId = $oArticle->getId(); $aPrevIds[$sId] = $sId; unset($aIds[$sId]); $sIds = implode(", ", $aIds); } else { unset($oRecommList[$key]); } } }
/** * Removes article from category */ public function removeArticle() { $aArticles = $this->_getActionIds('oxarticles.oxid'); $sCategoryID = oxRegistry::getConfig()->getRequestParameter('oxid'); $sShopID = $this->getConfig()->getShopId(); $oDb = oxDb::getDb(); // adding if (oxRegistry::getConfig()->getRequestParameter('all')) { $sArticleTable = $this->_getViewName('oxarticles'); $aArticles = $this->_getAll($this->_addFilter("select {$sArticleTable}.oxid " . $this->_getQuery())); } // adding if (is_array($aArticles) && count($aArticles)) { $sProdIds = implode(", ", oxDb::getInstance()->quoteArray($aArticles)); $sDelete = "delete from oxobject2category where"; $sWhere = " oxcatnid=" . $oDb->quote($sCategoryID); if (!$this->getConfig()->getConfigParam('blVariantsSelection')) { $sQ = $sDelete . $sWhere . " and oxobjectid in\n ( select oxid from oxarticles where oxparentid in ( {$sProdIds} ) )"; $oDb->execute($sQ); } $sQ = $sDelete . $sWhere . " and oxobjectid in ( {$sProdIds} )"; $oDb->execute($sQ); // updating oxtime values $this->_updateOxTime($sProdIds); } $this->resetArtSeoUrl($aArticles, $sCategoryID); $this->resetCounter("catArticle", $sCategoryID); }
/** * Creates SQL by type. * * @param integer $iType type. * * @return string */ protected function _getSQLByType($iType) { $sSQLAdd = ''; $oDb = oxDb::getDb(); $sSQLType = " AND `oxtype` = " . $oDb->quote($iType); if ($iType == self::TYPE_CATEGORY_MENU) { $sSQLAdd = " AND `oxcatid` IS NOT NULL AND `oxsnippet` = '0'"; } if ($iType == self::TYPE_SERVICE_LIST) { $sIdents = implode(", ", oxDb::getInstance()->quoteArray($this->getServiceKeys())); $sSQLAdd = " AND OXLOADID IN (" . $sIdents . ")"; $sSQLType = ''; } $sViewName = $this->getBaseObject()->getViewName(); $sSql = "SELECT * FROM {$sViewName} WHERE `oxactive` = '1' {$sSQLType} AND `oxshopid` = " . $oDb->quote($this->_sShopID) . " {$sSQLAdd} ORDER BY `oxloadid`"; return $sSql; }
/** * returns nice formatted array * * @param array $aInput messages array * * @return array */ protected function _generateWarningsResult($aInput) { $aOutput = array(); $oDb = oxDb::getDb(); foreach ($aInput as $fnc => $aWarnings) { $ids = implode(",", oxDb::getInstance()->quoteArray(array_keys($aWarnings))); $rs = $oDb->select("select sql1, timer, tracer from adodb_logsql where sql0 in ({$ids})"); if ($rs != false && $rs->recordCount() > 0) { while (!$rs->EOF) { $aOutputEntry = array(); $aOutputEntry['check'] = $fnc; $aOutputEntry['sql'] = $rs->fields[0]; $aOutputEntry['time'] = $rs->fields[1]; $aOutputEntry['trace'] = $rs->fields[2]; $aOutput[] = $aOutputEntry; $rs->moveNext(); } } } return $aOutput; }
/** * Checks if discount may be applied according amounts info * * @param object $oArticle article object to chesk * * @return bool */ protected function _checkForArticleCategories($oArticle) { // check if article is in some assigned category $aCatIds = $oArticle->getCategoryIds(); if (!$aCatIds || !count($aCatIds)) { // no categories are set for article, so no discounts from categories.. return false; } $sCatIds = "(" . implode(",", oxDb::getInstance()->quoteArray($aCatIds)) . ")"; $oDb = oxDb::getDb(); // getOne appends limit 1, so this one should be fast enough $sQ = "select oxobjectid from oxobject2discount where oxdiscountid = " . $oDb->quote($this->oxdiscount__oxid->value) . " and oxobjectid in {$sCatIds} and oxtype = 'oxcategories'"; return $oDb->getOne($sQ); }