Announcement

Collapse
No announcement yet.

Need help with Power Search "Show All" functionality.

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

    Need help with Power Search "Show All" functionality.

    This is what I'm trying to do (text taken from Power Search documentation):

    ----------
    Customer can select the number of products per page
    Beginning with Power Search version 5.051 you can let the customer select the number of products per page to show, e.g. show all. Put this drop down on the page where you want it.
    <select name="ProductsPerPage">
    <mvt:if expr="g.ProductsPerPage EQ 20">
    <option value="20" selected> 20</option>
    <mvt:else>
    <option value="20"> 20</option>
    </mvt:if>
    <mvt:if expr="g.ProductsPerPage EQ 40">
    <option value="40" selected> 40</option>
    <mvt:else>
    <option value="40"> 40</option>
    </mvt:if>
    <mvt:if expr="g.ProductsPerPage EQ 99999">
    <option value="99999" selected>ALL</option>
    <mvt:else>
    <option value="99999">ALL</option>
    </mvt:if>
    </select>
    per page
    You will also have to pass the ProductsPerPage value in links and forms used in the search page. So in the Power Search admin you will add &ProductsPerPage=&mvta:global:ProductsPerPage; into the url links in the page count input. Do not put it at the very end of the link. In the product layout input you will insert <input type="hidden" name="ProductsPerPage" value="&mvte:global:ProductsPerPage;"> in the forms for add to basket, next and previous.
    ---------

    I can't get it working properly. I don't think I understand the documentation properly. When you do a search and select "20, 40, show all" etc, nothing happens. I'm not sure what I've done wrong, but hopefully someone can help me. Here is the code from Power Search showing what I've done.

    Code from "Page Count" section:
    Code:
    <table border="0"> 
    <tr><td align="left">
    <mvt:item name="fonts" param="ctgy_font">
    <mvt:if expr="l.settings:product_count EQ 1">
    
    <mvt:else>
    
    </mvt:if>
    </mvt:item>
    </td>
    <td colspan="2" align="right">
    <mvt:item name="fonts" param="ctgy_font">
    <mvt:if expr="l.settings:cxp_total_pages GT 0">
    Page &mvt:cxp_current_page; of &mvt:cxp_total_pages;
    <br>
    </mvt:if>
    <mvt:if expr="l.settings:cxp_total_pages GT 1">
    <mvt:foreach iterator="pages" array="cxp_offset">
    <mvt:if expr="l.settings:pages:buffer GE 100 
    AND l.settings:pages:number NE 1 AND 
    l.settings:pages:number NE l.settings:cxp_total_pages">
     <mvt:if expr="l.settings:pages:buffer EQ 100">
    <a href="&mvt:global:sessionurl;Screen=SRCH&Store_Code=&mvta:store:code;&search=&mvta:global:search;&offset=&mvt:pages:offset;&filter_cat=&mvta:global:filter_cat;&ProductsPerPage=&mvta:global:ProductsPerPage;&PowerSearch_Begin_Only=&mvta:global:PowerSearch_Begin_Only;&sort=&mvta:global:sort;&range_low=&mvta:global:range_low;&range_high=&mvta:global:range_high;&mvt:powersearch:field_url;">
    <mvt:if expr="l.settings:pages:number GT l.settings:cxp_current_page">
     <img src="graphics/right.gif" border="0"></a> 
    <mvt:else>
     <img src="graphics/left.gif" border="0"></a> 
    </mvt:if>
     </mvt:if>
    <mvt:else>
    <mvt:if expr="l.settings:cxp_current_page EQ pos1">
    &mvt:pages:number;
    <mvt:else>
    <a href="&mvt:global:sessionurl;Screen=SRCH&Store_Code=&mvta:store:code;&search=&mvta:global:search;&offset=&mvt:pages:offset;&filter_cat=&mvta:global:filter_cat;&ProductsPerPage=&mvta:global:ProductsPerPage;&PowerSearch_Begin_Only=&mvta:global:PowerSearch_Begin_Only;&sort=&mvta:global:sort;&range_low=&mvta:global:range_low;&range_high=&mvta:global:range_high;&mvt:powersearch:field_url;">
    &mvt:pages:number;</a>
    </mvt:if>
    </mvt:if>
    </mvt:foreach>
    <br>
    </mvt:if>
    </mvt:item>
    </td>
    </tr>
    </table>
    
    <select name="ProductsPerPage">
    <mvt:if expr="g.ProductsPerPage EQ 20">
    <option value="20" selected> 20</option>
    <mvt:else>
    <option value="20"> 20</option>
    </mvt:if>
    <mvt:if expr="g.ProductsPerPage EQ 40">
    <option value="40" selected> 40</option>
    <mvt:else>
    <option value="40"> 40</option>
    </mvt:if>
    <mvt:if expr="g.ProductsPerPage EQ 99999">
    <option value="99999" selected>ALL</option>
    <mvt:else>
    <option value="99999">ALL</option>
    </mvt:if>
    </select>
      per page
    Code from "Product Layout" section:

    Code:
    <style>
    .right
    {
    position:relative;
    left:0px;
    top:-10px;
    }
    </style>
    <div class="right">
    <mvt:item name="powrsrch" param="pgcount" />
    </div>
    
    <mvt:foreach iterator="product" array="products">
      <div class="search-products">
        <mvt:if expr="NOT ISNULL l.settings:product:thumbnail">
          <div class="product-img"><a href="http://www.speakerrepair.com/page/product/&mvt:product:code;.html">
            <mvt:item name="powrsrch" param="customimage|big|l.all_settings:product:id||150|150|" />
    <mvt:if expr="g.big AND (NOT ISNULL l.settings:toolkitadditionalimages[1]:generated:image)">
    <img src="&mvte:toolkitadditionalimages[1]:generated:image;" border="0">
    </mvt:if>
    
            </a></div>
        </mvt:if>
    
    
        <div class="product-info">
          <p class="table"><a href="http://www.speakerrepair.com/page/product/&mvt:product:code;.html">&mvte:product:name;</a></p>
          <mvt:if expr="l.settings:product:price EQ '0.00'"> Part #: <b>&mvt:product:code;</b><br>
            <mvt:if expr="l.settings:product:inv_active"> <br />
              <strong>&mvt:product:inv_short;</strong> </mvt:if>
            <mvt:elseif expr="l.settings:product:price EQ '0.07'">
            <mvt:elseif expr="l.settings:product:price EQ '0.08'">
            <center>
              <a href="http://www.speakerrepair.com/page/REEDPRC.html"><img style="border: 0px solid ; width: 150px; height: 150px;" alt="Re-Edge Pricing" src="http://www.speakerrepair.com/ebaypics/re-edge-pricing.jpg"></a> <br>
              <b><a href="http://www.speakerrepair.com/page/REEDPRC.html">Click here for pricing on Re-Edging your speakers</a>.</b>
            </center>
            <mvt:elseif expr="l.settings:product:price EQ '0.09'">
            <center>
              <a href="http://www.speakerrepair.com/page/RECNEPRC.html"><img style="border: 0px solid ; width: 150px; height: 150px;" alt="Recone Pricing" src="http://www.speakerrepair.com/ebaypics/recone-pricing.jpg"></a> <br>
              <b><a href="http://www.speakerrepair.com/page/RECNEPRC.html">Click here for pricing on Reconing your speakers</a>.</b>
            </center>
            <mvt:elseif expr="l.settings:product:price EQ '0.01'">
            <br />
            Speaker repaired by Orange County Speaker. <span class="product-price">Not for sale</span>
            <mvt:else>
            <mvt:item name="product_display_imagemachine" param="body:product:id" />
            <div class="clear product-image-margin"></div>
            <mvt:item name="productreviews" PARAM="stars" />
            <big>Rating:
            <mvt:if expr="g.ReviewStars "> &mvt:global:ReviewStars;
              <mvt:else>
              <i>Not rated yet.</i> </mvt:if>
            <mvt:if expr="g.Total_Reviews">
              <mvt:if expr="g.Total_Reviews EQ '1'"> (&mvt:global:Total_Reviews;)
                <mvt:else>
                (&mvt:global:Total_Reviews;) </mvt:if>
            </mvt:if>
            </big> </big> <br>
    
            <br>
            Part #: <b>&mvt:product:code;</b><br>
            List Price: <strike>$&mvt:product:cost;</strike><br />
            Our Price: <span class="product-pg-price">&mvt:product:formatted_price;</span> <br>
    <br>
    <table style="text-align: left; width: 100%;" border="0"
     cellpadding="0" cellspacing="0">
      <tbody>
        <tr>
          <td align="undefined" valign="undefined"><mvt:if expr="l.settings:product:inv_active">&mvt:product:inv_short;</mvt:if></td>
          <td align="undefined" valign="undefined"><mvt:item name="customfields" param="Read_Product_Code( l.settings:product:code, 'freeship', g.freeship)" />        
    <mvt:if expr="g.freeship EQ 'yes'"><big><span style="font-weight: bold; color: red;">Ships FREE!</span></big>
    </mvt:if></td>
        </tr>
      </tbody>
    </table>    
            <mvt:if expr="g.secure">
            <form method="post" action="&mvt:global:secure_sessionurl;Screen=BASK" class="product-form" style="padding-top:-5px;">
            <mvt:else>
            <form method="post" action="&mvt:global:sessionurl;Screen=BASK" class="product-form" style="padding-top:-5px;">
              </mvt:if>
              <input type="hidden" name="Old_Screen" value="&mvte:global:Screen;" />
              <input type="hidden" name="Old_Search" value="&mvte:global:Search;" />
              <input type="hidden" name="Action" value="ADPR" />
              <input type="hidden" name="Store_Code" value="&mvte:store:code;" />
              <input type="hidden" name="Product_Code" value="&mvte:product:code;" />
              <input type="hidden" name="Category_Code" value="&mvte:global:category_code;" />
              <input type="hidden" name="Offset" value="&mvte:global:Offset;" />
              <input type="hidden" name="AllOffset" value="&mvte:global:AllOffset;" />
              <input type="hidden" name="CatListingOffset" value="&mvte:global:CatListingOffset;" />
              <input type="hidden" name="RelatedOffset" value="&mvte:global:RelatedOffset;" />
              <input type="hidden" name="SearchOffset" value="&mvte:global:SearchOffset;" />
              <input type="hidden" name="ProductsPerPage" value="&mvte:global:ProductsPerPage;">
              <div class="product-attributes">
                <mvt:item name="product_attributes" param="product:id" />
              </div>
    
    
              <mvt:if expr="l.settings:product:inv_level NE 'out'">
                <div>
                  <div style="float:left; padding-top:4px;">Qty:
                    <input type="text" name="Quantity" value="1" class="product-quantity-input textfield" />
                  </div>
                  <div style="float:right;">
                    <input type="image" alt="Add To Basket" src="graphics/00000001/addtocart.gif" border="0" width="80" height="26" />
                  </div>
                  <br clear="all" />
                </div>
              </mvt:if>
            </form>
          </mvt:if>
        </div>
        <!-- END PRODUCT INFO --> 
        
      </div>
    </mvt:foreach>
    <br clear="all" />
    
    
    <!--pagination here-->
    <mvt:if expr="g.Offset OR g.NextOffset">
    <br>
    <table border="0" width="100%" align="center">
    <tr>
    <mvt:if expr="g.Offset EQ 0">
    <td>&nbsp;</td>
    <mvt:else>
    <td align="left">
    
    <form method="post" action="&mvt:global:sessionurl;">
    <input type="hidden" name="Screen" value="&mvte:global:Screen;">
    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
    <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;">
    <input type="hidden" name="Product_Code" value="&mvte:global:Product_Code;">
    <input type="hidden" name="Search" value="&mvte:global:Search;">
    <input type="hidden" name="Offset" value="&mvte:global:PrevOffset;">
    <!-- begin additional inputs //-->
    <input type="hidden" name="ProductsPerPage" value="&mvte:global:ProductsPerPage;">
    <input type="hidden" name="filter_cat" value="&mvte:global:filter_cat;">
    <input type="hidden" name="PowerSearch_Begin_Only" value="&mvte:global:PowerSearch_Begin_Only;">
    <input type="hidden" name="sort" value="&mvte:global:sort;">
    <input type="hidden" name="range_low" value="&mvte:global:range_low;">
    <input type="hidden" name="range_high" value="&mvte:global:range_high;">
    <mvt:foreach iterator="fields" array="powersearch_fields">
    <input type="hidden" name="&mvte:fields;" value="1">
    </mvt:foreach>
    <!-- end additional inputs //-->
    <br><br><br>
    <mvt:item name="buttons" param="Previous" />
    </form>
    
    </td>
    </mvt:if>
    <mvt:if expr="g.NextOffset EQ 0">
    <td>&nbsp;</td>
    <mvt:else>
    <td align="right">
    
    <form method="post" action="&mvt:global:sessionurl;">
    <input type="hidden" name="Screen" value="&mvte:global:Screen;">
    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
    <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;">
    <input type="hidden" name="Product_Code" value="&mvte:global:Product_Code;">
    <input type="hidden" name="Search" value="&mvte:global:Search;">
    <input type="hidden" name="Offset" value="&mvte:global:NextOffset;">
    <!-- begin additional inputs //-->
    <input type="hidden" name="ProductsPerPage" value="&mvte:global:ProductsPerPage;">
    <input type="hidden" name="filter_cat" value="&mvte:global:filter_cat;">
    <input type="hidden" name="PowerSearch_Begin_Only" value="&mvte:global:PowerSearch_Begin_Only;">
    <input type="hidden" name="sort" value="&mvte:global:sort;">
    <input type="hidden" name="range_low" value="&mvte:global:range_low;">
    <input type="hidden" name="range_high" value="&mvte:global:range_high;">
    <mvt:foreach iterator="fields" array="powersearch_fields">
    <input type="hidden" name="&mvte:fields;" value="1">
    </mvt:foreach>
    <!-- end additional inputs //-->
    <mvt:item name="powrsrch" param="pgcount" />
    <br>
    <mvt:item name="buttons" param="Next" />
    
    </form>
    </td>
    </mvt:if>
    </tr>
    </table>
    </mvt:if>
    To test the search, it's at http://www.speakerrepair.com - you'll have to enter something that has a lot of results, so try "JBL".

    Any help would be greatly appreciated!

    Thanks,
    Eric
Working...
X