Wordpress Search Results in Order
Posted
by
Brad Houston
on Stack Overflow
See other posts from Stack Overflow
or by Brad Houston
Published on 2012-12-05T15:48:16Z
Indexed on
2012/12/05
17:04 UTC
Read the original article
Hit count: 207
One of my clients websites, www.kevinsplants.co.uk is not showing the search results in alphabetical order, how do I go about ordering the results in alphabetical order?
We are using the Shopp plugin and I believe its that plugin that is generating the results!
Cheers, Brad
case "orderby-list":
if (isset($Shopp->Category->controls)) return false;
if (isset($Shopp->Category->smart)) return false;
$menuoptions = Category::sortoptions();
$title = "";
$string = "";
$default = $Shopp->Settings->get('default_product_order');
if (empty($default)) $default = "title";
if (isset($options['default'])) $default = $options['default'];
if (isset($options['title'])) $title = $options['title'];
if (value_is_true($options['dropdown'])) {
if (isset($Shopp->Cart->data->Category['orderby']))
$default = $Shopp->Cart->data->Category['orderby'];
$string .= $title;
$string .= '<form action="'.esc_url($_SERVER['REQUEST_URI']).'" method="get" id="shopp-'.$Shopp->Category->slug.'-orderby-menu">';
if (!SHOPP_PERMALINKS) {
foreach ($_GET as $key => $value)
if ($key != 'shopp_orderby') $string .= '<input type="hidden" name="'.$key.'" value="'.$value.'" />';
}
$string .= '<select name="shopp_orderby" class="shopp-orderby-menu">';
$string .= menuoptions($menuoptions,$default,true);
$string .= '</select>';
$string .= '</form>';
$string .= '<script type="text/javascript">';
$string .= "jQuery('#shopp-".$Shopp->Category->slug."-orderby-menu select.shopp-orderby-menu').change(function () { this.form.submit(); });";
$string .= '</script>';
} else {
if (strpos($_SERVER['REQUEST_URI'],"?") !== false)
list($link,$query) = explode("\?",$_SERVER['REQUEST_URI']);
$query = $_GET;
unset($query['shopp_orderby']);
$query = http_build_query($query);
if (!empty($query)) $query .= '&';
foreach($menuoptions as $value => $option) {
$label = $option;
$href = esc_url($link.'?'.$query.'shopp_orderby='.$value);
$string .= '<li><a href="'.$href.'">'.$label.'</a></li>';
}
}
return $string;
break;
© Stack Overflow or respective owner