Announcement

Collapse
No announcement yet.

Checking Custom Field

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

  • mstella1
    replied
    Perfect! That worked and saved my sanity!

    Finished version in case anyone later needs to reference:

    HTML Code:
     <ul>
    <li>Made in USA<br></li>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn1', g.MsgLn1)" /><mvt:if expr="g.MsgLn1"><li>&mvte:global:MsgLn1;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn2', g.MsgLn2)" /><mvt:if expr="g.MsgLn2"><li>&mvte:global:MsgLn2;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn3', g.MsgLn3)" /><mvt:if expr="g.MsgLn3"><li>&mvte:global:MsgLn3;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn4', g.MsgLn4)" /><mvt:if expr="g.MsgLn4"><li>&mvte:global:MsgLn4;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn5', g.MsgLn5)" /><mvt:if expr="g.MsgLn5"><li>&mvte:global:MsgLn5;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn6', g.MsgLn6)" /><mvt:if expr="g.MsgLn6"><li>&mvte:global:MsgLn6;</li></mvt:if>
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn7', g.MsgLn7)" /><mvt:if expr="g.MsgLn7"><li>&mvte:global:MsgLn7;</li></mvt:if>
    </ul>
    Thank you Bruce!

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Here's how i'd do it if in a hurry
    Code:
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn1', g.MsgLn1)" />
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn2', g.MsgLn2)" />
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn3', g.MsgLn3)" />
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn4', g.MsgLn4)" />
    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn5', g.MsgLn5)" />
    
    <ul>
    <li>Made in USA<br></li>
    <mvt:if expr="g.MsgLn1"><li>&mvte:global:MsgLn1;</li></mvt:if>
    <mvt:if expr="g.MsgLn2"><li>&mvte:global:MsgLn2;</li></mvt:if>
    <mvt:if expr="g.MsgLn3"><li>&mvte:global:MsgLn3;</li></mvt:if>
    <mvt:if expr="g.MsgLn4"><li>&mvte:global:MsgLn4;</li></mvt:if>
    <mvt:if expr="g.MsgLn5"><li>&mvte:global:MsgLn5;</li></mvt:if>
    </ul>
    Note: in the code i copied, there was a space before the custom field name. make sure that is not there ' custom_field' is not the same as 'custom_field'

    Leave a comment:


  • mstella1
    replied
    Not having any luck with this, I had to step away for a bit and jumping back in. Maybe there is another way and I am overcomplicating this. I did try mv/exit and that didn't work the way we needed it to. I did try your suggestion above Bruce but it wasn't working for me, but like I said maybe I was missing the obvious here.

    In the list below I have 5 custom product fields. If the custom field is empty I don't want to display the bullets in the list and to skip the line.

    Thanks for the help, I appreciate it!


    HTML Code:
     <ul>
    <li>Made in USA<br></li>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn1', g.MsgLn1)" />&mvte:global:MsgLn1;<br></li>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn2', g.MsgLn2)" />&mvte:global:MsgLn2;<br></li>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn3', g.MsgLn3)" />&mvte:global:MsgLn3;<br></li>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn4', g.MsgLn4)" />&mvte:global:MsgLn4;<br></li>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn5', g.MsgLn5)" />&mvte:global:MsgLn5;<br></li>
    </ul>

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    try just:

    Code:
    <mvt:if expr="l.settings:product:customfield_values:customfields:MsgLn5">
    Show nothing
    <mvt:else>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn5', g.MsgLn5)" />&mvte:global:MsgLn5;</li>
    </mvt:if>
    and also test right before with
    [&mvt:product:customfield_values:customfields:Ms gLn 5;]<br>

    Leave a comment:


  • mstella1
    replied
    Oh I am not familiar with that way. If I am following you then yes, "show nothing" was just my way of trying to explain this LOL!

    How would I incorporate that?

    Leave a comment:


  • nottheusual1
    replied
    Would "<mvt:exit />" work versus the "Show nothing" ????

    Leave a comment:


  • mstella1
    started a topic Checking Custom Field

    Checking Custom Field

    Hi,

    I'm trying to test a custom field so I can display text accordingly but not having any luck.

    If the custom field is empty I don't want anything to show. If there is anything in the field I want the text to display.

    Maybe there is a better way to do this I am just stumped right now. Custom Fields are assigned.

    HTML Code:
    <mvt:if expr="len(trim(l.settings:product:customfield_values:customfields:MsgLn5)) LE 0">
    Show nothing
    <mvt:else>
    <li><mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' MsgLn5', g.MsgLn5)" />&mvte:global:MsgLn5;</li>
    </mvt:if>

    Thanks
Working...
X