Esempio n. 1
0
if ($referer_query && !strlen($query)) {
    $px_search_results = px_product_search($referer_query, $category_id, $lid, $perpage, PX_CTY_HOMEPAGE, $px_prefs['CID'], $sort, $lid);
    if ($px_search_results['results']['current_results']) {
        $query = $referer_query;
    }
}
if (!$px_search_results || !$px_search_results['results']['current_results']) {
    $px_search_results = px_product_search($query, $category_id, $lid, $perpage, PX_CTY_HOMEPAGE, $px_prefs['CID'], $sort, $lid);
}
if (!$px_search_results['results']['current_results']) {
    $px_search_results['results']['current_results'] = px_get_random_products($px_prefs['products_per_page'], PX_CTY_HOMEPAGE, $px_prefs['CID'], $lid);
    $px_random = true;
} else {
    $px_random = false;
}
$base_url = px_get_url('search', array('query' => $query, 'category_id' => $category_id, 'lid' => $lid));
$px_prefs['from_page'] = 'main';
$px_prefs['search_results'] = $px_search_results;
$px_prefs['base_url'] = $base_url;
$px_prefs['lid'] = $lid;
$px_prefs['query'] = '';
$px_prefs['category_id'] = '';
$px_prefs['random'] = $px_random;
$px_prefs['sort'] = $sort;
$px_prefs['lid'] = $lid;
$px_prefs['offset'] = $offset;
px_include_template('header', $px_prefs);
?>
      <h2>Welcome</h2>
      <p class="introduction"><?php 
echo htmlentities($px_prefs['welcome_text']);
Esempio n. 2
0
      <div id="searchfilter">
        <label for="sortby">Sort by:
          <select id="sortby" name="order" onchange="document.location.href = '<?php 
echo px_get_url($vars['from_page'], array('offset' => '1', 'query' => $vars['query'], 'category_id' => $vars['category_id'], 'lid' => $vars['lid']));
?>
'+'&amp;sort='+document.getElementById('sortby').value">
            <option value="relevance"<?php 
if ($vars['sort'] == 'relevance' || !$vars['sort']) {
    ?>
 selected<?php 
}
?>
>Relevance</option>
            <option value="price_high"<?php 
if ($vars['sort'] == 'price_high') {
    ?>
 selected<?php 
}
?>
>Price (high to low)</option>
            <option value="price_low"<?php 
if ($vars['sort'] == 'price_low') {
    ?>
 selected<?php 
}
?>
>Price (low to high)</option>
          </select>
        </label>
      </div>
/**
 * Construct a HTML anchor that is compatible with this application's routing system.
 *
 * @param string $anchor The anchor text.
 * @param string $page The page within the application to link to.
 * @param array $params Associative array of query string parameters.
 * @param string $class Optional class to apply to the a tag.
 * @param boolean $nofollow Adds rel=nofollow if true.
 * @param boolean $newwindow The anchor opens a new window.
 * @param string $onclick JavaScript to fire when the link is clicked.
 *
 * @return string A HTML anchor tag.
 */
function px_link_to($anchor, $page, $params = array(), $class = null, $nofollow = false, $newwindow = false, $onclick = null)
{
    $url = px_get_url($page, $params);
    return px_create_link($anchor, $url, $class, $nofollow, $newwindow, $onclick);
}