Adding another text_greeting language text for order confirmation mail based on product model code
Posted: Sun Nov 26, 2017 10:03 pm
Hi, I am trying to add an condition in order.tpl file which will check specific product code and based on that it will select customized greeting message and sending this in to order confirmation mail to the customer. I executed the below changes via VQMOD but still it is catching old default greeting if condition matches with new language greeting. Do you see any issues with this. Thank you in advance
<file name="catalog/language/english/mail/order.php">
<operation>
<search position="replace">
<![CDATA[$_['text_new_greeting'] = 'Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 4 - 6 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';]]>
</search>
<add>
<![CDATA[
$_['text_new_greeting'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 4 - 6 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
$_['text_new_one'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 10 - 15 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
$_['text_new_two'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 6 - 10 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
]]>
</add>
</operation>
</file>
<file name="catalog/model/checkout/order.php">
<operation>
<search position="replace">
<![CDATA[$data['text_greeting'] = sprintf($language->get('text_new_greeting'), $order_info['store_name']);]]>
</search>
<add>
<![CDATA[
$data['text_greeting'] = sprintf($language->get('text_new_tevo'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
$data['text_one'] = sprintf($language->get('text_new_one'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
$data['text_two'] = sprintf($language->get('text_new_two'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
]]>
</add>
</operation>
</file>
order.tpl
I was implementing direct changes in order.tpl in my local, yet to apply vqmod but still below the code used by me.
Replacing this
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
to
<?php if($product['model']=="BAY-0165") ?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_one; ?>
</p>
<?php }?>
<?php elseif($option['name']=="Extended Z ") ?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_two; ?>
</p>
<?php }?>
<?php else?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_greeting; ?>
</p>
<?php }?>
<file name="catalog/language/english/mail/order.php">
<operation>
<search position="replace">
<![CDATA[$_['text_new_greeting'] = 'Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 4 - 6 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';]]>
</search>
<add>
<![CDATA[
$_['text_new_greeting'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 4 - 6 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
$_['text_new_one'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 10 - 15 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
$_['text_new_two'] = '<b>Dear %s %s,</b><br /><br />Thank you for Shopping with %s. <br><br> You have completed your payment successfully <br><br> Your Order will be shipped within 6 - 10 Business days <br><br> As soon as your order is fulfilled and shipped, we will send you an email notification with tracking details <br><br> <b>Happy 3D Printing!!! </b><br>';
]]>
</add>
</operation>
</file>
<file name="catalog/model/checkout/order.php">
<operation>
<search position="replace">
<![CDATA[$data['text_greeting'] = sprintf($language->get('text_new_greeting'), $order_info['store_name']);]]>
</search>
<add>
<![CDATA[
$data['text_greeting'] = sprintf($language->get('text_new_tevo'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
$data['text_one'] = sprintf($language->get('text_new_one'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
$data['text_two'] = sprintf($language->get('text_new_two'), $order_info['payment_firstname'],$order_info['payment_lastname'],$order_info['store_name']);
]]>
</add>
</operation>
</file>
order.tpl
I was implementing direct changes in order.tpl in my local, yet to apply vqmod but still below the code used by me.
Replacing this
<p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
to
<?php if($product['model']=="BAY-0165") ?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_one; ?>
</p>
<?php }?>
<?php elseif($option['name']=="Extended Z ") ?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_two; ?>
</p>
<?php }?>
<?php else?>
<?php { ?>
<p style="margin-top: 0px; margin-bottom: 20px;">
<?php echo $text_greeting; ?>
</p>
<?php }?>