Announcement

Collapse
No announcement yet.

Facets when no products in CTGY

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

    Facets when no products in CTGY

    I am currently wrangling with facets. Getting facets to display on the SRCH, CGTY and PLST is a piece of cake, but now what I want to do:

    If a parent category has a subcategory listing, but no products listed/assigned to that parent category, I want the category tree to display, and not the facets. I only want facets to display if there are products listed/assigned to that category. Sorry if this is boggled...that's where my mind is at. This is my latest attempt:

    Code:
    <mvt:if expr="'|'$toupper(g.screen)$'|' IN '|SRCH|PLST|CTGY|' AND 'l.settings:product_count GT 0'">
        <mvt:item name="facets" />
    <mvt:else>
        <mvt:item name="category_tree" />
    </mvt:if>
    But I get nothing listed. No category tree/no facets on categories with no products.

    What am I doing wrong? Tried several different ways to do this and am not getting there.

    Jamie
    Jamie Donaldson
    JSDVS Web Design / Development
    Web Design | Web Development | E-commerce Design & Integration

    #2
    Facets should only be displaying if there are products assigned to that category. Are you trying to get the global facet template elements not to display if there are not products?
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Originally posted by Brennan View Post
      Facets should only be displaying if there are products assigned to that category. Are you trying to get the global facet template elements not to display if there are not products?
      Well, I want the facets to display on the CTGY page, but if there are no products assigned to that category, then I want the category tree to display instead. On the other hand, if there are products assigned to the category, I want the facets to display. Hope I am making sense here. Done a lot of head banging.

      Jamie
      Jamie Donaldson
      JSDVS Web Design / Development
      Web Design | Web Development | E-commerce Design & Integration

      Comment


        #4
        Brennan: You said that Facets should only be displaying if there are products assigned to that category.

        Well, the category has no products assigned to it, and the facets still display. I have a Levels theme that has the category tree under User Interface >> Settings, so I had to use an if/else. So, I couldn't just replace the category tree mvt:item with the facets mvt:item on the page template as the instructions state under Template Changes. Hope this makes it easier to figure out. Would really like this to work, and I sure don't want to have to mess with all the theme's page templates and Settings just to do it.

        Jamie
        Jamie Donaldson
        JSDVS Web Design / Development
        Web Design | Web Development | E-commerce Design & Integration

        Comment


          #5
          Facets aren't showing on my development website at all. When I read the resource info on facets to see what the heck they are, couldn't figure it out. I get a message when I click on facets to add 2 or more modules. I don't know what modules it is asking for as I have every possible module installed.



          Kathleen Steimle-Hermes
          , owner
          Miss Kate's Creations
          [email protected]
          www.misskatescreations.com


          Handcrafted fabric covered photo albums, frames, brag books and MORE


          Comment


            #6
            Not sure of how much this will help you, Miss Kate, since I'm still trying to sort out my own mess, but to just insert the standard facets on some themes (like levels), you'll have to find the category tree in the User Interface >> Settings >> Global Footer, and insert this in its place:

            <code>
            <mvt:if expr="'|'$toupper(g.screen)$'|' IN '|CTGY|SRCH|PLST'">
            <mvt:item name="facets" />
            <mvt:else>
            <mvt:item name="category_tree" />
            </mvt:if>
            </code>

            However, if you have the category tree within the page template (as is on some themes), then you just replace the mvt:item for category tree with the facets item.

            And, on each of the screens, CTGY, SRCH, PLST, make sure you add the mvt:item for facets.

            As far as modules, I would think all you needed was that one module (Utilities >> Add/Remove Modules >> Standard Facets module.

            Jamie
            Jamie Donaldson
            JSDVS Web Design / Development
            Web Design | Web Development | E-commerce Design & Integration

            Comment


              #7
              What is a facet? The Standard Facets module is installed but I don't know what it is used for.



              Kathleen Steimle-Hermes
              , owner
              Miss Kate's Creations
              [email protected]
              www.misskatescreations.com


              Handcrafted fabric covered photo albums, frames, brag books and MORE


              Comment


                #8
                Facets allow a customer to sort by price, category, attributes, ect, and other as applied by custom fields. For an example view the elements theme facets.

                Or, insert the term product in the search bar of the elements demo, and it will give you the search page with facets

                Jamie
                Last edited by jsdva; 02-22-18, 08:17 AM.
                Jamie Donaldson
                JSDVS Web Design / Development
                Web Design | Web Development | E-commerce Design & Integration

                Comment


                  #9
                  Okay, I am going to re-revisit this to [hopefully] give it a bump, in hopes of getting an answer.

                  So, "Facets should only be displaying if there are products assigned to that category." I get this.

                  But, I want categories that have only subcats and no products in them to display the category tree. If the categories have products assigned to them, they should display the facets. So, why is my if/else not doing this?

                  Code:
                   <mvt:if expr="'|'$toupper(g.screen)$'|' IN '|SRCH|PLST|CTGY|' AND 'l.settings:product_count GT 0'">    
                      <mvt:item name="facets" />
                  <mvt:else>    
                      <mvt:item name="category_tree" />
                  </mvt:if>
                  Clearly I am not doing something right.

                  Anyone??

                  Jamie
                  Last edited by jsdva; 03-01-18, 08:41 AM. Reason: Pretty up the code.
                  Jamie Donaldson
                  JSDVS Web Design / Development
                  Web Design | Web Development | E-commerce Design & Integration

                  Comment


                    #10
                    Hi Jamie,

                    If I am not mistaken, each of those pages has a separate product count variable. For instance, CTGY uses l.settings:category_product_count and SRCH uses l.settings:search_product_count.
                    Matt Zimmermann

                    Miva Web Developer
                    Alchemy Web Development
                    https://www.alchemywebdev.com
                    Site Development - Maintenance - Consultation

                    Miva Certified Developer
                    Miva Professional Developer

                    https://www.dev4web.net | Twitter

                    Comment


                      #11
                      Originally posted by Matt Zimmermann View Post
                      Hi Jamie,
                      If I am not mistaken, each of those pages has a separate product count variable. For instance, CTGY uses l.settings:category_product_count and SRCH uses l.settings:search_product_count.
                      Well, duh me and bless you Matt!! I believe I've got it now thanks to your help!

                      This seems to do what I want (In case others need it):

                      Code:
                      <mvt:if expr="(l.settings:page:code EQ 'CTGY' AND l.settings:category_product_count GT 0) OR (l.settings:page:code EQ 'SRCH' AND l.settings:search_product_count GT 0) OR (l.settings:page:code EQ 'PLST')">
                          <mvt:item name="facets" />
                      <mvt:else>
                          <mvt:item name="category_tree" />
                      </mvt:if>
                      Jamie
                      Jamie Donaldson
                      JSDVS Web Design / Development
                      Web Design | Web Development | E-commerce Design & Integration

                      Comment


                        #12
                        jsdva , thank you for sharing that code. I am wondering about taking this a step further. I am wanting to display on the category page the category tree as facets with the product count instead of like a normal tree. I would also like to display just the child categories, not the entire tree.

                        Comment


                          #13
                          Originally posted by eldon99 View Post
                          jsdva , thank you for sharing that code. I am wondering about taking this a step further. I am wanting to display on the category page the category tree as facets with the product count instead of like a normal tree. I would also like to display just the child categories, not the entire tree.
                          Thank you eldon99! I think it is great when others post their fixes, so I try to do that whenever I can.

                          I know you can set the Facets as to how they appear category specific with category facet rules. I have not done this personally, but the docs do touch on it. https://docs.miva.com/how-to-guides/facets-category-search-filtering
                          Jamie Donaldson
                          JSDVS Web Design / Development
                          Web Design | Web Development | E-commerce Design & Integration

                          Comment


                            #14
                            Originally posted by Brennan View Post
                            Facets should only be displaying if there are products assigned to that category. Are you trying to get the global facet template elements not to display if there are not products?
                            What do you do if the facets are displaying and there are no products assigned to that category? I looked at docs Jamie references before I came looking for a post that touches on the issue I'm having. When I tried editing the filter at the Category level, it affected it on every other page.

                            Shouldn't this expression prevent the filters from displaying?

                            Code:
                            <mvt:if expr="l.settings:facets:facet_count GT 0 OR l.settings:category_listing:products_on_page_count GT 1 OR l.settings:all_products:products_on_page_count GT 1 OR l.settings:search_results:products_on_page_count GT 1">

                            Leslie Kirk
                            Miva Certified Developer
                            Miva Merchant Specialist since 1997
                            Previously of Webs Your Way
                            (aka Leslie Nord leslienord)

                            Email me: [email protected]
                            www.lesliekirk.com

                            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                            Comment


                              #15
                              Hi Leslie,

                              Do you have a link to a page with this issue?
                              Matt Zimmermann

                              Miva Web Developer
                              Alchemy Web Development
                              https://www.alchemywebdev.com
                              Site Development - Maintenance - Consultation

                              Miva Certified Developer
                              Miva Professional Developer

                              https://www.dev4web.net | Twitter

                              Comment

                              Working...
                              X