<?php require_once 'protect.php'; ?>
<?php if ($filters==1 AND $typec==2) { 
$resultprice = $mysqli->query("SELECT id FROM items WHERE price!='0.00' AND (category_id='$catid' OR category_id=ANY (SELECT insert_id FROM categories WHERE parent='$catid' AND lang_id=$lang AND publish='yes')
OR insert_id IN (SELECT item_id FROM groups WHERE category_id='$catid')) AND (section_id='$secid' OR section_id=ANY (SELECT insert_id FROM sections WHERE parent='$secid')) AND lang_id=$lang AND publish='yes'");
$rowsprice = mysqli_num_rows($resultprice);
?>
<div class="content divfilters">
<ul class="navorder">
<li class="dropdown dropdownbox"><?php echo $textsort ?> <span class="caret caret1 color1"></span>
<ul class="dropdown-menu dropdown-menus">
<li>
<form name="formapriority" method="post">
<?php if ($rowsprice>0) { ?>
<button type="submit" name="orderp" value="price" class="buttontext"><span class="icon fa-chevron-up"></span> <?php echo $textprice ?></button>
<button type="submit" name="orderp" value="priced" class="buttontext"><span class="icon fa-chevron-down"></span> <?php echo $textprice ?></button>
<?php }?>
<button type="submit" name="orderp" value="name" class="buttontext"><span class="icon fa-font"></span> <?php echo $textname ?></button>
<button type="submit" name="orderp" value="newest" class="buttontext"><span class="icon fa-calendar-check-o"></span> <?php echo $textnewest ?></button>
</form>
</li>
</ul>
</li>
</ul>
</div>
<?php }?>
<?php
if ($_REQUEST['orderp']) {
$orderp = $mysqli->real_escape_string(stripslashes($_REQUEST['orderp']));
$orderpriority=$orderp;
if ($orderp=="price") { $orderpriority="price, offerprice"; }
if ($orderp=="priced") { $orderpriority="price desc, offerprice desc"; }
if ($orderp=="newest") { $orderpriority="insert_id desc"; }
} else {
$orderp="priority";
$orderpriority="priority";
}
?>