Hi dear friends
our team translated virtumart 1.1 to persian an d going to release it free in iran.
but we have a problem for payment systems.
in iran we have two banks that accepts Electronic payment and they are saman and parsaian.
i foud a module for saman bank to conect os commerce to it.but when i am going to use it in virtumart it not works and i see alot of erors.
it is that module :
Code:
<?php
class sb24 {
var $code, $title, $description, $enabled;
// class constructor
function sb24() {
global $order;
$this->code = 'sb24';
$this->title = MODULE_PAYMENT_SB24_TEXT_TITLE;
$this->description = MODULE_PAYMENT_SB24_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_SB24_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SB24_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_SB24_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_SB24_ORDER_STATUS_ID;
}
$this->style_enabled = ((MODULE_PAYMENT_SB24_STYLE_STATUS == 'True') ? true : false);
if (is_object($order)) $this->update_status();
$this->form_action_url = 'https://acquirer.sb24.com/CardServices/controller';
}
// class methods
function update_status() {
global $order;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_SB24_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_SB24_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function javascript_validation() {
return false;
}
function selection() {
$selection = array('id' => $this->code,
'module' => $this->title);
return $selection;
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
function process_button() {
global $order, $currencies, $customer_id;
require(DIR_WS_CLASSES . 'sb+.php');
$amount = number_format(($order->info['total']) * $currencies->currencies['IRR']['value'], $currencies->currencies['IRR']['decimal_places'], '.', '');
$outclass = new sb24out($customer_id, $amount);
$outclass->set_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'));
if($this->style_enabled == true) {
$outclass->set_style();
}
$output = $outclass->create();
if($output == false) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_SB24_ERROR_MESSAGE), 'SSL'));
}
return $output;
}
function before_process() {
global $_POST, $_GET;
require(DIR_WS_CLASSES . 'sb+.php');
$inclass = new sb24get();
$output = $inclass->action();
if($inclass->run() == False)
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode($output), 'SSL'));
}
function after_process() {
return false;
}
function get_error() {
return false;
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_SB24_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('فعال کردن موژول بانک سامان', 'MODULE_PAYMENT_SB24_STATUS', 'True', 'آیا شما تمایل به دریافت مبلغ سفارش از طریق بانک سامان را دارید؟', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_SB24_MID', '00000000-0000', 'Merchant ID شما که از طرف بانک سامان دریافت کردهاید. وارد کردن این مورد برای استفاده از این روش پرداخت الزامی است.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('کلمه عبور Merchant ID', 'MODULE_PAYMENT_SB24_MPASS', '000000', 'کلمه عبور مربوط به Merchant ID شما که از طرف بانک سامان دریافت کردهاید.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('فعال کردن رنگ بندی', 'MODULE_PAYMENT_SB24_STYLE_STATUS', 'True', 'آیا شما تمایل دارید که رنگ بندی صفحه پرداخت پول در سایت بانک سامان را تغییر دهید.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('مسیر فایل xml', 'MODULE_PAYMENT_SB24_STYLE_PATH', 'includes/style.xml', 'مسیر فایل xml برای ایجاد تغییرات در رنگبندی صفحه پرداخت پول', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('مرتبه طبقهبندی برای نمایش.', 'MODULE_PAYMENT_SB24_SORT_ORDER', '0', 'مرتبه طبقهبندی برای نمایش دادن. مقادیر کمتر بالاتر نمایش داده میشوند.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('منطقه پرداخت', 'MODULE_PAYMENT_SB24_ZONE', '0', 'اگر منطقهای انتخاب شود این روش پرداخت فقط برای آن منطقه فعال خواهد بود.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('تنظیم وضعیت نمایش', 'MODULE_PAYMENT_SB24_ORDER_STATUS_ID', '0', 'سفارشاتی که با این روش پرداخت میشوند روی این مقدار تنظیم شود', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
}
function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_SB24_STATUS', 'MODULE_PAYMENT_SB24_MID', 'MODULE_PAYMENT_SB24_MPASS','MODULE_PAYMENT_SB24_STYLE_STATUS' , 'MODULE_PAYMENT_SB24_STYLE_PATH', 'MODULE_PAYMENT_SB24_SORT_ORDER', 'MODULE_PAYMENT_SB24_ZONE', 'MODULE_PAYMENT_SB24_ORDER_STATUS_ID');
}
}
?>
when i see in payment mofules in os commerce an virtumart i found alot of differene in them.
our system is the first free shopping cart in iran.payment system for it is very important.
Thanks any way for any support
[Sorry for my bad english!]
no one could help me? i am waiting to answer your request to understand this code therefore you could help us.
any expert?
i'm translating the comments to get more help