/** * Adds filter SQL to current query * * @param string $query query to add filter condition * * @return string */ protected function _addFilter($query) { $articleViewName = $this->_getViewName('oxarticles'); $query = parent::_addFilter($query); // display variants or not ? $query .= $this->getConfig()->getRequestParameter('blVariantsSelection') ? ' group by ' . $articleViewName . '.oxid ' : ''; return $query; }
/** * Adds filter SQL to current query * * @param string $sQ query to add filter condition * * @return string */ protected function _addFilter($sQ) { $sArtTable = $this->_getViewName('oxarticles'); $sQ = parent::_addFilter($sQ); // display variants or not ? $sQ .= $this->getConfig()->getRequestParameter('blVariantsSelection') ? ' group by ' . $sArtTable . '.oxid ' : ''; return $sQ; }
/** * Adds filter SQL to current query * * @param string $sQ query to add filter condition * * @return string */ protected function _addFilter($sQ) { $sArtTable = $this->_getViewName('oxarticles'); $sQ = parent::_addFilter($sQ); // display variants or not ? if (!$this->getConfig()->getConfigParam('blVariantsSelection')) { $sQ .= " and {$sArtTable}.oxparentid = '' "; } return $sQ; }
/** * Removes article from delivery configuration */ public function removeArtFromDel() { $aChosenArt = $this->_getActionIds('oxobject2delivery.oxid'); // removing all if ($this->getConfig()->getRequestParameter('all')) { $sQ = parent::_addFilter("delete oxobject2delivery.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in (" . implode(", ", oxDb::getDb()->quoteArray($aChosenArt)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes article from Attribute list * * @return null */ public function removeattrarticle() { $aChosenCat = $this->_getActionIds('oxobject2attribute.oxid'); if (oxConfig::getParameter('all')) { $sO2AttributeView = $this->_getViewName('oxobject2attribute'); $sQ = parent::_addFilter("delete {$sO2AttributeView}.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenCat)) { $sQ = "delete from oxobject2attribute where oxobject2attribute.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenCat)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Adds article to Selection list */ public function addArtToSel() { $aAddArticle = $this->_getActionIds('oxarticles.oxid'); $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid'); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sArtTable = $this->_getViewName('oxarticles'); $aAddArticle = $this->_getAll(parent::_addFilter("select {$sArtTable}.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aAddArticle)) { $oDb = oxDb::getDb(); foreach ($aAddArticle as $sAdd) { $oNewGroup = oxNew("oxBase"); $oNewGroup->init("oxobject2selectlist"); $oNewGroup->oxobject2selectlist__oxobjectid = new oxField($sAdd); $oNewGroup->oxobject2selectlist__oxselnid = new oxField($soxId); $oNewGroup->oxobject2selectlist__oxsort = new oxField((int) $oDb->getOne("select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = " . $oDb->quote($sAdd) . " ", false, false)); $oNewGroup->save(); $this->onArticleAddToSelectionList($sAdd); } } }
/** * Adding article to accessories article list */ public function addArticleAcc() { $oArticle = oxNew("oxArticle"); $aChosenArt = $this->_getActionIds('oxarticles.oxid'); $soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid'); // adding if (oxRegistry::getConfig()->getRequestParameter('all')) { $sArtTable = $this->_getViewName('oxarticles'); $aChosenArt = $this->_getAll(parent::_addFilter("select {$sArtTable}.oxid " . $this->_getQuery())); } if ($oArticle->load($soxId) && $soxId && $soxId != "-1" && is_array($aChosenArt)) { foreach ($aChosenArt as $sChosenArt) { $oNewGroup = oxNew("oxBase"); $oNewGroup->init("oxaccessoire2article"); $oNewGroup->oxaccessoire2article__oxobjectid = new oxField($sChosenArt); $oNewGroup->oxaccessoire2article__oxarticlenid = new oxField($oArticle->oxarticles__oxid->value); $oNewGroup->oxaccessoire2article__oxsort = new oxField(0); $oNewGroup->save(); } $this->onArticleAccessoryRelationChange($oArticle); } }
/** * Removes article from Promotions list * * @return null */ public function removeartfromact() { $aChosenArt = $this->_getActionIds('oxactions2article.oxid'); $sOxid = oxConfig::getParameter('oxid'); if (oxConfig::getParameter('all')) { $sQ = parent::_addFilter("delete oxactions2article.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sQ = "delete from oxactions2article where oxactions2article.oxid in (" . implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)) . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Removes article from Promotions list */ public function removeArtFromAct() { $aChosenArt = $this->_getActionIds('oxactions2article.oxid'); $sOxid = oxRegistry::getConfig()->getRequestParameter('oxid'); $this->_getOxRssFeed()->removeCacheFile($sOxid); if (oxRegistry::getConfig()->getRequestParameter('all')) { $sQ = parent::_addFilter("delete oxactions2article.* " . $this->_getQuery()); oxDb::getDb()->Execute($sQ); } elseif (is_array($aChosenArt)) { $sChosenArticles = implode(", ", oxDb::getInstance()->quoteArray($aChosenArt)); $sQ = "delete from oxactions2article where oxactions2article.oxid in (" . $sChosenArticles . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Adds selected article (articles) to discount list */ public function addDiscArt() { $config = $this->getConfig(); $articleIds = $this->_getActionIds('oxarticles.oxid'); $discountListId = $config->getRequestParameter('synchoxid'); // adding if ($config->getRequestParameter('all')) { $articleTable = $this->_getViewName('oxarticles'); $articleIds = $this->_getAll(parent::_addFilter("select {$articleTable}.oxid " . $this->_getQuery())); } if ($discountListId && $discountListId != self::NEW_DISCOUNT_LIST_ID && is_array($articleIds)) { foreach ($articleIds as $articleId) { $this->addArticleToDiscount($discountListId, $articleId); } } }
/** * Adds selected article (articles) to discount list */ public function addDiscArt() { $oConfig = $this->getConfig(); $aChosenArt = $this->_getActionIds('oxarticles.oxid'); $soxId = $oConfig->getRequestParameter('synchoxid'); // adding if ($oConfig->getRequestParameter('all')) { $sArticleTable = $this->_getViewName('oxarticles'); $aChosenArt = $this->_getAll(parent::_addFilter("select {$sArticleTable}.oxid " . $this->_getQuery())); } if ($soxId && $soxId != "-1" && is_array($aChosenArt)) { foreach ($aChosenArt as $sChosenArt) { $oObject2Discount = oxNew("oxbase"); $oObject2Discount->init('oxobject2discount'); $oObject2Discount->oxobject2discount__oxdiscountid = new oxField($soxId); $oObject2Discount->oxobject2discount__oxobjectid = new oxField($sChosenArt); $oObject2Discount->oxobject2discount__oxtype = new oxField("oxarticles"); $oObject2Discount->save(); } } }
/** * 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::getDb()->quoteArray($aChosenCat)); $sQ = "delete from oxobject2attribute where oxobject2attribute.oxid in (" . $sChosenCategories . ") "; oxDb::getDb()->Execute($sQ); } }
/** * Adding article to corssselling list * * @return null */ public function addarticlecross() { $aChosenArt = $this->_getActionIds('oxarticles.oxid'); $soxId = oxConfig::getParameter('synchoxid'); // adding if (oxConfig::getParameter('all')) { $sArtTable = $this->_getViewName('oxarticles'); $aChosenArt = $this->_getAll(parent::_addFilter("select {$sArtTable}.oxid " . $this->_getQuery())); } $oArticle = oxNew("oxarticle"); if ($oArticle->load($soxId) && $soxId && $soxId != "-1" && is_array($aChosenArt)) { foreach ($aChosenArt as $sAdd) { $oNewGroup = oxNew('oxbase'); $oNewGroup->init('oxobject2article'); $oNewGroup->oxobject2article__oxobjectid = new oxField($sAdd); $oNewGroup->oxobject2article__oxarticlenid = new oxField($oArticle->oxarticles__oxid->value); $oNewGroup->oxobject2article__oxsort = new oxField(0); $oNewGroup->save(); } } }