News:

Support the VirtueMart project and become a member

Main Menu

Little php help needed...where is the mistake?

Started by Otto0815, June 14, 2012, 17:59:32 PM

Previous topic - Next topic

Otto0815

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?

stuart.prevos

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;

Otto0815

Jupp, tried this already....but $gender is always "Herr"...

stuart.prevos

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';}

Otto0815

Ahhhh, that works....

many many many thanks !!!!!