Announcement

Collapse
No announcement yet.

Custom Field use on CTGY Page - Child Categories

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

    Custom Field use on CTGY Page - Child Categories

    So on the CTGY Page all I want to do is use a custom category field called ShortName if it is populated in place of the &mvte:subcategory:name;
    What am I doing wrong?
    I do not get any compile errors but am not getting the expected results.
    For example if the Child Category) Name is "Computer Science" and the Custom Field ShortName is populated with "CS" I want to display "CS"

    <mvt:item name="customfields" param="Read_Category_Code( l.settings:category:code, 'shortCatName', g.sName )" />
    <mvt:if expr="mvt:global:sName; NE ''">
    <strong class="x-product-list__name u-text-uppercase">&mvt:global:sName;</strong>
    <mvt:else>
    <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong>
    </mvt:if>

    I could not find a clear example dealing with this. Simple problem and probably a simple solution and I have some syntax wrong.
    Any help would really be appreciated.

    #2
    Try modifying your code to something like this using a local variable instead of a global one:
    Code:
    <mvt:item name="customfields" param="Read_Category_Code(l.settings:category:code, 'shortCatName', l.settings:sName)" />
    <mvt:if expr="NOT ISNULL l.settings:sName">
        <strong class="x-product-list__name u-text-uppercase">&mvt:sName;</strong>
    <mvt:else>
        <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong>
    </mvt:if>
    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


      #3
      Thank you I got this working!!
      Now I am trying to split out a multi-test custom field and am not finding much documentation on custom fields that are arrays
      So if I have a custom field called deckSpecAI and I want to explode out the values into a list on the product display layout template
      Example values returned: Manufactured in the USA, Maple Construction, Limited Design
      I want to just display the three values like this:

      Additional Info:
      • Manufactured in the USA
      • Maple Construction
      • Limited Design
      seems simple enough. Obviously I have something wrong in this chunk of code. If anyone has a solution it would be appreciated.

      <mvt:if expr="NOT ISNULL trim(l.settings:product:customfield_values:customf ields:deckSpecAI)">
      <b>Additional Info:<br><ul>
      <mvt:assign name="g.string" value="l.settings:product:customfield_values:custo mfields:deckSpecAI" />
      <mvt:assign name="g.delimiter" value="','" />
      <mvt:do file="g.Module_Library_Utilities" name="l.null" value="SplitString( g.string, g.delimiter, g.makearray )" />
      <mvt:foreach iterator="bullet" array="makearray">
      <li>&mvt:bullet;</li>
      </mvt:foreach>
      </ul>
      </mvt:if>
      Last edited by Rick Wilson; 06-12-18, 02:24 PM.

      Comment


        #4
        I got it to work
        <mvt:if expr="NOT ISNULL trim(l.settings:product:customfield_values:customf ields:deckSpecAI)">
        <b>Additional Info:<br><ul>
        <mvt:assign name="g.string" value="l.settings:product:customfield_values:custo mfields:deckSpecAI" />
        <mvt:do file="g.Module_Library_Utilities" name="l.success" value="SplitString( g.string, ',', g.splitString )" />
        <mvt:foreach iterator="line" array="global:splitString">
        <li>&mvt:line;</li>
        </mvt:foreach>
        </ul>
        </mvt:if>

        Comment

        Working...
        X