Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function _getQuery()
- {
- $myConfig = $this->getConfig();
- // looking for table/view
- // $sArtTable = getViewName('oxarticles', oxConfig::getParameter('editlanguage'));
- //$sArtTable = getViewName('oxarticles', oxRegistry::getConfig()->getRequestParameter('editlanguage'));
- $sO2CView = _getViewName('oxobject2category');
- $sArtTable = _getViewName('oxarticles');
- // $sSelId = oxConfig::getParameter('oxid');
- // $sSynchSelId = oxConfig::getParameter('synchoxid');
- $sSelId = oxRegistry::getConfig()->getRequestParameter('oxid');
- $sSynchSelId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
- // category selected or not ?
- if (!$sSelId) {
- // dodger performance
- $sQAdd = " from $sArtTable where 1 ";
- $sQAdd .= " and $sArtTable.oxparentid = '' ";
- //only active products
- $sQAdd .= " and $sArtTable.oxactive = 1";
- } else {
- // selected category ?
- if ($sSynchSelId && $sSelId != $sSynchSelId) {
- $sQAdd = " from $sO2CView left join $sArtTable on ";
- $sQAdd .= " $sArtTable.oxid=$sO2CView.oxobjectid ";
- $sQAdd .= " where $sO2CView.oxcatnid = '$sSelId' ";
- } else {
- $sQAdd = " from $sArtTable left join oxgbase2article on $sArtTable.oxid=oxgbase2article.oxartid ";
- $sQAdd .= " where oxgbase2article.oxactionid = '$sSelId' and oxgbase2article.oxshopid = '".$myConfig->getShopID()."' ";
- }
- }
- if ($sSynchSelId && $sSynchSelId != $sSelId) {
- $sQAdd .= " and $sArtTable.oxid not in (select oxgbase2article.oxartid from oxgbase2article ";
- $sQAdd .= " where oxgbase2article.oxactionid = '$sSynchSelId' and oxgbase2article.oxshopid = '".$myConfig->getShopID()."') ";
- }
- return $sQAdd;
- }
Add Comment
Please, Sign In to add comment