I am trying to create a new custom quote template that displays specific Terms and Conditions based on the Items that are in the quote.
Currently I have created a rich text Product Property called `custom_terms` . So if it’s a product/service that requires specific terms of agreement, those can be spelled out at the product level.
I am not wanting these terms to display in the actual Items table, but in the bottom of the page where the “Terms” section is displayed. (I’m new to Hubl, so apologies if this is easy peasy. )
I’m looking to accomplish the logic of: Based on the items on the quote, if any of those items have Custom Terms, display it in a <p> tag at the bottom of the quote in the appropriate section.
{{ items.custom_terms }} didn’t seem to work for me, hopefully just something small I’m missing!
Are you working with a custom quotes theme template? If so, you could try looking at the entire object to see if the value you need is in there. If you see it, you could then write a conditional logic to display if that is present.
{{LINE_ITEMS|pprint}}
Thanks @Jake_Lett ! Started down the path of custom product properties earlier today after watching your YouTube. Thanks for doing that!
Yes I am working on a custom quotes theme template. When I try {{LINE_ITEMS|pprint}} it simply returns `null`.
{{ template_data|pprint }} does return the custom terms in it’s response for the item on the quote that have custom terms. Just not sure how to grab and display them where I want.
Oh thats awesome. I guess I have to help you now! You will need to do some experimentation but give this a try. It just comes down to trial and error to drill down to the property you need.
{% set LINE_ITEMS = template_data.quote.associated_objects.line_items %}
{{LINE_ITEMS|pprint}}
{% if LINE_ITEMS.yourpropertyValue == "yourvalue" %}
I got it
{% endif %}
The flow base template defines it slightly different, and using the below, still gives me a blank page.. hmmm (I’m not overly interested in an IF statement per say, just if there are one or many custom_terms, I want them displayed under the Terms section of the quote with at least a <br> between them, if not wrapped in their own <p> or <div>
{% set line_items = associated_objects.line_items_by_start_date ? associated_objects.line_items_by_start_date.PRESENT : associated_objects.line_items %}
{% if line_items.custom_terms %}
{{ line_items.custom_terms }}
{% endif %}
Following your Youtube video, I can get the custom rich text box to display in the items table correctly! I just can’t seem to figure out how to display it/them (if more than one) elsewhere on the quote theme template.
Think I got it figured out. First using a for loop to go through the line items, then an IF statement to check if there are any custom terms, then display it. So far, this has worked for me!
{% for item in line_items %}
{% if item.custom_terms != null %}
<h2>{{ item.name}} Terms </h2>
{{ item.custom_terms }}
{% endif %}
{% endfor %}
Holy **bleep**. I just want to say that this solution solved a MAJOR problem for me, so thank you thank you thank you beyond belief. You’re an absolute rock star.
These are all the objects you could PPRINT to see what they contain. Then you could copy and paste the output in an online json viewer like https://jsonpathfinder.com/
ahhh i’m based off the ‘flow’ quote template and it isn’t all caps, so {{ line_items|pprint }} does return data now and I can see the custom terms in there. However, everything I try to copy and paste from it into JSON Path Finder just gives an unexpected error and won’t let me drilldown?