Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Call the "gender" in order verification


Moresco

Recommended Posts

Hi - this is off the of my head without digging into the code but there's no place in the orders class that this is picked up. So you have a customer who has said 'male' or 'female' when creating his account and that is stored in the customers table in the db. It's also picked up in the address_book table but as far as I am aware that's it.

 

So you'd need to grab the entry_gender value from the address book for the customer and use that to pop a string into your email.

 

An alternative would be to edit the orders class to grab the gender from the customers table and add it to the customers array so you could pull it from there and then write your string accordingly

 

Bob

Link to comment
Share on other sites

Hi

 

Here's one suggestion - you're going to be editing the file checkout_process.php itself so if you make an error it's going to screw all the orders up so make a backup and test this locally or on a non-working site....

 

Look in checkout_process around line 240 (in v 2.3.3) and you'll see //let's start with the email confirmation

 

Before that add:

 

//BobTerveuren a little bit of code to grab the customer gender from customer table
  $bobs_customer_query = tep_db_query("select customers_gender from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
   if (tep_db_num_rows($bobs_customer_query)) {//we have a hit
    $gender_customer_array = tep_db_fetch_array($bobs_customer_query);
 $this_gender= $gender_customer_array['customers_gender'];
}
//OK so if we have a gender value let's do something with it
if(isset($this_gender) && $this_gender=='m'){//it's a gentleman
$email_extra_text='Hi guy';
}
elseif(isset($this_gender) && $this_gender=='f'){//it's a lady
$email_extra_text='Hello madam';
}
else{//no value found
$email_extra_text='Hi';
}
//end of Bob's bit $email_extra_text now available

 

I've hard coded in 'Hi guy' and 'Hello Madam' as the genderised text that you want to use (heh - genderised? Is that a real word?) and 'Hi' just in case there's no value retrieved from the database

 

So you have $email_extra_text with your Male text, Female text or generic stuff

 

Jump below the line // lets start with the email confirmation and you'll spy $email_order=blah blah and $email_order.=more blah

 

Decide where you want to plonk the new stuff and it'll go something like :

 

$email_order.=$email_extra_text;

 

HTH - there's more than one way of skinning a cat though so others may have a better idea

Link to comment
Share on other sites

Hi Bob thank you thank you thank your Your script works fine

 

I would now like to call the voice gender in the file admin / orders.php

 

do you think this code work?

 

<td class="main"><?php echo $order->customer['gender']; ?></td>

 

thank you very much

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...