Announcement

Collapse
No announcement yet.

Exclude Products from Miva's Native Search

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

    #16
    Code:
    
    <mvt:item name="customfields" param="Read_Product_ID( l.settings:product:id, 'exclude_from_search', l.settings:custom:exclude_from_search)" />
    
    <mvt:if expr="ISNULL l.settings:custom:exclude_from_search">
    
    <div class="x-search-preview__list" data-search="&mvte:product:name;">
    <div class="x-search-preview__line">
    <figure class="x-search-preview__image">
    <mvt:if expr="NOT ISNULL l.settings:product:imagetypes:main">
    <img src="&mvte:product:imagetypes:main;" alt="&mvte:product:name;" loading="lazy" width="&mvte:searchfield:b_width;" height="&mvte:searchfield:b_height;">
    </mvt:if>
    </figure>
    <div class="x-search-preview__item">
    <span class="x-search-preview__item-name">&mvte:product:name;</span>
    <hr class="c-keyline">
    <span class="x-search-preview__item-price u-text-right">
    <mvt:if expr="l.settings:product:base_price GT l.settings:product:price">
    <span class="u-font-small">Was: <s>&mvt:product:formatted_base_price;</s><br></span>
    </mvt:if>
    <strong>&mvt:product:formatted_price;</strong>
    </span>
    </div>
    </div>
    </div>
    
    </mvt:if>

    Comment


      #17
      Thanks for the updated code, Leanne. I tried it but - no go. Didn't work.
      Matt E.
      www.harpkit.com

      Comment


        #18
        Sorry, i think


        <mvt:if expr="ISNULL l.settings:custom:exclude_from_search">

        should be


        <mvt:if expr="l.settings:custom:exclude_from_search">
        <mvt:foreachcontinue/>
        </mvt:if>

        inside a foreach loop, when <mvt:foreachcontinue/> is encountered, processing skips to the NEXT loop.

        if that doesn't work (and the site is not live or too busy), try testing the variable by adding

        [&mvt:custom:exclude_from_search;]<br> right above the mvt:if.

        also, make sure the mvt:item "customfields" is assigned to all pages where search is available from.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment

        Working...
        X