Magento – Dynamic code for logo src for use in email templates, possibly using short tags

email-templates

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.

Best Answer

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.