Use Custom Category Fields in Subcategory listing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SidFeyDesigns
    Mighty Mivite








    • Jan 2012
    • 598

    #1

    Use Custom Category Fields in Subcategory listing

    Trying to display a custom category field for for the anchor text here is the category page template

    Code:
    <mvt:item name="html_profile" /><mvt:if expr="g.mobile EQ 'TRUE'">
    	<mvt:item name="mobile_content" />
    <mvt:else>
    <head>
    	<title>&mvt:category:name;</title>
            <base href="&mvt:global:basehref;">
            <mvt:item name="prodctgy_meta" param="ctgy" />
    	<mvt:item name="head" param="head_tag" />
         
    </head>
    
    
    <mvt:item name="body">
    	<mvt:item name="hdft" param="global_header" />
    	<div id="wrap">
    	<table cellpadding="0" cellspacing="0" width="100%">
    	<tr><td align="left" valign="top">
    	<table cellpadding="0" cellspacing="0" width="100%">
    	<tr><td align="left" valign="bottom" colspan=2 >
    		<mvt:item name="navbar" />
    	</td></tr>
    
    
    	<tr><td align="left" valign="bottom"> 
    		<mvt:item name="hdft" param="header" />
    	</td></tr>
    
    
    	<tr><td id="border-right" align="left" valign="top">
    		<table width="225" cellpadding="0" cellspacing="0">
    		<tr><td align="left" valign="top">
    			<mvt:item name="affiliatelink" />
    			<mvt:item name="category_tree" />
    		</td></tr>
    		</table>
    	</td><td id="border-left" align="left" valign="top" width="100%">
    		<br>
    		<blockquote>
    		<mvt:item name="toolkit" param="breadcrumb|b_count|g.Category_Code" />
    		<mvt:if expr="b_count GT 0">
    			<a href="http://www.loveisarose.com/" title="Home">Home</a> &gt;
    			<mvt:foreach iterator="breadcrumb" array="breadcrumbs"> 
    				<mvt:if expr="g.Category_Code EQ l.settings:breadcrumb:code">
    					<b>&mvt:breadcrumb:name;</b>
    				<mvt:else>
    					<a href="/&mvte:breadcrumb:code;.html" title="&mvt:breadcrumb:name;">&mvt:breadcrumb:name;</a> &gt;
    				</mvt:if>
    			</mvt:foreach>
    		</mvt:if><br>
    			<h1>&mvte:category:name;</h1>
                    <mvt:item name="prod_ctgy_hdft" param="ctgy_header" /><br>
    		<br>
                    <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
    		<mvt:if expr="ccount GT 0">
    			<mvt:item name="subcategory_listing" />
    		</mvt:if>
    		<mvt:item name="toolkit" param="cxp|pcount|l.all_settings:category:id" />
    		<mvt:if expr="pcount GT 0">
    			<mvt:item name="product_list" />
    		</mvt:if>
    		<mvt:item name="prod_ctgy_hdft" param="ctgy_footer" /><br>
    		<br>
    		<mvt:item name="toolkit" param="breadcrumb|b_count|g.Category_Code" />
    		<mvt:if expr="b_count GT 0">
    			<a href="http://www.loveisarose.com/" title="Home">Home</a> &gt;
    			<mvt:foreach iterator="breadcrumb" array="breadcrumbs"> 
    				<mvt:if expr="g.Category_Code EQ l.settings:breadcrumb:code">
    					<b>&mvt:breadcrumb:name;</b>
    				<mvt:else>
    					<a href="/&mvte:breadcrumb:code;.html" title="&mvt:breadcrumb:name;">&mvt:breadcrumb:name;</a> &gt;
    				</mvt:if>
    			</mvt:foreach>
    		</mvt:if><br>
    		<br>
    		</blockquote>		
    	</td></tr>
    
    
    	<tr><td align="left" valign="bottom">
    		<mvt:item name="hdft" param="footer" />
    	</td></tr>
    	</table>
    	</td></tr>
    	</table>
    	</div>
    	<mvt:item name="hdft" param="global_footer" />
    </mvt:item>
    </mvt:if>
    </html>
    her is the subcategory listing code:

    Code:
    <mvt:item name="toolkit" param="customcategoryc|anchortext|l.all_settings:sub_category:code|AHT" />&mvte:global:anchortext;
    <div class="subcat-header">Gold Rose Anniversary Gifts Delivery Service Areas</div>
    <div id="subcategory-listing">
    	<mvt:foreach iterator="sub_category" array="sub_categories">
    		<mvt:if expr="(pos1 MOD 4) EQ 1">
    			<div class="subcategory-wrapper first">
    		<mvt:else>
    			<div class="subcategory-wrapper">
    		</mvt:if>
    		<mvt:if expr="NOT ISNULL l.settings:sub_category:customfield_values:customfields:AHT">
    			<a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">&mvt:sub_category:customfield_values:customfields:AHT;</a>
    		<mvt:else>
    			<a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">&mvt:sub_category:name;</a>
    		</mvt:if>
    		</div>
    	</mvt:foreach>
    </div>
    <mvt:if expr="l.settings:product_count GT 0">
    <div class="subcat-header">Products</div>
    <mvt:else>
    <div></div>
    </mvt:if>
    Nick Harkins
    www.loveisarose.com
  • Dan - Glendale Designs
    Mega Mivite


    • Sep 2006
    • 2904

    #2
    Re: Use Custom Category Fields in Subcategory listing

    You may want to transition to using Miva Merchant's stock custom field capabilities: http://www.mivamerchant.com/videos/a...-documentation

    That said, the customcategoryc Toolkit function needs to be within the sub-category foreach loop for it to properly pickup l.all_settings:sub_category:code for each of those subcats.

    Comment

    • SidFeyDesigns
      Mighty Mivite








      • Jan 2012
      • 598

      #3
      Re: Use Custom Category Fields in Subcategory listing

      okay i get that and that made it display it but i want it to be within the link.

      Code:
      <div class="subcat-header">Gold Rose Anniversary Gifts Delivery Service Areas</div><div id="subcategory-listing">
          <mvt:foreach iterator="sub_category" array="sub_categories">
              <mvt:if expr="(pos1 MOD 4) EQ 1">
                  <div class="subcategory-wrapper first">
              <mvt:else>
                  <div class="subcategory-wrapper">
              </mvt:if>
      <mvt:item name="toolkit" param="customcategoryc|anchortext|l.all_settings:sub_category:code|AHT" />
      [COLOR=#ff0000][I]&mvte:global:anchortext;[/I][/COLOR]
              <mvt:if expr="NOT ISNULL l.settings:sub_category:customfield_values:customfields:AHT">
                  <a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">&mvt:sub_category:customfield_values:customfields:AHT;</a>
              <mvt:else>
                  <a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">&mvt:sub_category:name;</a>
              </mvt:if>
              </div>
          </mvt:foreach>
      </div>
      <mvt:if expr="l.settings:product_count GT 0">
      <div class="subcat-header">Products</div>
      <mvt:else>
      <div></div>
      </mvt:if>
      when i move the &mvte:global:anchortext; into the link it no longer displays. it skips the first if statement and displays the else. the following code is my attempt to have it displayed as a link

      Code:
      <div class="subcat-header">Gold Rose Anniversary Gifts Delivery Service Areas</div><div id="subcategory-listing">
          <mvt:foreach iterator="sub_category" array="sub_categories">
              <mvt:if expr="(pos1 MOD 4) EQ 1">
                  <div class="subcategory-wrapper first">
              <mvt:else>
                  <div class="subcategory-wrapper">
              </mvt:if>
      <mvt:item name="toolkit" param="customcategoryc|anchortext|l.all_settings:sub_category:code|AHT" />
              <mvt:if expr="NOT ISNULL l.settings:sub_category:customfield_values:customfields:AHT">
                  <a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">[COLOR=#ff0000][I]&mvte:global:anchortext;[/I][/COLOR]</a>
              <mvt:else>
                  <a href="/&mvt:sub_category:code;.html" title="&mvt:sub_category:name;">&mvt:sub_category:name;</a>
              </mvt:if>
              </div>
          </mvt:foreach>
      </div>
      <mvt:if expr="l.settings:product_count GT 0">
      <div class="subcat-header">Products</div>
      <mvt:else>
      <div></div>
      </mvt:if>

      i know i'm just missing a minor detail thanks for the help
      Last edited by SidFeyDesigns; 09-22-14, 07:28 AM.
      Nick Harkins
      www.loveisarose.com

      Comment

      • Dan - Glendale Designs
        Mega Mivite


        • Sep 2006
        • 2904

        #4
        Re: Use Custom Category Fields in Subcategory listing

        You need to test against the g.anchortext variable, not l.settings:sub_category:customfield_values:customf ields:AHT

        Code:
        <mvt:if expr="NOT ISNULL g.anchortext">
        or

        Code:
        <mvt:if expr="g.anchortext">

        Comment

        • SidFeyDesigns
          Mighty Mivite








          • Jan 2012
          • 598

          #5
          Re: Use Custom Category Fields in Subcategory listing

          yup worked perfectly. thank you very much. any chance you'd be able to have any input on this other thread i have?



          if not no worries. i do appreciate your help
          Nick Harkins
          www.loveisarose.com

          Comment

          Working...
          X