cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1. 9 - How to add website filter inside the sales email template html file?

Magento 1. 9 - How to add website filter inside the sales email template html file?

Sales email template file: app/locale/en_US/template/email/sales/order_new.html. 

 

Sample workout :

 

{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}

<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td>
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="email-heading">
                        <?php 
                        $website_id = Mage::app()->getWebsite()->getId();
                        if($website_id == "2") : ?>
                       
                        <h1>Welcome you for your order from {{var store.getFrontendName()}}.</h1>

                        <?php else : ?>

                        <h1>Thank you for your order from {{var store.getFrontendName()}}.</h1>

                        <?php endif; ?>

                        <p>Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.</p>
                    </td>
                    <td class="store-info">
                        <h4>Order Questions?</h4>
                        <p>
                            {{depend store_phone}}
                            <b>Call Us:</b>
                            <a href="tel:{{var phone}}">{{var store_phone}}</a><br>
                            {{/depend}}
                            {{depend store_hours}}
                            <span class="no-link">{{var store_hours}}</span><br>
                            {{/depend}}
                            {{depend store_email}}
                            <b>Email:</b> <a href="mail to:{{var store_email}}">{{var store_email}}</a>
                            {{/depend}}
                        </p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="order-details">
            <h3>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
            <p>Placed on {{var order.getCreatedAtFormated('long')}}</p>
        </td>
    </tr>
    <tr class="order-information">
        <td>
            {{if order.getEmailCustomerNote()}}
            <table cellspacing="0" cellpadding="0" class="message-container">
                <tr>
                    <td>{{var order.getEmailCustomerNote()}}</td>
                </tr>
            </table>
            {{/if}}
            {{layout handle="sales_email_order_items" order=$order}}
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="address-details">
                        <h6>Bill to:</h6>
                        <p><span class="no-link">{{var order.getBillingAddress().format('html')}}</span></p>
                    </td>
                    {{depend order.getIsNotVirtual()}}
                    <td class="address-details">
                        <h6>Ship to:</h6>
                        <p><span class="no-link">{{var order.getShippingAddress().format('html')}}</span></p>
                    </td>
                    {{/depend}}
                </tr>
                <tr>
                    {{depend order.getIsNotVirtual()}}
                    <td class="method-info">
                        <h6>Shipping method:</h6>
                        <p>{{var order.shipping_description}}</p>
                    </td>
                    {{/depend}}
                    <td class="method-info">
                        <h6>Payment method:</h6>
                        {{var payment_html}}
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

{{template config_path="design/email/footer"}}

 

I just want to add if-else condition like, inside the class(<td class="email-heading">)

 

<td class="email-heading">
                        <?php 
                        $website_id = Mage::app()->getWebsite()->getId();
                        if($website_id == "2") : ?>
                       
                        <h1>Welcome you for your order from {{var store.getFrontendName()}}.</h1>

                        <?php else : ?>

                        <h1>Thank you for your order from {{var store.getFrontendName()}}.</h1>

                        <?php endif; ?>

                        <p>Once your package ships we will send an email with a link to track your order. Your order summary is below. Thank you again for your business.</p>
                    </td>

Any help thank.