VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Feature requests => Topic started by: futuron on May 22, 2007, 16:24:16 pm

Title: Sort products by "in stock"
Post by: futuron on May 22, 2007, 16:24:16 pm
Is it possible to add a option to sort/order the products by "in stock". I want to show products wich are out of stock on the website, but it is not very handy if these products stand at the top of the product list. 

Kind Regards
Rob van der Donk
Title: Re: Sort products by "in stock"
Post by: toivo on June 05, 2007, 15:52:50 pm
I happened to post a mod today to Inventory Listing in 1.0.9 which adds an option to display the products in the order of 'in stock' or stock on hand.  Only the child products which can have stock are listed, the parent products are excluded.
Title: Re: Sort products by "in stock"
Post by: crackdaddy on June 05, 2007, 16:42:46 pm
um are you gonna share your work..or what? i dont need it... but if you hae done if and posted it..it helps to give the link...if you havnt posted it then do it, cause otherwise whats the point....

and yes sort by in stock in very simple to code...and can be done in 5 min prob.. i dont need this functionality but if you find the code that make the sort...you should be able to add what you need...

if toivo doesnt post his..i mihgt take a minute to show you where it is...
Title: Re: Sort products by "in stock"
Post by: toivo on June 08, 2007, 22:52:01 pm
Oops, here is the link:

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=28857.0

Title: Re: Sort products by "in stock"
Post by: futuron on November 26, 2007, 10:58:11 am
Your hack is nice, but this is for the backend. What I'm looking for is a hack for the frontend. So the visitors of the webshop allways see the products in stock first!

Kind regards,
Rob van der Donk
Title: Re: Sort products by "in stock"
Post by: antivir on May 13, 2008, 15:26:54 pm
shop_browse_queries.php
old:
Quote
$q .= "\n ORDER BY $orderbyField $DescOrderBy";
new:
Quote
$q .= "\n ORDER BY product_in_stock DESC, $orderbyField $DescOrderBy";
Title: Re: Sort products by "in stock"
Post by: vbarkouski on May 26, 2010, 19:58:16 pm
Is there a solution to sort by product name and in stock together?

shop_browse_queries.php
old:
Quote
$q .= "\n ORDER BY $orderbyField $DescOrderBy";
new:
Quote
$q .= "\n ORDER BY product_in_stock DESC, $orderbyField $DescOrderBy";
Title: Re: Sort products by "in stock"
Post by: Template Designer on May 29, 2010, 10:39:52 am
I hope we can have these options in the backend. It's easy to make mistake if revising the code.
Title: Re: Sort products by "in stock"
Post by: killarney on August 25, 2015, 05:56:05 am
Hi,
i am new to virtuemart and i want to show in stock  product first and not in stock after that at the Front End.
can anyone can help me with it,
thanks in advance
Title: Re: Sort products by "in stock"
Post by: jenkinhill on August 25, 2015, 10:11:42 am
And you are using VirtueMart 1?  See this section heading:  VirtueMart Dev/Coding Central: VM1 (old version)