0

Am worked in XCart 4.4 version Framework,

Please help me How to send clean Url when send mail in Xcart.

Now in database : Name content like : eml_someone_ask_question_at

My Mail content value like :

I have Someone asked a question about {{product_name}} at {{STOREFRONT}}/product.php?productid={{productid}}

In my mail template page like
{$lng.eml_someone_ask_question_at|substitute:"STOREFRONT":$current_location:"productid":$productid:"product_name":$product}

Now I need to change clean url when sending before mail,

For example.

Linkpassedlike

In the above url clean url passed like,

above link need to changed like

I need to change this url when send before email please anyone help me.

1 Answers1

0

1) The call chain looks like

func_send_mail->func_display('your_mail_template')->func_clean_url_filter_output->func_clean_url_product_callback->func_clean_url_get

Add an additional param like this

func_send_mail->func_display('your_mail_template',...,$new_url)->func_clean_url_filter_output(,...,$new_url)->func_clean_url_product_callback(,...,$new_url)->func_clean_url_get(,...,$new_url)

And use the $new_url URL in the func_clean_url_get instead of original one.

The function func_display may be called from the func_send_mail function The call looks like

$mail_message = func_display($body_template,$mail_smarty,false);

2)Another solution is simply to change it in the xcart_clean_urls table.

3)Another solution

Apply the patch

diff -ru include/func/func.core.php include/func/func.core.php
--- include/func/func.core.php  2012-01-13 11:44:16.000000000 +0400
+++ include/func/func.core.php  2018-04-09 12:29:32.293262983 +0400
@@ -833,7 +833,7 @@
 /**
  * Smarty->display wrapper
  */
-function func_display($tpl, &$templater, $to_display = true, $is_intermediate = false)
+function func_display($tpl, &$templater, $to_display = true, $is_intermediate = false, $skip_output_filter = false)
 {
     global $config;
     global $predefined_lng_variables, $override_lng_code, $shop_language, $user_agent, $__smarty_time, $__smarty_size;
@@ -1006,7 +1006,7 @@
         $templater->register_outputfilter('func_postprocess_output');

     if (func_constant('AREA_TYPE') == 'C') {
-        if ($config['SEO']['clean_urls_enabled'] == 'Y')
+        if ($config['SEO']['clean_urls_enabled'] == 'Y' && !$skip_output_filter)
             $templater->register_outputfilter('func_clean_url_filter_output');

         if ($config['General']['use_cached_templates'] != 'Y')
diff -ru include/func/func.mail.php include/func/func.mail.php
--- include/func/func.mail.php  2012-01-10 16:27:54.000000000 +0400
+++ include/func/func.mail.php  2018-04-09 12:30:30.042523154 +0400
@@ -270,7 +270,8 @@
     if ($config['Email']['html_mail'] != 'Y')
         $mail_smarty->assign('plain_text_message', 1);

-    $mail_message = func_display($body_template,$mail_smarty,false);
+    $_skip_output_filter = strpos($body_template, 'ask_question.tpl') !== false;
+    $mail_message = func_display($body_template,$mail_smarty,false, false, $_skip_output_filter);

     if (X_DEF_OS_WINDOWS) {
         $mail_message = preg_replace("/(?<!\r)\n/S", "\r\n", $mail_message);

And change the eml_someone_ask_question_at language variable.

Ildar Amankulov
  • 526
  • 4
  • 19
  • Thanx for your reply,Plz explain me what is ... func_display('your_mail_template',...,$new_url) in above functions. – Geetha Janarthanan Apr 09 '18 at 05:03
  • The function func_display may be called from the func_send_mail function The call looks like $mail_message = func_display($body_template,$mail_smarty,false); You should change this call – Ildar Amankulov Apr 09 '18 at 05:39
  • func_display('customer/home.tpl', $smarty)->func_clean_url_filter_output('customer/home.tpl', $smarty)->func_clean_url_product_callback('customer/home.tpl', $smarty)->func_clean_url_get('customer/home.tpl', $smarty); plz help me not working – Geetha Janarthanan Apr 09 '18 at 07:16
  • I have added the third solution, try it. – Ildar Amankulov Apr 09 '18 at 08:40