Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help Please with PagamentoDigital Module


jvicente

Recommended Posts

Hi

 

I've installed the Brazilian module pagamentodigital but I have an issue that I would like to solve:

 

I have 2 currencies Euros(default) and Reais from Brasil.

 

The problem is when some customer buys something from our store, and selects PagamentoDigital as payment method, the modulo always assumes the Final Value in Euros and not the selected currency. For example: someone buys 10€ of products but its a Brazilian Guy and wants to pay in Brazilian Reais. He should pay something like 23Reais 10€=23$R but the module pagamentodigital always asssumes 10$R (Reais).

 

I suppose it's because this module was created only thinking about brazilian stores only for Brazilian Currency.

 

Can anyone help me with the code?

 

 

The original code it's:

 

 

 

 

 

 

<?php

/*

$Id: checkout_success.php 1749 2007-12-21 04:23:36Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the shopping cart page

/* if (!tep_session_is_registered('customer_id')) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}*/

 

if (!$_POST['orders_id']) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

} else {

$cart->reset(true);

tep_session_unregister('sendto');

tep_session_unregister('billto');

tep_session_unregister('shipping');

tep_session_unregister('payment');

tep_session_unregister('comments');

}

 

require_once('./pagamentoDigital/includes/classes/PagamentoDigital.class.php');

$objPagamentoDigital = new PagamentoDigital();

 

$emailLoja = $objPagamentoDigital->getEmailLoja();

$vencimentoBoleto = $objPagamentoDigital->getVencimentoBoleto();

$urlRetorno = $objPagamentoDigital->getUrlRetorno();

$tipoIntegracao = $objPagamentoDigital->getTipoIntegracao();

 

/**

* Seleciona Dados da Venda

*/

$query = "select

o.orders_id,

o.customers_name,

o.customers_email_address,

o.customers_telephone,

o.customers_street_address,

o.customers_city,

o.customers_state,

o.customers_postcode,

ot.value as frete_value,

ot.title as frete_name

from

orders o,

orders_total ot

where

o.orders_id='".$_POST['orders_id']."' and

o.orders_id=ot.orders_id and

ot.class='ot_shipping'";

$selectOrder = tep_db_query($query);

$showOrder = tep_db_fetch_array($selectOrder);

 

/**

* Seleciona Produtos da Venda

*/

$query = "select

products_id,

products_name,

final_price,

products_quantity

from

orders_products

where

orders_id='".$_POST['orders_id']."'";

$selectProduct = tep_db_query($query);

$products = array();

while ($showProduct = tep_db_fetch_array($selectProduct)) {

$products[] = array('products_id' => $showProduct['products_id'],

'products_name' => $showProduct['products_name'],

'final_price' => $showProduct['final_price'],

'products_quantity' => $showProduct['products_quantity'],

);

}

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<script language="javascript">

function sendForm(form) {

var pd_popup;

 

document.getElementById('pdStep1').style.display = 'none';

document.getElementById('pdStep2').style.display = '';

 

window.name="pagamentoDigital";

if(navigator.appName.indexOf("Netscape") != -1) {

pd_popup = window.open("", "pd_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,screenX=0,screenY=0,left=0,top=0,width=820,height=600");

} else {

pd_popup = window.open("", "pd_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=820,height=600");

}

form.submit();

}

</script>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td>

 

<!-- CONTEUDO DO PAGAMENTO -->

<h2 class="modulo_pagamento">PAGAMENTO DIGITAL</h2>

<table width="100%" cellspadding="0" cellspacing="0">

<tr>

<td class="main">Sua compra foi finalizada com sucesso. Clique abaixo para concluir o pagamento, utilizando o Pagamento Digital</td>

</tr>

<tr>

<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

</tr>

<tr>

<td style="height: 30px;"></td>

</tr>

<tr>

<td style="height: 30px;"></td>

</tr>

<tr>

<td style="text-align: center;" class="main">

<div id="pdStep1">

<div><strong>Clique abaixo para continuar seu pagamento</strong></div>

<form name="frmPd" id="frmPd" method="post" action="https://www.pagamentodigital.com.br/checkout/pay/" target="pd_popup">

<input type="hidden" name="email_loja" id="email_loja" value="<?= $emailLoja; ?>" />

<?

for ($i=0, $total=count($products); $i<$total; $i++) {

?>

<input type="hidden" name="produto_codigo_<?= $i+1; ?>" id="produto_codigo_<?= $i+1; ?>" value="<?= $products[$i]['products_id']; ?>" />

<input type="hidden" name="produto_descricao_<?= $i+1; ?>" id="produto_descricao_<?= $i+1; ?>" value="<?= $products[$i]['products_name']; ?>" />

<input type="hidden" name="produto_qtde_<?= $i+1; ?>" id="produto_qtde_<?= $i+1; ?>" value="<?= $products[$i]['products_quantity']; ?>" />

<input type="hidden" name="produto_valor_<?= $i+1; ?>" id="produto_valor_<?= $i+1; ?>" value="<?= number_format($products[$i]['final_price'], 2, '.', ''); ?>" />

<?

}

?>

<input type="hidden" name="id_pedido" id="id_pedido" value="<?= $showOrder['orders_id']; ?>" />

<input type="hidden" name="tipo_integracao" id="tipo_integracao" value="<?= $tipoIntegracao; ?>" />

<input type="hidden" name="frete" id="frete" value="<?= number_format($showOrder['frete_value'], 2, '.', ''); ?>" />

<input type="hidden" name="tipo_frete" id="tipo_frete" value="<?= $showOrder['frete_name']; ?>" />

<input type="hidden" name="email" id="email" value="<?= $showOrder['customers_email_address']; ?>" />

<input type="hidden" name="nome" id="nome" value="<?= $showOrder['customers_name']; ?>" />

<input type="hidden" name="cpf" id="cpf" value="" />

<input type="hidden" name="telefone" id="telefone" value="<?= $showOrder['customers_telephone']; ?>" />

<input type="hidden" name="endereco" id="endereco" value="<?= $showOrder['customers_street_address']; ?>" />

<input type="hidden" name="cidade" id="cidade" value="<?= $showOrder['customers_city']; ?>" />

<input type="hidden" name="estado" id="estado" value="<?= $showOrder['customers_state']; ?>" />

<input type="hidden" name="cep" id="cep" value="<?= $showOrder['customers_postcode']; ?>" />

<input type="hidden" name="free" id="free" value="<?= $showOrder['orders_id']; ?>" />

<input type="hidden" name="url_retorno" id="url_retorno" value="<?= $urlRetorno; ?>" />

<input type="hidden" name="vencimento" id="vencimento" value="<?= $vencimentoBoleto; ?>" />

<img style="cursor: hand;" src="./pagamentoDigital/images/logoGrande.gif" onClick="sendForm(document.getElementById('frmPd'));" />

</form>

</div>

<div id="pdStep2" style="display: none; font-family: Verdana; font-size: 12px;">

Escolha agora a forma de pagamento na janela nova aberta do Pagamento Digital.

</div>

<div id="pdStep3" style="display: none;">

 

</div>

</td>

</tr>

<tr>

<td style="height: 30px;"></td>

</tr>

</table>

<!-- // CONTEUDO DO PAGAMENTO -->

</td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

</tr>

</table></td>

<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>

</tr>

</table></td>

</tr>

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...