I haven't researched the module. But based on what you reported above, I suspect that you also need to send the currency code (not just 'inputamount'); otherwise it's just assuming a default.
I haven't researched the module. But based on what you reported above, I suspect that you also need to send the currency code (not just 'inputamount'); otherwise it's just assuming a default.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
mmm, i think this may be the line of code that does that the problem may be here then.
zen_draw_hidden_field('currency', $currency) .
i will post up the fullsection to allow everyone to get a better feel.
$process_button_string = zen_draw_hidden_field('cmd', 'click') .
zen_draw_hidden_field('merchant', 'xxxxxxxx') .
zen_draw_hidden_field('merchant', 'xxxxxxxx') .
zen_draw_hidden_field('merchantemail', 'xxxxxxxxxxxx') .//the email address you want the notifications of transactions sent to.
zen_draw_hidden_field('orderref', $order_id) .
zen_draw_hidden_field('currency', $currency) .
zen_draw_hidden_field('customerid', $customer_id) .
zen_draw_hidden_field('inputamount', round($order->info['total'],2)).
zen_draw_hidden_field('name', $order->billing['firstname'].' '.$order- >billing['lastname']) .
zen_draw_hidden_field('address', $order->billing['street_address'] . ', ' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address
zen_draw_hidden_field('zenid',zen_session_id()) .
zen_draw_hidden_field('town', $order->billing['city']) .
zen_draw_hidden_field('county',$order->billing['state']) .
zen_draw_hidden_field('country',$order->billing['country']['title']) .
zen_draw_hidden_field('postcode', $order->billing['postcode']).
zen_draw_hidden_field('telephone',$order->customer['telephone']) .
zen_draw_hidden_field('email', $order->customer['email_address']) .
zen_draw_hidden_field('customeremail', '1') .
zen_draw_hidden_field('callbackurl','1') .
zen_draw_hidden_field('cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
;
Assuming $currency is correct (vs $my_currency which you mentioned earlier), these should be fine:
That simply submits the $currency value (which one would assume has been set a few lines earlier to be the value of either the currency code associated with $_SESSION['currency'] or the $order->info['currency'] .. whether GBP or USD etc, and submits the order amount which is based on the value of the order in the currency in which the customer placed the order.Code:zen_draw_hidden_field('currency', $currency) . zen_draw_hidden_field('inputamount', round($order->info['total'],2)).
You might try changing $currency to $order->info['currency'] instead ?
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
we have big progress on this thank wish i had asked here sooner.
for people who have this problem you need to add the line of code
$currency = $_SESSION['currency'];
for
zen_draw_hidden_field('currency', $currency) .
to work
however i am not out the woods yet although it is taking currency over i now can't get it to stop it from converting it.
so if somone order $12 they get to payment page and it comes up as $8 dollers i think the problem is in this line of code.
zen_draw_hidden_field('inputamount', round($order->info['total'],2)) .
thanks again this so proves a when you have a problem outside input can make it very easy solultion
Is something resetting the value of $order->info['total'] elsewhere in the code ?
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I can't find that anywhere this is the code for the full page but i will keep looking thanks againPHP Code:<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
//
// Modified from $Id: securetrading.php,2006/05/24 $
// by Gavin Roberts
class securetrading {
var $code, $title, $description, $enabled;
// class constructor
function securetrading() {
global $order;
$this->code = 'securetrading';
$this->title = Securetrading ;
$this->description = PAYMENT_PAGES;
$this->sort_order = MODULE_PAYMENT_SECURETRADING_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SECURETRADING_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID > 1) {
$this->order_status = MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->form_action_url = 'https://securetrading.net/authorize/form.cgi';
}
// class methods
function update_status() {
global $db; $order;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SECURETRADING_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = 'UK' and zone_country_id = 'United Kingdom' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check->fieldsMoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function javascript_validation() {
return false;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
function process_button() {
global $order, $currencies, $customer_id;
/*
$last_order_id = $db->Execute("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
$new_order_id = $last_order_id->fields['orders_id'];
$new_order_id = $new_order_id++;
*/
$currency = $_SESSION['currency'];
$process_button_string = zen_draw_hidden_field('cmd', 'click') .
zen_draw_hidden_field('merchant', 'xxxxxxxxx') .
zen_draw_hidden_field('merchant', 'xxxxxx') .
zen_draw_hidden_field('merchantemail', 'xxxxxxxxxx) .//the email address you want the notifications of transactions sent to.
zen_draw_hidden_field('currency', $currency) .
zen_draw_hidden_field('orderref', $order_id) .
zen_draw_hidden_field('customerid', $customer_id) .
zen_draw_hidden_field('inputamount', round($order->info['total'],2)) .
zen_draw_hidden_field('name', $order->billing['firstname'].' '.$order->billing['lastname']) .
zen_draw_hidden_field('address', $order->billing['street_address'] . ', ' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address
zen_draw_hidden_field('zenid',zen_session_id()) .
zen_draw_hidden_field('town', $order->billing['city']) .
zen_draw_hidden_field('county',$order->billing['state']) .
zen_draw_hidden_field('country',$order->billing['country']['title']) .
zen_draw_hidden_field('postcode', $order->billing['postcode']).
zen_draw_hidden_field('telephone',$order->customer['telephone']) .
zen_draw_hidden_field('email', $order->customer['email_address']) .
zen_draw_hidden_field('customeremail', '1') .
zen_draw_hidden_field('callbackurl','1') .
zen_draw_hidden_field('cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
;
return $process_button_string;
}
function before_process() {
return false;
}
function after_process() {
return false;
}
function output_error() {
return false;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SECURETRADING_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable SecureTrading Module', 'MODULE_PAYMENT_SECURETRADING_STATUS', 'True', 'Do you want to accept SecureTrading payments?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('SecureTrading Account Email', 'MODULE_PAYMENT_SECURETRADING_ID', '[email protected]', 'The e-mail address to use for the SecureTrading service', '6', '4', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECURETRADING_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_SECURETRADING_STATUS', 'MODULE_PAYMENT_SECURETRADING_ID', 'MODULE_PAYMENT_SECURETRADING_ZONE', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER');
}
}
?>
thanks you very much for yoou help with this couldn't have done it without you.
everything as i can see is working correctly now if anyone eles is haveing the same problem i have posted the full page of code below
Thanks again
PHP Code:<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
//
// Modified from $Id: securetrading.php,2006/05/24 $
// by Gavin Roberts
class securetrading {
var $code, $title, $description, $enabled;
// class constructor
function securetrading() {
global $order;
$this->code = 'securetrading';
$this->title = Securetrading ;
$this->description = PAYMENT_PAGES;
$this->sort_order = MODULE_PAYMENT_SECURETRADING_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SECURETRADING_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID > 1) {
$this->order_status = MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->form_action_url = 'https://securetrading.net/authorize/form.cgi';
}
// class methods
function update_status() {
global $db; $order;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SECURETRADING_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = 'UK' and zone_country_id = 'United Kingdom' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check->fieldsMoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function javascript_validation() {
return false;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
function process_button() {
global $order, $currencies, $customer_id;
/*
$last_order_id = $db->Execute("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
$new_order_id = $last_order_id->fields['orders_id'];
$new_order_id = $new_order_id++;
*/
$currency = $_SESSION['currency'];
$process_button_string = zen_draw_hidden_field('cmd', 'click') .
zen_draw_hidden_field('merchant', 'xxxxxxxx') .
zen_draw_hidden_field('merchant', 'xxxxxxx) .
zen_draw_hidden_field('merchantemail', 'xxxxxxxxxx') .//the email address you want the notifications of transactions sent to.
zen_draw_hidden_field('currency', $currency) .
zen_draw_hidden_field('orderref', $order_id) .
zen_draw_hidden_field('customerid', $customer_id) .
zen_draw_hidden_field('inputamount', number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . //zen_draw_hidden_field('inputamount', round($order->info['total'],2)) .
zen_draw_hidden_field('name', $order->billing['firstname'].' '.$order->billing['lastname']) .
zen_draw_hidden_field('address', $order->billing['street_address'] . ', ' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address
zen_draw_hidden_field('zenid',zen_session_id()) .
zen_draw_hidden_field('town', $order->billing['city']) .
zen_draw_hidden_field('county',$order->billing['state']) .
zen_draw_hidden_field('country',$order->billing['country']['title']) .
zen_draw_hidden_field('postcode', $order->billing['postcode']).
zen_draw_hidden_field('telephone',$order->customer['telephone']) .
zen_draw_hidden_field('email', $order->customer['email_address']) .
zen_draw_hidden_field('customeremail', '1') .
zen_draw_hidden_field('callbackurl','1') .
zen_draw_hidden_field('cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
;
return $process_button_string;
}
function before_process() {
return false;
}
function after_process() {
return false;
}
function output_error() {
return false;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SECURETRADING_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable SecureTrading Module', 'MODULE_PAYMENT_SECURETRADING_STATUS', 'True', 'Do you want to accept SecureTrading payments?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('SecureTrading Account Email', 'MODULE_PAYMENT_SECURETRADING_ID', '[email protected]', 'The e-mail address to use for the SecureTrading service', '6', '4', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_SECURETRADING_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_SECURETRADING_STATUS', 'MODULE_PAYMENT_SECURETRADING_ID', 'MODULE_PAYMENT_SECURETRADING_ZONE', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER');
}
}
?>