News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

sort by stock

Started by kaistudios, March 07, 2016, 21:27:51 PM

Previous topic - Next topic

kaistudios

Hello,

I'm trying to get the products in the front end sorted by in stock but I get out of stock products mixed in mostly towards the end of the list.
by availability is mixed up even more.
I could use bty sorting and just do it manually but that's time consuming the stock changes frequently on too many products.
anybody else experienced this? thank you

Studio 42

You can set in VM>Configuration> Product Order Settings :
  Default product sort order : Product in stock
  Available Sort-by fields : Product in stock
This is then ordered by stock, but this not count pending product in order.

kaistudios

Quote from: Studio 42 on March 08, 2016, 01:22:45 AM
You can set in VM>Configuration> Product Order Settings :
  Default product sort order : Product in stock
  Available Sort-by fields : Product in stock
This is then ordered by stock, but this not count pending product in order.

Hello I wrote above that I did this already but it doesn't work. still I see out of stock products mixed in with the in stock items.

GJC Web Design

Action when a Product is Out of Stock -> Do not Display Product   ????
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kaistudios

Quote from: GJC Web Design on March 10, 2016, 00:26:42 AM
Action when a Product is Out of Stock -> Do not Display Product   ????
thank you but unfortunately they want the out of stock products to show on the site with the ability to have a notify list. you know which site i'm talking about you can see what i mean ...

GJC Web Design

hmmm.. where do u want the out of stock to appear?  at the bottom?

I can only assume the query is using say a stock of -3, -4 etc as a positive integer?

have a look in the model products.php the query for stock to test this theory
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kaistudios

#6
Quote from: GJC Web Design on March 10, 2016, 11:35:43 AM
hmmm.. where do u want the out of stock to appear?  at the bottom?

I can only assume the query is using say a stock of -3, -4 etc as a positive integer?

have a look in the model products.php the query for stock to test this theory
They want out of stock products to appear at the end of the list after the in-stock products. from what I understand sort by 'availability' should be the correct choice for that so it reflects booked orders as well but that doesn't work for me either. totaly out of stock product with 0 stcok get mixed in still. it does happen after the first few rows but i dont think there is a certain patern i could point to
will look into model products.php to try different things thank you

GJC Web Design

yes.. but stock can also be -1, -2 etc

or are they all definitely 0?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kaistudios

yes they are all definitely zero. no back orders. just notify list. and very high stock change rate

GJC Web Design

then to solve this u need to dig into the actual queries of models product.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

add a vmDebug or any var_dump and check the current query and result, when you use order by stock, so you see why the result is bad.

lindapowers

We tried doing the same but never managed to order them automatically in the desired way.

If you use child products only the parent is counted for ordering so we ended up doing it manually.

el02154

Hello all,

I have exact the same problem in multiple sites. I want to sort the products based on availability but it is not working. I have tried lots of things, even disable the template but the problem still happens. For example you can see site ddc.gr. Is there anyone who can help? Does anyone face the same problem?

el02154

Does anyone have the same issue?

Kuubs

I think you can make a custom sort function and sort using usort. It's not the most ideal situation, because ideally you want to do this with the query, but with usort you can sort he products in your template override.