Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing email_footer depending on billing country


tkuehnel

Recommended Posts

Posted

Hi,

 

i know this is quite special but i hope someone can help me out:

 

i have a payment module with an email_footer. If someone orders inside the store country, this footer should contain the national bank acoount information; otherwhise it should be the international bank account information.

 

I tried this:

 

	// class constructor
	function xyz() {
		global $order;
					...

		if ($order->billing['country']['id'] != STORE_COUNTRY) {
				$this->email_footer = TEXT_INTERNATIONAL;
		} else {
				$this->email_footer = TEXT_NATIONAL;	  
		}

 

While processing the payment module (dumping $order in checkout_confirmation) i can see the wright result.

In checkout_process

 

	$payment_class = $$payment;
$email_order .= $order->info['payment_method'] . "\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}

it always takes the international text cause $order->billing['country']['id'] is unknown.

 

Any suggestions (accept pushing the code into checkout_process :blush: ) ?

Posted

in your /classes/order.php file, when it builds (or something similar)

      $this->billing = array('name' => $order['billing_name'],
                            'company' => $order['billing_company'],
                            'street_address' => $order['billing_street_address'],
                            'suburb' => $order['billing_suburb'],
                            'city' => $order['billing_city'],
                            'postcode' => $order['billing_postcode'],
                            'state' => $order['billing_state'],
                            'country' => $order['billing_country'],
                            'format_id' => $order['billing_address_format_id']);

 

I don't see a Country ID field.

 

You may try testing for

           if ($order->billing['country'] != STORE_COUNTRY) {
                   $this->email_footer = TEXT_INTERNATIONAL;
           } else {
                   $this->email_footer = TEXT_NATIONAL;      
           }

 

but you may also need to add a strtolower() function around your $order->billing['country'] and STORE_COUNTRY tests in case they return as unmatched if the cases are not the same.

Posted

Hi,

$order->billing['country'] is an array containing id, code and text of the selected country. But this is the point: array $order->billing['country'] is not available when processing the order in checkout_process.

 

Thanks so far

Posted

Here's a thought.

 

Create a new session variable where $order->billing['country']['id'] is defined and put it's contents into it so you can grab it where you don't have it now.

;)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Archived

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

×
×
  • Create New...