Power Search product count per page code on mm9

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kitdang
    Mivite


    • Jan 2009
    • 406

    #1

    Power Search product count per page code on mm9

    All,

    I am interested in showing "results 1 - 24 of 300" on the search page where 1 - 24 is the number of items for that page and 300 is the total item in the search result.

    Are there tokens/variables I can use or do I have to create my own calculation converting offset to counts?

    Thanks in advance
  • hmendenhall
    Mivite

    • Nov 2014
    • 108

    #2
    Re: Power Search product count per page code on mm9

    Originally posted by kitdang View Post
    All,

    I am interested in showing "results 1 - 24 of 300" on the search page where 1 - 24 is the number of items for that page and 300 is the total item in the search result.

    Are there tokens/variables I can use or do I have to create my own calculation converting offset to counts?

    Thanks in advance
    I thought this was a default setting for powersearch but it not here is some logic that might help.

    <mvt:if expr="g.Offset">

    <mvt:assign name="beginingNum" value="(g.Offset + g.Per_Page) - g.Per_Page + 1" />

    <mvt:assign name="lastNum" value="g.beginingNum + g.Per_Page" />

    <mvt:if expr="g.lastNum GT l.settings:category_listing:total_prod_count">

    Showing &mvt:global:beginingNum;-&mvt:category_listing:total_prod_count; of &mvt:category_listing:total_prod_count;

    <mvt:else>

    <mvt:assign name="lastNum" value="(g.beginingNum + g.Per_Page) - 1" />

    Showing &mvt:global:beginingNum;-&mvt:global:lastNum; of &mvt:category_listing:total_prod_count;

    </mvt:if>

    <mvt:else>

    Showing 1-&mvt:global:Per_Page; of &mvt:category_listing:total_prod_count;

    </mvt:if>
    Happie Mendenhall
    Support Technician
    Miva, Inc.

    Comment

    • kitdang
      Mivite


      • Jan 2009
      • 406

      #3
      Re: Power Search product count per page code on mm9

      Hi Happie,

      Love your name by the way. Anyway, appreciate the logic and step through. I've converted your logic to work with the power search variables. Here is the working code for anyone that wants to use it.

      Code:
      <mvt:if expr="g.searchoffset">
          <mvt:assign name="beginingNum" value="(g.searchoffset + g.ProductsPerPage) - g.ProductsPerPage + 1" />
          <mvt:assign name="lastNum" value="g.beginingNum + g.ProductsPerPage" />
          <mvt:if expr="g.lastNum GT l.settings:search_product_count">
              Showing &mvt:global:beginingNum; - &mvte:search_product_count; of &mvte:search_product_count;
          <mvt:else>
              <mvt:assign name="lastNum" value="(g.beginingNum + g.ProductsPerPage) - 1" />
              Showing &mvt:global:beginingNum; - &mvt:global:lastNum; of &mvte:search_product_count;
          </mvt:if>
      <mvt:else>
          Showing 1 - &mvt:global:ProductsPerPage; of &mvte:search_product_count;
      </mvt:if>
      Last edited by kitdang; 04-16-15, 12:29 PM.

      Comment

      Working...
      X