VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Otto0815 on June 14, 2012, 17:59:32 PM

Title: Little php help needed...where is the mistake?
Post by: Otto0815 on June 14, 2012, 17:59:32 PM
Hi,

im trying to modify the confirmation mails and want to personalisize the opener....

so i tried the follwoing (in mail_html_header.php):

<?php
$gender = $this->orderDetails['details']['BT']->title;

if ($gender = "Herr"){$anrede = 'Sehr geehrter';}
elseif ($gender = "Frau"){$anrede = 'Sehr geehrte';}
elseif ($gender = "Dr"){$anrede = 'Sehr geehrter';}
?>

But the variable $gender is always "Herr"; but later on in the code the title is called via "$this->orderDetails['details']['BT']->title" and the it's shown correct as "Herr" or "Frau", depending on what the cutumer has choosen...

Any ideas on this one?Where is my mistake?
Title: Re: Little php help needed...where is the mistake?
Post by: stuart.prevos on June 17, 2012, 10:39:28 AM
you could put in a little validation test to see what the variable $gender actually is, just to make sure that you are not getting some default result from a null variable

<?php
$gender = $this->orderDetails['details']['BT']->title;
echo 'This is your output ' . $gender;
Title: Re: Little php help needed...where is the mistake?
Post by: Otto0815 on June 17, 2012, 18:17:00 PM
Jupp, tried this already....but $gender is always "Herr"...
Title: Re: Little php help needed...where is the mistake?
Post by: stuart.prevos on June 18, 2012, 10:27:46 AM
ok, ok ok.... took me a while

try
if ($gender == "Herr"){$anrede = 'Sehr geehrter';}
elseif ($gender == "Frau"){$anrede = 'Sehr geehrte';}
elseif ($gender == "Dr"){$anrede = 'Sehr geehrter';}
Title: Re: Little php help needed...where is the mistake?
Post by: Otto0815 on June 18, 2012, 13:35:11 PM
Ahhhh, that works....

many many many thanks !!!!!