L!mit Posted August 31, 2006 Posted August 31, 2006 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; }
L!mit Posted August 31, 2006 Author Posted August 31, 2006 Can anybody help with this or atleast point me in the right direction?
thesiege84 Posted August 31, 2006 Posted August 31, 2006 Can anybody help with this or atleast point me in the right direction? Easiest way to do it is hire a programmer for $10 to do it for you. Go to http://hirealancer.com someone will bid on your project within an hour
user99999999 Posted August 31, 2006 Posted August 31, 2006 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');
L!mit Posted August 31, 2006 Author Posted August 31, 2006 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; }
user99999999 Posted August 31, 2006 Posted August 31, 2006 It should be here. // class methods function update_status() { global $order, $currency; if ($currecny == 'USD') { $this->enabled = false; }
L!mit Posted August 31, 2006 Author Posted August 31, 2006 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
L!mit Posted August 31, 2006 Author Posted August 31, 2006 I got it - was a typo in currency lol Thanks for the help!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.