The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Email Templates are not rendered/elements (images) are missing

I built a couple of email templates (Basically plain html with a little css and incredibly minimal amounts of twig) for different categories.

The categories are single donation, recurring donation, and sponsorship.

For sponsorship the email renders out perfectly, but the links to all the images are not connected properly. I also may have messed up with the twig as that is not appearing either.

For the other two emails though, all that is being sent is just '...' and nothing more. Gmail thinks its a clipped message, but nothing is inside of the clipped message either.

I was wondering if there was anyway to fix this?
Comments
  • the store domain is newlife4kids.foxycart.com
  • fc_adamfc_adam FoxyCart Team
    @connor_wilson,

    Thanks for noting your store domain. I've taken a look at your email template set on your categories.

    For the sponsorship template - the images look ok there. Do none of them work for you, or just specific ones aren't working? To confirm - your email client isn't just hiding the images, and you need to click a link to show them in the email?

    For the Twig, I believe you're referring to the child's name with {{ items[0].custom_fields.Child_Name.is_hidden }}? If so - you'll need to make a bit of a change there. Custom product options are available through an options<code> array on the item, so you'll need to loop through to find the one you want like this:

    <pre><code>{% set child_name = "" %}
    {% for option in items[0].options %}
    {% if option.name == "Child Name" %}
    {% set child_name = option.value %}
    {% endif %}
    {% endfor %}


    If you include that above where you want to output the name, you can then just use {{ child_name }} to output the value.

    For the empty email issue - I wonder if that relates to the script tag included near the end of the head block. Could you try removing that script tag completely and testing again?
  • okay, I'll see if I can do that real quick.

    To answer your first question, the email client (gmail) seems to be doing something wonky with the links, but to double check I went to the foxycart link (the magicached image) and it was not showing up there either.

    So the src for the image is
    https://ci5.googleusercontent.com/proxy/OYbh00A7AneV3Bw_QUZnZPivAEXdrhW0jyMM5bYnd2cQhQqnsmjv8rvEAoTBG5AnCZh516PnXl0HvB8wJGQpLFlqHfU2pjMCTKFT4vuY8usGfy_8Q8SCcQOSc3St9VLGp4UqNvGjY9vIzNZw2W2e84w6r_TW80Qeo4Wkn3e7EuXsjtlRSQtMbEpleY6u4n3qr0nUFl8hl4PTadFEGtJ5o1Qo-75rmehE9FNUMHsE3Mv5RH6jWVnBUQLDblM_Rgk=s0-d-e1-ft#https://newlife4kids.foxycart.com/cache.php?url=http%3A%2F%2Fexcelerondesigns.com%2F%7Enewlifek%2Fassets%2Fdefault%2Fimages%2Fsponsor%2Fnewlife-kids-660x740-bruneau.jpg%7D
    apart from the google nonsense, it all seems legit.

    I was able to get the image src using
    {{ items[0].image }}
    which feels a little crude but hey, if it works it works. But it still isn't showing up.

    Update: I was able to get the name to appear! That was the perfect lead. I also removed the script tag from beneath the head and that didn't fix it. Is it possible that something is happening to the caching of the templates? The code is almost a copy from the sponsorship email, apart from the content of the email.

    I did the for loop that you mentioned above and that got it to work.

  • fc_adamfc_adam FoxyCart Team
    @connor_wilson,

    Hmm weird. I've copied your one-time category email template to my own store - and sending it as is, I can replicate the same ... email contents in GMail. If I then only delete the script tag that's right before the closing head tag, and trigger the same email to send again, it displays as expected, with all images showing too. At least from that, it definitely seems like the script tag is causing issues.

    For the image, I think I see the issue - you've got an extra closing curly bracket at the end: {{ image }}} - it should just be {{ image }}. For what it's worth - it was fine for you to access it as {{ items[0].image }} too - you can remove the extra code you added for setting the custom image variable if you want.
  • Yep! that did it, thank you so much! Thanks for the tips with the twig code as well!
  • fc_adamfc_adam FoxyCart Team
    @connor_wilson,

    Awesome, I'm glad that got it working!
Sign In or Register to comment.