X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Review Reminder Email (https://forum.x-cart.com/showthread.php?t=65416)

DavyMac 02-21-2013 06:57 AM

Re: Review Reminder Email
 
Hi Karina,

I've checked the functions that you identified in post #27 and in both the $sql_tbl array has been defined.

I've also added the require get_language.php mod that you have prescribed and still get the SQL error if the interval is set for 9 days, but I know this change was required for the subject line fault, which I had noticed in customers' emails that had been rejected by their mail service and bounced back to me.

Just an observation: Running send_review_reminders.php with the above mod found 487 emails to send that were not found yesterday!! Would you have expected this or should I take a closer look at my SQL problem?

DavyMac 02-21-2013 07:21 AM

Re: Review Reminder Email
 
Here is an example of what the subject line looks like thanks to a customer using a waitlist:


Quote:

Dear sender,

Yourmessage "=?UTF-8?B?RGVhciBLYXRoZXJpbmUsIHlvdXIgb3BpbmlvbiBtYXR0ZX JzIHRvIERhbmNlbWFuaWEgRGFuY2V3ZWFy?="to me was waitlisted.

Get your message to my inbox by clicking the following link.




This was generated after I had included the above mod.

karina 02-21-2013 07:54 AM

Re: Review Reminder Email
 
Quote:

Originally Posted by DavyMac
Hi Karina,

I've checked the functions that you identified in post #27 and in both the $sql_tbl array has been defined.

I've also added the require get_language.php mod that you have prescribed and still get the SQL error if the interval is set for 9 days, but I know this change was required for the subject line fault, which I had noticed in customers' emails that had been rejected by their mail service and bounced back to me.



Below is investigation about possible reason of SQL error.

1. The mentioned SQL-error is from include/func/func.order.php, 3144:
SQL query : SELECT product, descr, fulldescr FROM WHERE productid = '2404' LIMIT 1

/home/xxx/public_html/include/func/func.order.php:3144

Let's have a look at this line of code:
PHP Code:

$local func_query_first("SELECT product, descr, fulldescr FROM {$sql_tbl['products_lng_' $code]} WHERE productid = '$pid'"); 


This is the 'func_translate_products()' function. It's used for every type of emails to customer in X-Cart.

2. From SQL error we can make a conclusion that '$sql_tbl['products_lng_' . $code]' is not set. It means that $code contains some language code that is not presented in the store.

The $code is taken from 'language' column of 'xcart_orders' table.

So the possible reason is: there are some orders with language that don't have assosiated tables in database. But I cannot say exactly why. May be there was some language and later it was removed?

Check your 'xcart_orders' table with MySQL query:
Code:

select distinct(language) from xcart_orders;
And check that tables for these languages are presented:
Code:

show tables like 'xcart_products_lng_%' ;


Quote:

Originally Posted by DavyMac
Just an observation: Running send_review_reminders.php with the above mod found 487 emails to send that were not found yesterday!! Would you have expected this or should I take a closer look at my SQL problem?


I'm not sure that SQL-error and number of emails are connected.

It can be caused by the limitation in the 'send_review_reminders.php':
PHP Code:

define('ORDERS_PER_LAUNCH'500);   // How much orders should be handled by script per launch. 

It means that only 500 orders will be checked by script per launch. This limitation was added to prevent high loading. Do not worry, all emails will be sent to completed orders gradually.

DavyMac 02-21-2013 09:26 AM

Re: Review Reminder Email
 
Hi Karina, I think you've solved my problem :D/

The xcart_orders table had a mix of languages, 'en' and 'US' - and for us the correct language is 'en', for which we have products_lng_en table but we don't have a 'products_lng_US table.

Clearly the mix-up occurred during database upgrade and syncing because new orders since going live have language = 'en'.

It all makes perfect sense, because when I set the delay period to 3 days I set the first order number to be since the upgraded site went live, so language would have been 'en' and no SQL error raised. So you are right that 9 days or 3 days made no difference. When I used 9 days I set first order to be from the "old" site.

I shall update the xcart_orders table to set all orders to 'en' and report back. At the risk of being premature - thank you very much :D

I hear what you say about only 500 orders being checked at a time - that's good.

DavyMac 02-21-2013 12:41 PM

Re: Review Reminder Email
 
Karina,

Updating my xcart_orders.language column has fixed my SQL error. Thank you.

But, I'm still not seeing a sensible subject line in the outgoing email reminder, I'm seeing things like:

Subject:=?UTF-8?B?RGVhciBUcmFjeSwgeW91ciBvcGluaW9uIG1hdHRlcnMgdG 8gRGFuY2VtYW5pYSBEYW5jZXdlYXI=?=

karina 02-22-2013 03:42 AM

Re: Review Reminder Email
 
Quote:

Originally Posted by DavyMac
Karina,

Updating my xcart_orders.language column has fixed my SQL error. Thank you.

But, I'm still not seeing a sensible subject line in the outgoing email reminder, I'm seeing things like:

Subject:=?UTF-8?B?RGVhciBUcmFjeSwgeW91ciBvcGluaW9uIG1hdHRlcnMgdG 8gRGFuY2VtYW5pYSBEYW5jZXdlYXI=?=


Please check your file 'modules/Advanced_Customer_Reviews/func.php'. There is the function func_acr_send_review_reminder(). Two global variables are responsible for right encoding, $to_customer and $all_languages. These variables should be presented in the function. Please, check if they are there.

The code is below:
PHP Code:

function func_acr_send_review_reminder($userinfo$products$test_email '') {
    global 
$sql_tbl$config$mail_smarty$to_customer$all_languages;

    if (
        (!isset(
$products) || !is_array($products)) 


Let me know about results.

DavyMac 02-22-2013 04:01 AM

Re: Review Reminder Email
 
Hi Karina,

No, they are both abscent: $to_customer, $all_languages are not declared as global.

carpeperdiem 02-22-2013 05:04 AM

Re: Review Reminder Email
 
Quote:

Originally Posted by karina
These variables should be presented in the function. Please, check if they are there.

The code is below:
PHP Code:

function func_acr_send_review_reminder($userinfo$products$test_email '') {
    global 
$sql_tbl$config$mail_smarty$to_customer$all_languages;

    if (
        (!isset(
$products) || !is_array($products)) 


Let me know about results.


Karina,

FYI, this is absent from my installation as well.
My ACR came with 4.5.4 gold plus distribution.
I can confirm that the file that came in 4.5.4 goldplus, looks like this:

line 467
PHP Code:

function func_acr_send_review_reminder($userinfo$products$test_email '') {
    global 
$sql_tbl$config$mail_smarty


But I don't think I am having the same problem. At least my customers have not said anything and I am sending many review reminders daily. I don't recall seeing this issue during testing.

???

DavyMac 02-25-2013 10:15 AM

Re: Review Reminder Email
 
Karina,

I added $to_customer and $all_languages to the Global declarations and the subject line is still not correct.

Interestingly, when in Test Mode the subject is correct.

karina 02-26-2013 05:04 AM

Re: Review Reminder Email
 
To summarize up:
=================
"How to fix wrong encoding in review reminder email?"

1. Open your '<xcart_dir>/send_review_reminders.php' file and found this part of code:

PHP Code:

define('SKIP_CHECK_REQUIREMENTS.PHP'true);

require 
'./init.php'
 
$argv $_SERVER['argv']; 


and replace it with:
PHP Code:

define('SKIP_CHECK_REQUIREMENTS.PHP'true);

require 
'./init.php'
require 
'./include/get_language.php';
 
$argv $_SERVER['argv']; 


2. Open your '<xcart_dir>/modules/Advanced_Customer_Reviews/func.php' file and found this part of code:
PHP Code:

function func_acr_send_review_reminder($userinfo$products$test_email '') {
    global 
$sql_tbl$config$mail_smarty;

    if (
        (!isset(
$products) || !is_array($products)) 


and replace it with:
PHP Code:

function func_acr_send_review_reminder($userinfo$products$test_email '') {
     global 
$sql_tbl$config$mail_smarty$all_languages$to_customer;
 
     if (
         (!isset(
$products) || !is_array($products)) 



3. In the '<xcart_dir>/modules/Advanced_Customer_Reviews/func.php' file found this part of code:
PHP Code:

$result func_send_mail($email'mail/acr_review_reminder_subj.tpl''mail/acr_review_reminder.tpl'$config['Company']['site_administrator'], true); 


and replace it with:
PHP Code:

$result func_send_mail($email,  'mail/acr_review_reminder_subj.tpl''mail/acr_review_reminder.tpl',  $config['Company']['site_administrator'], false); 


=================


All times are GMT -8. The time now is 01:45 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.