Announcement

Collapse
No announcement yet.

Sorting Out Of Stock Items At End of Category Display

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

    Sorting Out Of Stock Items At End of Category Display

    Has anyone developed a simple way to cause out of stock items to sort to the bottom of the category display? I assume there has to be something someone has done to allow for this. I thought I might be able to use a combo of toolkits simple search to do this, but it won't sort by any of the pages available inventory items.

    So has anyone else have a quick and dirty way around this that is shareable?
    Ted Hust
    AarcMediaGroup.com

    Celebrating 13 Years of Outstanding Service & Support
    Miva Merchant Design

    #2
    Assuming you're not using inventory variants, you can resort the category_listing array on the product:stock level. Add this above the start of the foreach loop on the page

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

    Comment


      #3
      I stumbled upon this yesterday, but it only sorts the elements on a given page. So for my purpose I'm sorting the inv_available in descending order with this...
      <mvt:item name="toolkit" param="asortmulti|l.all_settings:category_listing: products|:inv_available|-1" />

      Is there a way to take it further and to have it sort them among all pages, as in, all out of stocks show last as part of the whole category product list?
      Ted Hust
      AarcMediaGroup.com

      Celebrating 13 Years of Outstanding Service & Support
      Miva Merchant Design

      Comment


        #4
        If you use that code on the CTGY page it will sort the products on every product. Are you looking to do it somewhere else?
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          No, it sorts the products on THAT PAGE by inventory level. But each and every page ends up having a mix of both. What I want is for the <for:each> to first spit the in stock items, and then the out of stock, so for example, the first 6 pages are all in stock items, and the last 3 pages would be out of stock.
          Ted Hust
          AarcMediaGroup.com

          Celebrating 13 Years of Outstanding Service & Support
          Miva Merchant Design

          Comment


            #6
            Did anyone ever figure out a way to do this?

            I think Ted is saying that the sorting needs to happen before the items are split due to pagination. Otherwise you may get out of stock items on page 1, and in stock items on page 2, because it splits them into pages by the default sorting order, then sorts just that page worth of items.

            Thanks,
            Susan
            Susan Petracco
            NetBlazon

            1.866.400.2444

            _____________________________________________

            Like us on Facebook

            Comment


              #7
              What Ted is saying is that, if you only sort one page at a time, you'll get out-of-stock products at the end of each page; you won't move all the out-of-stock products to the final pages of the search results. I think you'll need a custom module to do this. I've written several custom product-list modules; you can drop me a line if you'd like a quote.
              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


                #8
                Yeah I see what you mean. Miva only loads the products on the specific page your viewing to avoid having to load all products in that category. The only option I can think of would be to turn off pagination (which would be much slower to load since all products assigned to that category are loading) then sort the list and implement your own pagination via JavaScript.

                You could get away with this method is your categories have less than 100 products assigned typically. However if you have categories which have 100's or 1000's of products assigned assigned, its going to be too slow to work.

                What about just using Miva's inventory settings to hide out of stock products instead? If you're moving them to the last page anyway, the chance of customers getting to them are pretty slim. May be easier to just remove them from displaying.
                Brennan Heyde
                VP Product
                Miva, Inc.
                [email protected]
                https://www.miva.com

                Comment


                  #9
                  Hiding out of stock items won't work for this customer, unfortunately. I think modifying the list module from the LSK is the best way to go unless he wants to manage it manually. Thank you for all the input.
                  Susan Petracco
                  NetBlazon

                  1.866.400.2444

                  _____________________________________________

                  Like us on Facebook

                  Comment


                    #10
                    Yes, that's generally how I write custom search modules, by starting with the latest copy from the LSK.
                    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

                    Working...
                    X