Announcement

Collapse
No announcement yet.

Levels ReadyTheme Search box

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

    #16
    Alright so I have figured out how to get the short urls, and make sure that it doesn't add 2 sets of listings to it. This should work perfectly. I'm giving the whole thing for reference:

    Code:
    <mvt:if expr="g.get EQ 'autocomplete' AND g.Search">
    
        <mvt:comment><!-- Autocomplete Category & Product Search --></mvt:comment>
    
            <mvt:comment><!-- Search for Categories --></mvt:comment>
    
                <mvt:assign name="g.Fields" value="'code,name'" />
                <mvt:assign name="g.Offset" value="0" />
                <mvt:assign name="g.Max" value="5" />
                <mvt:do file="g.Module_Library_DB" name="l.return" value="CategoryList_Load_Offset(g.Offset, g.Search, g.Fields, g.Max, g.NextOffset, l.settings:categories)" />
    
                <mvt:foreach iterator="category" array="categories">
    
                    <mvt:comment><!-- Skip In-Active Categories --></mvt:comment>
                    <mvt:if expr="NOT l.settings:category:active">
                        <mvt:foreachcontinue/>
                    </mvt:if>
    
                    <mvt:comment><!-- Lookup Category Canonical URI --></mvt:comment>
                        <mvt:assign name="l.uri:store_id" value="g.Store:id" />
                        <mvt:assign name="l.uri:screen" value="''" />
                        <mvt:assign name="l.uri:page_id" value="0" />
                        <mvt:assign name="l.uri:cat_id" value="l.settings:category:id" />
                        <mvt:assign name="l.uri:product_id" value="0" />
                        <mvt:do file="g.Module_Feature_URI_DB" name="l.settings:category:has_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:category:uri )" />
                        <mvt:if expr="l.settings:category:has_uri">
                            <mvt:assign name="l.settings:category:link" value="l.settings:category:uri:uri" />
                        <mvt:else>
                            <mvt:assign name="l.settings:category:link" value="g.domain:mm_url $ 'Screen=CTGY&Category_Code=' $ l.settings:category:code" />
                        </mvt:if>
    
                    <mvt:comment><!-- Push Prepared Category Data to Output Array --></mvt:comment>
                        <mvt:assign name="l.index" value="miva_array_insert( l.settings:ac:categories, l.settings:category, -1 )" />
    
                </mvt:foreach>
    
            <mvt:comment><!-- Search for Products --></mvt:comment>
            <mvt:comment>
                <mvt:assign name="g.Offset" value="0" />
                <mvt:assign name="g.Max" value="5" />
                <mvt:assign name="g.Sort" value="'name_asc'" />
                <mvt:do file="g.Module_Library_DB" name="l.return" value="Runtime_ProductList_Load_Offset_Search_Sort(g.Search, g.Offset, g.Max, g.Sort, g.NextOffset, l.settings:search_results:products)" />
            </mvt:comment>
    
                <mvt:foreach iterator="product" array="search_results:products">
    
                    <mvt:comment><!-- Skip Active Products --></mvt:comment>
                        <mvt:if expr="NOT l.settings:product:active">
                            <mvt:foreachcontinue/>
                        </mvt:if>
    
                    <mvt:comment><!-- Lookup Product Canonical URI --></mvt:comment>
                        <mvt:assign name="l.uri:store_id" value="g.Store:id" />
                        <mvt:assign name="l.uri:screen" value="''" />
                        <mvt:assign name="l.uri:page_id" value="0" />
                        <mvt:assign name="l.uri:cat_id" value="0" />
                        <mvt:assign name="l.uri:product_id" value="l.settings:product:id" />
                        <mvt:do file="g.Module_Feature_URI_DB" name="l.settings:product:has_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:product:uri )" />
                        <mvt:if expr="l.settings:product:has_uri">
                            <mvt:assign name="l.settings:product:link" value="l.settings:product:uri:uri" />
                        <mvt:else>
                            <mvt:assign name="l.settings:product:link" value="g.domain:mm_url $ 'Screen=PROD&Product_Code=' $ l.settings:product:code" />
                        </mvt:if>
    
                    <mvt:comment><!-- Push Prepared Product Data to Output Array --></mvt:comment>
                        <mvt:assign name="l.index" value="miva_array_insert( l.settings:ac:products, l.settings:product, -1 )" />
    
                </mvt:foreach>
    
            <mvt:comment><!-- Output Results --></mvt:comment>
    
                <mvt:if expr="tolower(g.Format) EQ 'json'">
                    <mvt:assign name="l.result" value="miva_output_header( 'Content-Type', 'application/json' )" />
                    <mvt:do file="g.Module_JSON" name="l.output" value="JSON_Output(l.settings:ac)" />
                    <mvt:eval expr="l.output"/>
                <mvt:else>
                    <mvt:if expr="l.settings:ac:categories">
                        <h3 class="nm">Categories</h3>
                        <ul class="no-list">
                            <mvt:foreach iterator="category" array="ac:categories">
                                <li><a href="&mvt:category:link;">&mvt:category:name;</a></li>
                            </mvt:foreach>
                        </ul>
                    </mvt:if>
                    <mvt:if expr="l.settings:ac:categories AND l.settings:ac:products">
                        <hr>
                    </mvt:if>
                    <mvt:if expr="l.settings:ac:products">
                        <h3 class="nm">Products</h3>
                        <ul class="no-list">
                            <mvt:foreach iterator="product" array="ac:products">
                                <li><a href="&mvt:product:link;">&mvt:product:name;</a></li>
                            </mvt:foreach>
                        </ul>
                    </mvt:if>
                    <mvt:if expr="l.settings:ac:categories OR l.settings:ac:products">
                        <hr>
                    </mvt:if>
                    <a href="&mvte:urls:SRCH:auto;?Search=&mvte:global:Search;"><b>Search Store for "&mvte:global:Search;"</b></a>
                </mvt:if>
    </mvt:if>
    Last edited by cnelson; 05-23-16, 02:08 PM. Reason: There was a question mark in the search store link in the dropdown that broke it.
    Calvin Nelson
    Director of Web Development
    2C Development Group

    Comment


      #17
      Nicely done Calvin! This works perfectly, except that I had to modify one of the very last lines so that if you click on (Search Store for "keyword") that it'll go to the power search results... the default way leads to a 404 error, at least on our website

      Code:
      <a href="&mvte:urls:SRCH:auto;?Search=&mvte:global:Search;"><b>See more results for "&mvte:global:Search;"</b></a>
      Basically just replacing the & with a ? after SRCH:auto;
      Dylan Buchfink
      The Mattress & Sleep Company
      http://www.tmasc.ca/

      Comment


        #18
        Oops, I see you caught that too
        Dylan Buchfink
        The Mattress & Sleep Company
        http://www.tmasc.ca/

        Comment


          #19
          Glad that helped!
          Calvin Nelson
          Director of Web Development
          2C Development Group

          Comment


            #20
            Typically this issues is an .htaccess issue where the query string is not being passed in the Miva short links. Make sure your .htaccess file has QSA at the end of the rewrite rules:

            Code:
            ### Begin - Inserted by Miva Merchant
            
            RewriteEngine On
            
            RewriteRule ^mm5/admin.mvc? - [QSA,L]
            
            RewriteCond %{REQUEST_FILENAME} !-s
            RewriteRule ^product/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1 [QSA,L]
            
            RewriteCond %{REQUEST_FILENAME} !-s
            RewriteRule ^category/([^/.]+).html$ /mm5/merchant.mvc?Screen=CTGY&Category_code=$1 [QSA,L]
            
            RewriteCond %{REQUEST_FILENAME} !-s
            RewriteRule ^([^/]+)/([^/.]+).html$ /mm5/merchant.mvc?Screen=PROD&Category_code=$1&Product_code=$2 [QSA,L]
            
            RewriteCond %{REQUEST_FILENAME} !-s
            RewriteRule ^([^/.]+).html$ /mm5/merchant.mvc?Screen=$1 [QSA,L]
            
            ### End - Inserted by Miva Merchant
            Brennan Heyde
            VP Product
            Miva, Inc.
            [email protected]
            https://www.miva.com

            Comment


              #21
              Newbie to M5-9, were all the issues in using old man Weiland's (...gee we miss him) Power Search solution with Levels ReadyTheme ever resolved?

              Current production store MM4.24c utilizes an old but nevertheless a great third party developer mikeWorks called Search Manager, superior than today's stock Search. Would like to implement old man Weiland's (...gee we miss him) Power Search which is even better than Search Manager in our soon to launch Levels theme site. I really would hate to launch our site with a stock solution that is not as effective as our current one in production.
              Thank you, Bill Davis

              Comment


                #22
                It's not too hard to implement. I kind of hacked my way through it and it's functional. That said, I'll be moving to the built-in search function for sure once they update it.

                I just seriously hope they'll allow sorting by product cost.
                Dylan Buchfink
                The Mattress & Sleep Company
                http://www.tmasc.ca/

                Comment


                  #23
                  Originally posted by koala View Post
                  It's not too hard to implement. I kind of hacked my way through it and it's functional. That said, I'll be moving to the built-in search function for sure once they update it.

                  I just seriously hope they'll allow sorting by product cost.
                  Can you please post the solution, I'm new to M5-9.
                  Thank you, Bill Davis

                  Comment


                    #24
                    I'd have to re-trace a lot of steps - I hacked this together a few months ago. I'm by no means an expert developer or any such thing :)

                    If you read through this thread the steps are all (mostly) there. The rest of the process is all in the Power Search install docs. You'd follow the Power Search instructions and then only have to tweak a handful of things to get it fully working with this theme and URI's. The extra tweaks are all documented in this thread.
                    Dylan Buchfink
                    The Mattress & Sleep Company
                    http://www.tmasc.ca/

                    Comment

                    Working...
                    X