Skip Item in an Array/How to skip a Category in Category Tree

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ThePen
    Mini Mivite

    • Dec 2012
    • 33

    #1

    Skip Item in an Array/How to skip a Category in Category Tree

    Hey Miva People,

    I'm working on a mm5 store and I'm trying to figure out how keep a category active, but NOT have the category name appear in the category tree (in the Array). I've tried a few different ways to achieve this, however, I have been unsuccessful at this point. Please, if anyone has any tips or ideas on how I can get this mystery solved; please chime in, it would be greatly appreciated.

    Thanks!
    ThePen : )
  • JFancett
    Mivite


    • Feb 2007
    • 453

    #2
    Re: Skip Item in an Array/How to skip a Category in Category Tree

    Maybe create a custom category field named cattreedisplay. For the categories that you don't want to display, enter the value SKIP. Then right inside the category foreach loop in the cattree display, you could put a condition testing to see if the custom field value does NOT equal SKIP.
    Jason Fancett
    America's SPA-MART - "Where Spa Owners Shop SMART!"
    Check us out for all of your hot tub needs including spa covers, spa filters, spa chemicals and more.
    Miva Merchant forum users can use coupon code MIVAFORUM to receive $5 off your first order of $30 or more.

    Comment

    • Bruce - PhosphorMedia
      Developer Partner











      • Mar 2006
      • 11256

      #3
      Re: Skip Item in an Array/How to skip a Category in Category Tree

      You could also just create a top level category called Hidden and set that cat to inactive. Then assign the category (categories) to that you don't want to appear on the tree to that hidden category.
      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

      • ThePen
        Mini Mivite

        • Dec 2012
        • 33

        #4
        Re: Skip Item in an Array/How to skip a Category in Category Tree

        Thanks! It works and I was able to get this done thanks to your help. Now, I will do my best to explain what I did, in order to help other users.

        1. Go to utilities, in the left navigation list of your Miva Admin.

        2. Make sure "custom fields" is checked, if not, check it and hit update; at this point three tabs will appear (custom category fields,custom product fields & custom customer fields).

        3. click the tab of the section you want to create a custom field for i.e custom category fields,custom product fields & custom customer fields. In my case, I chose "custom category fields".

        4. Click add and input a code name and what you want to name the custom field, in my case, I used "skip_category" for the code and "Skip Category" for the name; then click update.

        5. Go to categories (or the section you've chosen to add a custom field), in the left navigation list of your Miva Admin.

        6. Select the category (or product you've chosen to add a custom field) by clicking edit.

        7. Click the custom fields tab and insert any html code you like, in my case I wrote the words "Skip". Then click, update.

        8. Click pages, in the left navigation list of your Miva Admin. and select the page template you would like to add the custom field to, in my case I selected 'CTGY' for "Category Display" and then click the "*Category Tree Template", (Note: Category Tree Template is global and you can find the same tab by clicking your store name in the left navigation of your admin, as well).

        9. Assign the custom field, by scrolling to the "custom field section down the page and highlight the custom field you created, in my case, I highlighted "Skip Category".

        10. insert the code expression, to use the custom field you created you can use the following "l.settings:cattree_category:customfield_values:cu stomfields:skip_category" (note: you may need to change certain parts of the code for example if you were in products it would be the following: l.settings:product:customfield_values:customfields :*insert custom field code here*)).

        Finally here is the code I used to complete this task. I can only hope this helps other people as you have helped me Jason : )

        <div id="category-tree">
        <mvt:foreach array="cattree_categories" iterator="cattree_category">
        <mvt:if expr="NOT ISNULL l.settings:category:id AND l.settings:category:id EQ l.settings:cattree_category:id">
        <div class="level-&mvte:cattree_category:level; active">
        <mvt:elseif expr="NOT ISNULL g.Category_Code AND ISNULL l.settings:category:id AND l.settings:cattree_category:code EQ g.Category_Code">
        <div class="level-&mvte:cattree_category:level; active">
        <mvt:else>
        <div class="level-&mvte:cattree_category:level;">
        </mvt:if>
        <mvt:if expr="ISNULL l.settings:cattree_category:customfield_values:cus tomfields:skip_category">
        <a href="&mvte:cattree_category:link;">
        <mvt:if expr="l.settings:cattree_category:image">
        <img src="&mvte:cattree_category:image;" alt="&mvte:cattree_category:name;" />
        <mvt:else>
        >> &mvte:cattree_category:name;
        </a>
        </mvt:if>
        </mvt:if>
        </div>
        </mvt:foreach>
        </div>

        Comment

        • ThePen
          Mini Mivite

          • Dec 2012
          • 33

          #5
          Re: Skip Item in an Array/How to skip a Category in Category Tree

          Thanks for responding, this method is a lot simpler :)

          Comment

          • JFancett
            Mivite


            • Feb 2007
            • 453

            #6
            Re: Skip Item in an Array/How to skip a Category in Category Tree

            Glad it worked out. You did the hard part though. Just happy my idea lead you down the right path.
            Jason Fancett
            America's SPA-MART - "Where Spa Owners Shop SMART!"
            Check us out for all of your hot tub needs including spa covers, spa filters, spa chemicals and more.
            Miva Merchant forum users can use coupon code MIVAFORUM to receive $5 off your first order of $30 or more.

            Comment

            • jsdva
              Mega Mivite





              • Apr 2006
              • 1166

              #7
              Re: Skip Item in an Array/How to skip a Category in Category Tree

              Originally posted by ThePen View Post
              Now, I will do my best to explain what I did, in order to help other users.
              Thank you ThePen! That will help more people than just me I am sure! Very very gracious of you to help others out!!

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

              Comment

              Working...
              X