Page 1 of 1

Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 10:03 pm
by kevinbarnes
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 }?>

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 10:20 pm
by straightlight
Do you see any issues with this.
One issue, so far. The OC version is not posted.

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:12 pm
by kevinbarnes
Sorry about that, It is OC 2.0.3.1

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:26 pm
by straightlight
A solution can be provided, yes. However, by editing core files at the same time you edit an XML file, it may not guarantee its success. Is there a purpose / goal on why these files needs to be edited separately rather than editing entirely from XML?

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:36 pm
by kevinbarnes
I was testing why the simple if else was not working. I am not insisting to change in core. Even this .tpl changes can be added to XML without touching core. So you are saying, if i add this changes in XML , will make work? I don't see the logic

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:44 pm
by straightlight
In this case, can you post the attached XML file?

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:55 pm
by kevinbarnes
<file name="catalog/view/theme/default/template/mail/order.tpl">
<operation>
<search position="replace">
<![CDATA[ <p style="margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>]]>
</search>
<add>

<![CDATA[

<?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 }?>
]]>
</add>
</operation>
</file>

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Sun Nov 26, 2017 11:57 pm
by straightlight
Please post the complete file as an attachment in order to troubleshoot these codes.

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 12:08 am
by kevinbarnes
Attached VQMOD XML

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 1:07 am
by straightlight
From the VQMod Manager or, if using OCMod, from the admin - > extensions page, do you see any recent entries in the logs?

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 1:14 am
by kevinbarnes
No recent entries

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 1:23 am
by straightlight
Replace:

Code: Select all

$$
with:

Code: Select all

$
on line 8.

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 1:43 am
by kevinbarnes
Sorry. It was corrected after that before i upload, but still no mail is sent

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 2:16 am
by straightlight
No mail is sent. Have you checked the access logs for mail activities from your webserver?

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 2:24 am
by kevinbarnes
It seems you never used the attached xml to troubleshoot?

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 2:29 am
by straightlight
There were no indications on this topic where I would mention not to check the XML file. However, I did checked the XML file. Each search lines from the OC version that you have specified are indeed seeking for the right lines from the XML file. Although, it still does not answer my question above if you did checked the access logs from your webserver based on your email activities.

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 2:33 am
by kevinbarnes
When i edit directly in order.tpl. Mail is sent and if i put that in XML mail is not sent. Also no errors or mail log from my webserver as well

Re: Adding another text_greeting language text for order confirmation mail based on product model code

Posted: Mon Nov 27, 2017 2:35 am
by straightlight
You might also be using multiple XML files, which is fine. Although, I would suggest the use of the VQMod Manager in this case in order to ease the troubleshooting between XML files.