0

Following is my sales order email template sample,

Docroot = app\locale\en_US\template\email\sales\order_new.html

 <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td class="email-heading">
                        <h1>Thank you for your order from {{var store.getFrontendName()}}.</h1>     
                        <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="mailto:{{var store_email}}">{{var store_email}}</a>
                            {{/depend}}
                        </p>
                    </td>
                </tr>
            </table>

I just want to alter my thank you message based on the website in my multistore website.

If website id == 1 my message should be

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

else

<h1>Welcome our land your order from {{var store.getFrontendName()}}.</h1>

1 Answer 1

1

You can not use direct if condition like this

{{if order.websiteid == 1}}
 <p>Your text goes here</p>
{{/if}}

But you can define the function or flag in your order model like this.

with function

public function shouldShowBlock() {
        /* your code to check website condition and return true or false */
    }

and in email template

    {{if order.shouldShowBlock()}}
 <p>Your text goes here</p>
{{/if}}

Just copy app/code/Mage/Sales/Model/Order.php to app/code/local/Mage/Sales/Model/Order.php then write you function to end of that file

13
  • may i know how to write order mode and where to write itl?
    – zus
    Commented Mar 18, 2020 at 6:09
  • For your kind attention, i am using Magento version 1.9
    – zus
    Commented Mar 18, 2020 at 6:29
  • ohh then you can get reference from here kiwee.eu/magento-how-to-override-core-model-class
    – Zahirabbas
    Commented Mar 18, 2020 at 6:32
  • app\locale\en_US\template\email\sales how to take the model?
    – zus
    Commented Mar 18, 2020 at 6:44
  • didn't get your above comment
    – Zahirabbas
    Commented Mar 18, 2020 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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