PDA

View Full Version : add title to saved search email



Pete Young
March 27, 2018, 09:21 PM
Is there a way to add a title to saved search email or some sort of id in the body of the email as to which saved search is being sent (if we have several going) as I get a search sent but not sure which one I need to edit / remove etc because there is no connecting identification.

Rudi
March 28, 2018, 05:39 AM
Hello,

If you mean notification email about saved search you should modify email template with a key cron_saved_search_match in Common > Email Templates

Pete Young
March 28, 2018, 06:19 AM
and how would a lay person do that ?

Viktor
March 28, 2018, 08:15 AM
Hello Pete,

Would you please show us an example of the email template which you want to send.

Pete Young
March 28, 2018, 10:35 AM
Hello Pete,
Would you please show us an example of the email template which you want to send.

https://screencast-o-matic.com/watch/cFeu6tDg8t

Sure Viktor, I have several saved searches (to help with testing and building the site) and I get the standard email as has been set as default when a saved search has been found. all i need to do some how is identify what saved search has resulted in the email being sent, by means of some how placing the text in the email that generated it.?

see video and see an example outcome below


Dear ozepicker ,
About 20 new listings posted at xyz.com match your saved search criteria in For Sale Australia.

or words relating to the saved search name and if we can not do that due to multiple options how about at least the saved search number ?



Dear ozepicker ,
About 20 new listings posted at xyz.com match your saved search criteria #6. that way people can see which saved search to edit delete or pause etc if they have a few ore more saved searches.

Rudi
March 29, 2018, 04:47 AM
Save search notifications are generated in cron file: cron > index.php > find a row /* SAVED SEARCH CHECKING */

here you can change/add place holders using some conditions

Pete Young
March 29, 2018, 07:25 AM
Thanks Rudi, I can probably find that but from there I would have no idea what to do once i was there.

Rudi
March 30, 2018, 08:29 AM
Could you tell me exactly what you need to add?

Pete Young
March 30, 2018, 09:58 AM
Could you tell me exactly what you need to add?

from post 5 above

see an example outcome below

Dear ozepicker ,

About 20 new listings posted at xyz.com match your saved search criteria in For Sale Australia.
or words relating to the saved search name and if we can not do that due to multiple options how about at least the saved search number ?


Dear ozepicker ,
About 20 new listings posted at xyz.com match your saved search criteria #6.
that way people can see which saved search to edit delete or pause etc if they have a few ore more saved searches.

Rudi
April 5, 2018, 08:15 AM
Hello,

Go to ftp > cron > index.php > find /* SAVED SEARCH CHECKING */

change code below from:


if ($allow_send) {
$update[$key]['fields']['Matches'] = $checked_listings;
$count = $match_count;
$copy_notify_email = $saved_search_email[$account_info['Lang'] ? $account_info['Lang'] : RL_LANG_CODE];
$copy_notify_email['body'] = str_replace(
array('{name}', '{count}', '{links}'),
array($account_info['Full_name'], $count, $links),
$copy_notify_email['body']
);
$copy_notify_email['subject'] = str_replace(
array('{name}', '{count}'),
array($account_info['Full_name'], $count),
$copy_notify_email['subject']
);
$rlMail->send($copy_notify_email, $account_info['Mail']);

// cron send save search
$rlHook->load('cronSavedSearchNotify', $search, $checked_listings, $account_info);
}


to:


foreach ($content as $field => $key) {
if ($field == 'Category_ID') {
global $rlCategories;

$category_data = $rlCategories -> getCategory($key);
$search_fields .= $category_data['name'] . ', ';
} else {
$value = $rlDb->getAll("SELECT `Value` FROM `" . RL_DBPREFIX . "lang_keys` WHERE `Key` LIKE '%{$key}' AND `Code` = '" .$language['Code']. "' LIMIT 1");
$search_fields .= $value[0]['Value'] . ', ';
}
}
$search_fields = '<b>'. substr($search_fields, 0, -2) .'</b>';

if ($allow_send) {
$update[$key]['fields']['Matches'] = $checked_listings;
$count = $match_count;
$copy_notify_email = $saved_search_email[$account_info['Lang'] ? $account_info['Lang'] : RL_LANG_CODE];
$copy_notify_email['body'] = str_replace(
array('{name}', '{count}', '{links}', '{fields}'),
array($account_info['Full_name'], $count, $links, $search_fields),
$copy_notify_email['body']
);
$copy_notify_email['subject'] = str_replace(
array('{name}', '{count}'),
array($account_info['Full_name'], $count),
$copy_notify_email['subject']
);var_dump($copy_notify_email);exit();
$rlMail->send($copy_notify_email, $account_info['Mail']);

// cron send save search
$rlHook->load('cronSavedSearchNotify', $search, $checked_listings, $account_info);
}


then go to AP > Common > Email Templates > cron_saved_search_match > Edit > Content > add a new placeholder {fields} where you need

Pete Young
April 7, 2018, 03:30 AM
Rudi I will test this shortly and provide feedback thank you.