/** * Content_List::PrepareWhereQuery() test case * * @return null */ public function testPrepareWhereQueryUserDefinedFolder() { if ($this->getTestConfig()->getShopEdition() === 'EE') { $this->markTestSkipped('This test is for Community and Professional editions only.'); } $this->setRequestParameter("folder", "testFolder"); $sViewName = getviewName("oxcontents"); // defining parameters $oView = oxNew('Content_List'); $sResQ = $oView->UNITprepareWhereQuery(array(), ""); $sQ = " and {$sViewName}.oxfolder = 'testFolder'"; $this->assertEquals($sQ, $sResQ); }
/** * Adding folder check and empty folder field check. * * @param array $aWhere SQL condition array * @param string $sqlFull SQL query string * * @return string */ protected function _prepareWhereQuery($aWhere, $sqlFull) { $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull); $sFolder = oxRegistry::getConfig()->getRequestParameter('folder'); $sViewName = getviewName("oxcontents"); //searchong for empty oxfolder fields if ($sFolder == 'CMSFOLDER_NONE' || $sFolder == 'CMSFOLDER_NONE_RR') { $sQ .= " and {$sViewName}.oxfolder = '' "; } elseif ($sFolder && $sFolder != '-1') { $sFolder = oxDb::getDb()->quote($sFolder); $sQ .= " and {$sViewName}.oxfolder = {$sFolder}"; } return $sQ; }
/** * Returns user countryid according to passed name * * @param string $sCountry country * * @return string */ public function getUserCountryId($sCountry = null) { $oDb = oxDb::getDb(); $sQ = "select oxid from " . getviewName("oxcountry") . " where oxactive = '1' and oxisoalpha2 = " . $oDb->quote($sCountry) . " "; $sCountryId = $oDb->getOne($sQ); return $sCountryId; }