Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Total Variable


souzadavi

Recommended Posts

Hello, i?m trying to fix a bug at contribuition, it?s about the payment module... I need get the total variable....

 

under here its the functions... i need to know how can i get the numer of total like order more shipping.... if someone knows a ideia please write me back.....

 

thanks

 

function javascript_validation() {

 

//CS_EnterMethod("phpboleto::javascript_validation()");

return false;

// CS_ExitMethod("phpboleto::javascript_validation()");

}

 

function selection() {

global $order;

//CS_EnterMethod("phpboleto::selection()");

//$praz = "teste";

//$praz[] = array('id' =>sprintf($i), 'text' =>strftime('%d/%m/%Y', (time()+60*60*24*7*$i)));

$today = getdate();

for ($i=1; $i < 5; $i++) {

// $prazo_days[] = array('id' => strftime('%d/%m/%Y', (time()+60*60*24*7*$i)), 'text' => strftime('%d/%m/%Y', (time()+60*60*24*7*$i)));

$prazo_days[] = array('id' => sprintf($i), 'text' => strftime('%d/%m/%Y', (time()+60*60*24*7*$i)));

}

 

$selection_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n" .

' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_PHPBOLETO_TEXT_PRAZO . ' </td>' . "\n" .

' <td class="main">' . tep_draw_pull_down_menu('boleto_prazo', $prazo_days) . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="smallText" colspan="2"> ' . MODULE_PAYMENT_PHPBOLETO_TEXT_WARNING . '</td>' . "\n" .

' </tr>' . "\n" .

'</table>' . "\n";

 

$selection = array('id' => $this->code,

'module' => $this->title,

'fields' => array(array('title' => MODULE_PAYMENT_PHPBOLETO_TEXT_PRAZO,

'field' => tep_draw_pull_down_menu('boleto_prazo', $prazo_days)),

array('title' => MODULE_PAYMENT_PHPBOLETO_TEXT_WARNING)));

 

return $selection;

// CS_ExitMethod("phpboleto::selection()")

 

}

 

function pre_confirmation_check() {

 

//CS_EnterMethod("phpboleto::pre_confirmation_check()");

return false;

// CS_ExitMethod("phpboleto::pre_confirmation_check()");

}

 

function confirmation() {

 

//CS_EnterMethod("phpboleto::confirmation()");

$confirmation_string = ' <tr>' . "\n" .

' <td class="main"> ' . MODULE_PAYMENT_PHPBOLETO_TEXT_DESCRIPTION . ' </td>' . "\n" .

' </tr>' . "\n";

return $confirmation_string;

// CS_ExitMethod("phpboleto::confirmation()");

}

 

function process_button() {

//CS_EnterMethod("phpboleto::process_button()");

global $HTTP_POST_VARS, $customer_id, $total_cost, $shipping_cost, $open_boleto, $boleto_prazo, $boleto_cost;

 

// select the customer with the default address

$customer = tep_db_query("select c.customers_gender, c.customers_firstname, c.customers_lastname, a.entry_company, a.entry_street_address as customers_street_address, a.entry_suburb as customers_suburb, a.entry_city as customers_city, a.entry_postcode as customers_postcode, a.entry_state as customers_state, a.entry_zone_id as customers_zone_id, a.entry_country_id as customers_country_id, c.customers_telephone, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a where c.customers_id = '" . $customer_id . "' and a.customers_id = '" . $customer_id . "' and a.address_book_id = 1");

$customer_values = tep_db_fetch_array($customer);

 

// select Boleto Tax

$btax = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PHPBOLETO_TAX'");

$btax_value = tep_db_fetch_array($btax);

 

// select Interest Rate

$brate = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PHPBOLETO_INTEREST_RATE'");

$brate_value = tep_db_fetch_array($brate);

 

if ($HTTP_POST_VARS['boleto_prazo'] >> 1) {

$boleto_cost = round(($total_cost + $shipping_cost) * $brate_value[configuration_value] / 100 / 30 * 7 * $HTTP_POST_VARS['boleto_prazo'], 2) + $btax_value[configuration_value];

} else {

$boleto_cost = $btax_value[configuration_value];

}

 

if ($customer_values['entry_company'] == '') {

$customer_name = $customer_values['customers_firstname'] . ' ' . $customer_values['customers_lastname'];

} else {

$customer_name = $customer_values['entry_company'];

}

 

$open_boleto = '<a href=' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' .

urlencode('drill.com.br/phpboleto/geraboleto.php?nr=' . $customer_id .

'&valor=' . number_format(($order->info['total'] - $order->info['shipping_cost']+32), 2, ',', '') .

//tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

//tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

'&cnpj=' . $customer_values['entry_cnpj'] .

'&nome=' . $customer_name .

'&email=' . $customer_values['customers_email_address'] .

'&prazo=' . $HTTP_POST_VARS['boleto_prazo']), 'SSL', true, false) .

' target=_blank>' . tep_image_button('button_boleto.gif', IMAGE_BUTTON_BOLETO) .

'</a>  ';

 

$process_button_string = tep_draw_hidden_field('boleto_prazo', $HTTP_POST_VARS['boleto_prazo']) .

tep_draw_hidden_field('boleto_cost', $boleto_cost);

 

 

return $open_boleto;

return $process_button_string . $open_boleto;

}

 

function before_process() {

return false;

 

}

 

function after_process() {

 

return false;

 

}

 

function output_error() {

 

return false;

 

}

 

function check() {

 

$check = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PHPBOLETO_STATUS'");

$check = tep_db_num_rows($check);

 

return $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 ('Allow PHPboleto', 'MODULE_PAYMENT_PHPBOLETO_STATUS', 'True', 'Do you want to accept PHPboleto payments?', '6', '1', '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 ('Sort order of display.', 'MODULE_PAYMENT_PHPBOLETO_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '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 ('Tax for PHPBoleto', 'MODULE_PAYMENT_PHPBOLETO_TAX', '3.5', 'Tax to be added to PHPBoleto?', '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 ('Tax for PHPBoleto', 'MODULE_PAYMENT_PHPBOLETO_INTEREST_RATE', '4.3', 'Interest Rate for payment time longer than 7 days?', '6', '0', now())");

 

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

 

}

 

function keys() {

return array('MODULE_PAYMENT_PHPBOLETO_STATUS', 'MODULE_PAYMENT_PHPBOLETO_TAX', 'MODULE_PAYMENT_PHPBOLETO_INTEREST_RATE');

}

}

?>

Davi S Souza

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...