Announcement

Collapse
No announcement yet.

Push out of stock items to the bottom of categories

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Push out of stock items to the bottom of categories

    I am coming up on a project, and I have a couple other projects that would benefit from having the ability to push products to the bottom of a product lists based on a product field, basically sorting.

    My first thought would be to bring in the data and separate the 2 sets into 2 different arrays. Iterate through the in-stock array first then, iterate through the out-of-stock array afterwords. But that seems like a performance prohibitive way of doing it.

    Plus if we wanted to do pagination I don't think my solution would work properly.

    I need to be able to sort the data by the out of stock field, and I am not sure that is possible.

    A module would be fine as well.

    Does anyone have a more elegant solution?

    Thanks for everyone's help!
    Calvin Nelson
    Director of Web Development
    2C Development Group

    #2
    There is a toolkit function that can resort the array by the inventory count

    Code:
    <mvt:item name="toolkit" param="asortmulti|l.all_settings:category_listing:products|:inv_available|1" />
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      It's relatively easy to sort the products on a single page, but doing it across all the products in a multi-page search requires more control over the database queries. I've written a number of custom search modules that can do this kind of things. If you're interested in that, you can drop me a line by email.
      Kent Multer
      Magic Metal Productions
      http://TheMagicM.com
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line:
      http://www.amazon.com/exec/obidos/IS...icmetalproducA

      Comment


        #4
        Thanks for that suggestion Brennan! That may work for what we are trying to do.

        I will keep that in mind Kent! Thanks.
        Calvin Nelson
        Director of Web Development
        2C Development Group

        Comment

        Working...
        X