0

Please correct my terminology.

Magento apparently allows "pseudo-code" like this in email templates (and elsewhere I suppose):

{{htmlescape var=$order.getBillingAddress().getName()}}

It mixes right in with the html to create dynamic output.

Now, I know you can do this in php to get the logo src:

<?php echo $this->getLogoSrc() ?>

Is there any way I can do this in the email templates? Every time we change our logo, we have to change the hard-coded img src in the email templates as well.

1

You can add logo's for the email templates from the backend. This would eliminate the need to change anything hardcoded. In the email template it's outputted with the following code

<a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{var logo_url}}" alt="{{var logo_alt}}" border="0"/></a>

You can follow instructions on this page.

Optionally you could change the email templates and models calling them to parse an extra variable containing the path to your logo but then you should also have an admin section where you can indicate what the path should be.

2
  • Thanks for your answer. In my email templates, the src property is hardcoded html. Another developer may have changed it from default. I've changed the logo in the backend and it shows up on the frontend automatically. But for the above reason, it does not affect the email templates. What variable is usually there to display the logo? Sep 11 '13 at 8:00
  • I've edited my answer with the default code, that should help you.
    – Sander Mangel
    Sep 11 '13 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.