Custom field in subcategory_listing

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

    • Sep 2015
    • 20

    #1

    Custom field in subcategory_listing

    I have a custom field defined for categories and I want to add it to the sub category listing on the CTGY page. I can't figure out how to reference my field. The content is just a short description/call to action for what is in the category. Here is the codem the bold is my the expression that I can't get to work. Just brings back nothing:

    <mvt:foreach iterator="sub_category" array="subcats">
    <div class="col-md-4 col-sm-4 col-xs-6 subcategory-wrapper">
    <div class="subcategory-item box-shadow">
    ...
    <div class="item-details">
    <h5><a href="&mvt:sub_category:link;">&mvte:sub_category: name;</a></h5>
    <p>&mvt:sub_category:customfield_values:customfields: category_short_desc;</p>
    </div>
    </div>
    </div>
    </mvt:foreach>
  • Ron Frigon
    Mighty Mivite



    • Dec 2009
    • 651

    #2
    Re: Custom field in subcategory_listing

    Not sure if there's a way to do that without Toolkit. But if you do...

    Try adding this just inside the foreach loop:

    <mvt:item name="toolkit" param="customcategory|shortdesc|l.all_settings:sub _category:id|category_short_desc" />

    Then call the item with: &mvte:global:shortdesc;
    Ron Frigon
    Jedi Webmaster Obi-Ron Kenobi

    Comment

    • jsmirnow
      Mini Mivite

      • Sep 2015
      • 20

      #3
      Re: Custom field in subcategory_listing

      I don't have toolkit and I'm a bit of a noob to Miva, but I can verify that I can call custom fields on Products without toolkit. Not sure why it doesn't work on a category.

      Comment

      • Ron Frigon
        Mighty Mivite



        • Dec 2009
        • 651

        #4
        Re: Custom field in subcategory_listing

        I havent used the new custom field functions very much, but you may be able to find something here to work for you without toolkit:

        http://www.miva.com/videos/category/custom-fields

        http://www.miva.com/videos/articles/...-documentation
        Ron Frigon
        Jedi Webmaster Obi-Ron Kenobi

        Comment

        • Brennan
          Super Moderator









          • Jun 2009
          • 3481

          #5
          Re: Custom field in subcategory_listing

          The links Ron posted are a great resource to explain the code below. There are two steps:

          1. Read the Custom Category Field Value
          2. Output it to the page.

          Code:
          <mvt:foreach iterator="sub_category" array="subcats">
          	<div class="col-md-4 col-sm-4 col-xs-6 subcategory-wrapper">
          		<div class="subcategory-item box-shadow">
          			...
          			<div class="item-details">
          				<h5><a href="&mvt:sub_category:link;">&mvte:sub_category: name;</a></h5>
          				[COLOR=#ff0000]<mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category:code,'category_short_desc', g.category_short_desc)" />[/COLOR]
          [COLOR=#ff0000]				<p>&mvte:global:category_short_desc;</p>[/COLOR]
          			</div>
          		</div>
          	</div>
          </mvt:foreach>
          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment

          • jsmirnow
            Mini Mivite

            • Sep 2015
            • 20

            #6
            Re: Custom field in subcategory_listing

            Thanks! That did it. I was oh so close after checking out the articles, but not close enough:

            Code:
            <mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category:[COLOR=#ff0000]category_code[/COLOR],'category_short_desc', l.settings:customfields)" />

            Comment

            Working...
            X