If you want to sort items by "in stock" then i have hack for you :)
Firstly edit file: /administrator/components/com_virtuemart/html/shop_browse_queries.php
After lines:
$featured = vmGet($_REQUEST, 'featured', 'N' );
$discounted = vmGet($_REQUEST, 'discounted', 'N' );
Add this line:
$in_stock = vmGet($_REQUEST,'in_stock','N');
Also in that file after these lines:
if( strtoupper($featured) == 'Y' ) {
// Filter all except Featured Products (="on special")
$where_clause[] = '`#__{vm}_product`.`product_special`=\'Y\'';
}
if( strtoupper($discounted) == 'Y' ) {
// Filter all except Discounted Products
$where_clause[] = '`#__{vm}_product`.`product_discount_id` > 0';
}
Add this:
if( strtoupper($in_stock) == 'Y' ) {
// Sort in stock
$where_clause[] = '`#__{vm}_product`.`product_in_stock` > 0';
}
Now edit file components/com_virtuemart/themes/<your theme>/templates/browse/includes/browse_orderbyfields.tpl.php
And in the end add:
<select class="inputbox" name="in_stock" onchange="order.submit()">
<option value="N" >All</option>
<option value="Y" <?php if (isset($_REQUEST['in_stock']) && $_REQUEST['in_stock']=='Y') echo "selected"; ?>>In stock</option>
</select>
Now you can filter products by availability in stock :)
Check in virtuemart control panel if you checked ordering by fields ;)
Комментариев нет:
Отправить комментарий