Support Forums

email in different language

This is a discussion on email in different language within the Modules / Plugins / Modifications forums, part of the Developer Forums category; Hi, My site is in French and English. At the renewal time, I would like that the system, send emails ...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-23-2009, 04:07 PM   #1
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 289
Rep Power: 22
hel68c is just really nice hel68c is just really nice
Default email in different language

Hi,

My site is in French and English. At the renewal time, I would like that the system, send emails to members "according to their language preference in user info" .

In the file cron.php, the system send an email for each ads to be renew.

I used the extra3 field in the User View Setting for the language.

I have a template named "hobby_en" for english user and a template named "hobby_fr" for french user.

I made an english email html template in the hobby_en/emails/html/renewal.tpl and in french hobby_fr/emails/html/renewal.tpl

Now here is my problem. I know the Var $content content the template renewal.tpl but I don't know how to put the path of the template to let the system know in which language to send them.

PHP Code:
        if($checkoutSettings['renewal']=='Y')
        {
            
$renewalDays=$checkoutSettings['renewalDays'];
            
$expiration mktime(0,0,0,date("m"),date("d")+$renewalDays,date("Y"));
            
$expiration strftime("%Y-%m-%d",$expiration);
            
$sSQL "SELECT p.id,p.owner,p.orderID,p.title,p.dateadded, u.email,u.firstname,u.lastname,u.extra3 FROM ".PREFIX."listings AS p INNER JOIN ".PREFIX."users AS u ON p.owner=u.id WHERE p.expiration <= '".$expiration."' AND notified='N' AND display='Y'"
            
$result=$db->query($sSQL);
            
$numrows $result->size();
            while(
$rs=$result->fetch())
            {
                
$id=$rs['id'];
                
$owner=$rs['owner'];
                
$title=safeStripSlashes($rs['title']);
                
$datelisted=$rs['dateadded'];
                
$to=$rs["email"];
                
$vars['title']=$title;
                
$vars['oID']=$rs['orderID'];
                
$vars['firstname']=$rs['firstname'];
                
$vars['lastname']=$rs['lastname'];
                if(
$rs['extra3']=='fr')
                {                                
                   
Path in french;
                }
                else
                {
                   
Path in english;
                }
                
$msg=$Mailer->sendMail($to$content$vars);
                if(
$msg==TRUE)
                {
                    
$sSQL="UPDATE ".PREFIX."listings SET notified='Y' WHERE id=".$id." AND owner='".$owner."'";
                    
$db->query($sSQL);
                }
                else
                {
                    
$cronlog .= $msg."<br />";
                }
            }
            
$cronlog "Renewals Sent: ".$numrows."<br />";
        } 
Do you have any idea?
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)

Last edited by hel68c; 09-23-2009 at 04:09 PM.
hel68c is offline   Reply With Quote
Old 09-23-2009, 04:17 PM   #2
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

I believe it would be this:
FILESYSTEM_PATH .'templates/hobby_fr/emails/html/renewal.tpl'
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 09-23-2009, 05:21 PM   #3
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 289
Rep Power: 22
hel68c is just really nice hel68c is just really nice
Default

I tried this:

Quote:
if ($rs['extra3']=='fr')
{
$content=FILESYSTEM_PATH .'templates/hobby_fr/emails/html/renewal.tpl';
}
else
{
$content=FILESYSTEM_PATH .'templates/hobby_en/emails/html/renewal.tpl';
}
I received an email with this error:
Quote:
Warning: Smarty error: unable to read resource: "emails/html/C:\wamp\www\hobbyclassified\templates/hobby_fr/emails/html/renewal.tpl" in C:\wamp\www\hobbyclassified\includes\classes\smart y\Smarty.class.php on line 1095
The emails/html/ before the Path come from the function sendMail:

PHP Code:
    function sendMail($to$content$vars$lang)
    {
        global 
$Core$class_tpl;

    
        
$this->AddAddress($to);
        
$this->AddBCC("[email protected]");    // Hobby Classified envoi une copie de tous les emails du client � admin
         
        
if(!empty($vars['fromemail'])){
            
$this->From=$vars['fromemail'];
        }if(!empty(
$vars['name'])) {
            
$this->FromName=$vars['name'];
        }
        
/* Hobby Classified ajout pour envoie copie de email nouveau membre 
         if(!empty($vars['bcc'])) {
            $this->AddBCC=$vars['bcc'];
        }
         // Hobby Classified fin */
        
foreach($vars as $key => $value)
        {
            
//loop through the results and assign to the template
            
$class_tpl->assign($keysafeStripSlashes($value));
        }
        if(
$Core->settings['mailHTML']=="Y")
        {
            
$this->AltBody $class_tpl->fetch('emails/text/'.$content);
            
$this->Body $class_tpl->fetch('emails/html/'.$content);
            
$this->IsHTML(TRUE);
        }
        else
        {
            
$this->Body $class_tpl->fetch('emails/text/'.$content);
            
$this->IsHTML(FALSE);
        }
        
$this->Subject $class_tpl->get_template_vars('subject');
        
        if(
$this->Send())
        {
            
$this->ClearAllRecipients();
            return 
TRUE;
        }
        else
        {
            return 
"Message was not sent <br />Mailer Error: " $this->ErrorInfo;
        }
    } 
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-23-2009, 08:04 PM   #4
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,311
Rep Power: 69
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Perhaps, it would be easier to simply place your french renewal email template in the administration assigned email template folder and call it something like renewal_fr.tpl.

Then $content='renewal_fr.tpl';

That way in the code further down, you don't have to worry about the path, because the file is where it is already looking for the $content assigned name.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 09-23-2009, 11:29 PM   #5
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 289
Rep Power: 22
hel68c is just really nice hel68c is just really nice
Default

Excellent suggestion,

it work perfetly!

Thanks Mike
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-24-2009, 01:10 AM   #6
Customer
 
Join Date: Dec 2006
Posts: 112
Rep Power: 22
darek is on a distinguished road
Default

Multilingual module

Last edited by darek; 09-24-2009 at 01:26 AM.
darek is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change contact owners email to site email Soul Technical Support 3 07-24-2009 11:51 PM
PHP Language? ericbuff Technical Support 4 05-13-2009 05:30 PM
Email recpt and new order email not working napes Technical Support 6 02-14-2009 04:56 AM
Language changes Oggy Pre Sales Questions 7 07-14-2008 09:52 AM
Language Unregistered Pre Sales Questions 0 07-03-2007 02:23 PM


All times are GMT -4. The time now is 03:23 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0