Guest User

function

a guest
Dec 15th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.97 KB | None | 0 0
  1. protected function _getQuery()
  2.     {
  3.         $myConfig = $this->getConfig();
  4.  
  5.         // looking for table/view
  6.         // $sArtTable = getViewName('oxarticles', oxConfig::getParameter('editlanguage'));
  7.         //$sArtTable = getViewName('oxarticles', oxRegistry::getConfig()->getRequestParameter('editlanguage'));
  8.        
  9.         $sO2CView  = _getViewName('oxobject2category');
  10.         $sArtTable = _getViewName('oxarticles');
  11.  
  12.         // $sSelId      = oxConfig::getParameter('oxid');
  13.         // $sSynchSelId = oxConfig::getParameter('synchoxid');
  14.  
  15.         $sSelId      = oxRegistry::getConfig()->getRequestParameter('oxid');
  16.         $sSynchSelId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
  17.  
  18.         // category selected or not ?
  19.         if (!$sSelId) {
  20.             // dodger performance
  21.             $sQAdd  = " from $sArtTable where 1 ";
  22.             $sQAdd .= " and $sArtTable.oxparentid = '' ";
  23.             //only active products
  24.             $sQAdd .= " and $sArtTable.oxactive = 1";
  25.         } else {
  26.             // selected category ?
  27.             if ($sSynchSelId && $sSelId != $sSynchSelId) {
  28.  
  29.                 $sQAdd  = " from $sO2CView left join $sArtTable on ";
  30.                 $sQAdd .= " $sArtTable.oxid=$sO2CView.oxobjectid ";
  31.                 $sQAdd .= " where $sO2CView.oxcatnid = '$sSelId' ";
  32.             } else {
  33.  
  34.                 $sQAdd  = " from $sArtTable left join oxgbase2article on $sArtTable.oxid=oxgbase2article.oxartid ";
  35.                 $sQAdd .= " where oxgbase2article.oxactionid = '$sSelId' and oxgbase2article.oxshopid = '".$myConfig->getShopID()."' ";
  36.             }
  37.         }
  38.  
  39.         if ($sSynchSelId && $sSynchSelId != $sSelId) {
  40.             $sQAdd .= " and $sArtTable.oxid not in (select oxgbase2article.oxartid from oxgbase2article ";
  41.             $sQAdd .= " where oxgbase2article.oxactionid = '$sSynchSelId' and oxgbase2article.oxshopid = '".$myConfig->getShopID()."') ";
  42.         }
  43.        
  44.         return $sQAdd;
  45.     }
Add Comment
Please, Sign In to add comment