本文整理汇总了PHP中BFCHelper::setSearchParamsSession方法的典型用法代码示例。如果您正苦于以下问题:PHP BFCHelper::setSearchParamsSession方法的具体用法?PHP BFCHelper::setSearchParamsSession怎么用?PHP BFCHelper::setSearchParamsSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFCHelper
的用法示例。
在下文中一共展示了BFCHelper::setSearchParamsSession方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSearchResults
public function getSearchResults($start, $limit, $ordering, $direction, $ignorePagination = false, $jsonResult = false)
{
$this->currentOrdering = $ordering;
$this->currentDirection = $direction;
$params = $this->getState('params');
$searchid = $params['searchid'];
$newsearch = $params['newsearch'];
$pricerange = $params['pricerange'];
$merchantResults = $params['merchantResults'];
$condominiumsResults = $params['condominiumsResults'];
$sessionkey = 'search.' . $searchid . '.results';
$session = JFactory::getSession();
$results = null;
if ($newsearch == "0") {
$cachedresults = $session->get($sessionkey);
//$_SESSION[$sessionkey];
try {
if (isset($cachedresults) && !empty($cachedresults)) {
$results = (array) json_decode(gzuncompress(base64_decode($cachedresults)));
}
// echo 'sessionkey: ', $sessionkey, "<br />";
//$results = $cachedresults;
} catch (Exception $e) {
// echo 'Exception: ', $e->getMessage(), "<br />";
//echo 'Caught exception: ', $e->getMessage(), "\n";
}
} else {
BFCHelper::setFilterSearchParamsSession(null);
}
if ($results == null) {
// echo 'No result: <br />';
$options = array('path' => $this->urlSearchAllCalculate, 'data' => array('$format' => 'json', 'topRresult' => 0, 'lite' => 1));
$this->applyDefaultFilter($options);
$url = $this->helper->getQuery($options);
$results = null;
$r = $this->helper->executeQuery($url);
if (isset($r)) {
$res = json_decode($r);
// $results = $res->d->results ?: $res->d;
if (!empty($res->d->results)) {
$results = $res->d->results;
} elseif (!empty($res->d)) {
$results = $res->d;
}
try {
if (!empty($results)) {
// shuffle($results);
$resultsCat = array();
$resultsBook = array();
$resultsCat = array_filter($results, function ($result) {
return $result->IsCatalog;
});
if (!empty($resultsCat)) {
shuffle($resultsCat);
$resultsBook = array_filter($results, function ($result) {
return !$result->IsCatalog;
});
if (!empty($resultsBook)) {
shuffle($resultsBook);
$results = array_merge($resultsBook, $resultsCat);
} else {
$results = $resultsCat;
}
} else {
shuffle($results);
}
}
} catch (Exception $e) {
//echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
// purge last searchid. clears unusable session data
// $lastsearchid = $session->get('search.last', '', 'com_bookingforconnector');
//
// if ($lastsearchid != '') {
// $this->purgeSessionValues($session, "booking");
// $session->set('search.last','', 'com_bookingforconnector');
// // purge static searchresult
// //BFCHelper::setSearchResult($lastsearchid, null);
// }
// saves parameters into session
BFCHelper::setSearchParamsSession($params);
// if(!empty($results)){
// if($pricerange !=='0' && strpos($pricerange,'|') !== false ){ // se ho un valore per pricerange diverso da 0 allora splitto per ;
// $priceranges = explode("|", $pricerange);
// $pricemin = $priceranges[0];
// $pricemax = $priceranges[1];
//
//
// // price min filtering
// if ($pricemin > 0) {
// $results = array_filter($results, function($result) use ($pricemin) {
// return $result->Price >= $pricemin;
// });
// }
// // price max filtering
// if ($pricemax > 0) {
// $results = array_filter($results, function($result) use ($pricemax) {
// return $result->Price <= $pricemax;
// });
//.........这里部分代码省略.........