Edit magento email template

2019-08-13 00:09发布

问题:

I have created a new transaction email

using

system->configuration->transaction email

I want to show some information from database

petname

room

type

how to fetch these information from database and show in email

回答1:

you can use template files to add extra information in transaction email:

Lets take example of new order template:

you will find something like below in you email format/template files:

{{layout handle="sales_email_order_items" order=$order}}

search for your handle name in sales.xml

/app/design/frontend/default/layout/sales.xml

You will get something like this in you sales.xml files:

<sales_email_order_items>
      <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
          <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
          <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
      </block>
  </sales_email_order_items>

Above xml makes it clear that content is being generated by email/order/items.phtml template file, open that files and add the content that you want to include it's better to put this files in your current theme instead of chaning it in core.



标签: php magento