Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CURRECNY HELP - ANY PROGRAMERS?


L!mit

Recommended Posts

Posted

Hello,

 

Hopefully somebody can help me. I am trying to set the credit card module to only enable if a particular currency is selected. I have tried PHP if else functions in cc.php, but for some reason I cant get it to work. I was hoping maybe a programmer could take a quick look and give me some suggestions.

 

I am new to PHP any suggestions would be appreicated below is what I thought would work, but didnt.

 

Thanks for your time.

 

class cc {

var $code, $title, $description, $enabled;

 

// class constructor

function cc() {

global $order;

 

$this->code = 'cc';

$this->title = MODULE_PAYMENT_CC_TEXT_TITLE;

$this->description = MODULE_PAYMENT_CC_TEXT_DESCRIPTION;

$this->sort_order = MODULE_PAYMENT_CC_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);

 

if ((int)MODULE_PAYMENT_CC_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_CC_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

}

 

// class methods

function update_status() {

global $order;

 

 

if ($currecny == 'USD') {

$this->enabled = false;

}

Posted

You need to set $currency as global before you can use it in the function then it will work.

 

global $order, $currency;

 

 

Instead of disabling it you might consider forcing your orders to the default currency by adding this to the top of checkout_process.php

 

$currency = DEFAULT_CURRENCY;

tep_session_register('currency');

Posted

Thanks for the reply I appreciate it

 

I would do a default currency switch for payment, but I am using two merchants one for each currency (e.g. CAD. USD) .

 

So I would just need to add $currency to my payment module and then my” if else “code?

 

Example:

 

 

class cc {

var $code, $title, $description, $enabled;

 

// class constructor

function cc() {

global $order; $currency;

$this->code = 'cc';

$this->title = MODULE_PAYMENT_CC_TEXT_TITLE;

$this->description = MODULE_PAYMENT_CC_TEXT_DESCRIPTION;

$this->sort_order = MODULE_PAYMENT_CC_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);

 

if ((int)MODULE_PAYMENT_CC_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_CC_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

}

 

// class methods

function update_status() {

global $order;

 

if ($currecny == 'USD') {

$this->enabled = false;

}

Posted

Thanks again for the reply.

 

For some reason is just wont work I dont think the value "USD" it being called into the script. Any suggestions? I tried if ( ($this->enabled == true) && ($currecny == 'USD')) {

$this->enabled = false; still wont work lol

 

Any help would be great!

 

class cc {

var $code, $title, $description, $enabled;

 

// class constructor

function cc() {

global $order;

 

$this->code = 'cc';

$this->title = MODULE_PAYMENT_CC_TEXT_TITLE;

$this->description = MODULE_PAYMENT_CC_TEXT_DESCRIPTION;

$this->sort_order = MODULE_PAYMENT_CC_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);

 

if ((int)MODULE_PAYMENT_CC_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_CC_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

}

// class methods

function update_status() {

global $order, $currency;

 

if ( ($this->enabled == true) && ($currecny == 'USD')) {

$this->enabled = false;

}

}

 

// end class methods

Archived

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

×
×
  • Create New...