Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/11/2005, 09:52
Avatar de JuanKa
JuanKa
 
Fecha de Ingreso: septiembre-2004
Mensajes: 468
Antigüedad: 19 años, 7 meses
Puntos: 1
<?

$consultita=mysql_query("select * from cesta,articulos where cesta.cod_art = articulos.cod_art and cesta.cookieId = '" . GetCartId() . "' ");

$consulta_codigo=mysql_query("SELECT cli_codigo,cli_codigo_postal_entrega,cli_nombre,cl i_usuario FROM clientes WHERE cli_usuario='$user' AND cli_clave='$clave'");

$var_codigo=mysql_result($consulta_codigo,0,'cli_c odigo');
$var_nombre=mysql_result($consulta_codigo,0,'cli_n ombre');
$var_usuario=mysql_result($consulta_codigo,0,'cli_ usuario');
$var_codigo_postal=mysql_result($consulta_codigo,0 ,'cli_codigo_postal_entrega');


$url_tpvv='https://weppago:28965623/var/realizarPago';
$clave='asajnjknveñgopkowfoef';
$name='Comercio Pruebas';
$code='124456809600000';
$terminal='59';
$order=date('ymdHis');
$currency='25698';
$transactionType='0';
$urlMerchant='http://www.webpago.es';
$producto='Cesta de Artículos';
?>
<script language=JavaScript>
function calc() {
vent=window.open('','tpv','width=725,height=600,sc rollbars=no,resizable=yes,status=yes,menubar=no,lo cation=no');
document.forms[0].submit();
}
</script>
<table width="560" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
<tr bgcolor="#F7C459">
<td width="37" height="25" bgcolor="#F4D197"><div align="center" class="Estilo7"><strong>Cant</strong></div></td>
<td width="393" height="25" bgcolor="#F4D197"><div align="center" class="Estilo7"><strong>Descripci&oacute;n de Art&iacute;culos </strong></div></td>
<td width="54" height="25" bgcolor="#F4D197"><div align="center" class="Estilo7"><strong>P. Unit </strong></div></td>
<td width="71" height="25" bgcolor="#F4D197"><div align="center" class="Estilo7"><strong>P. Total </strong></div></td>
</tr>
<?php

$total_costo = 0;
$cantidad = 0;
$peso = 0;
while($row = mysql_fetch_array($consultita))
{ $peso = $peso + ($row["can_art"] * $row["peso_art"]);
$total_articulo = $row["can_art"] * $row["pre_art"];
$total_costo = $total_costo + ($row["can_art"] * $row["pre_art"]);
$cantidad = $cantidad + $row["can_art"];
?>
<tr>
<td height="25" class="Estilo12"><div align="center"><?php echo $row["can_art"]; ?></div></td>
<td height="25" class="Estilo12"> <?php echo $row["nom_art"]; ?> </td>
<td height="25" class="Estilo12"><div align="right"> <?php echo number_format($row["pre_art"], 2, ",", "."); ?>&nbsp; </div></td>
<td height="25" class="Estilo12"><div align="right"><?php echo number_format("$total_articulo", 2, ",", "."); ?>&nbsp; </div></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4"><hr size="1" color="red" NOSHADE></td>
</tr>
</table>
<br>

<table width="560" border="1" cellspacing="0" cellpadding="0">
<tr>
<th width="160" height="25" scope="col"><span class="Estilo6">Sub Total</span></th>
<th width="160" height="25" scope="col"><span class="Estilo6">Gastos de env&iacute;o</span></th>
<th width="160" height="25" scope="col"><span class="Estilo6">I.V.A. (16 %)</span></th>
<th width="160" height="25" scope="col"><span class="Estilo6">Total</span></th>
</tr>
<tr>
<td height="30" class="Estilo11"><div align="center" style="font-weight: bold"><?php echo number_format($total_costo, 2, ",", "."); ?></div></td>
<td height="30" class="Estilo11"><div align="center" style="font-weight: bold"><?php echo number_format($total_portes, 2, ",", "."); ?></div></td>
<td height="30" class="Estilo11"><div align="center" style="font-weight: bold"><?php echo number_format($iva, 2, ",", "."); ?></div></td>
<td height="30" bgcolor="#F4D197" class="Estilo18"><div align="center"><?php echo number_format($total_cesta, 2, ",", "."); ?></div></td>
</tr>
</table>
<input type="checkbox" name="chk_plantilla" id="chk_plantilla" value="N" onClick="estado_check()">Probando
<br>
<?
$paginaOK='http://www.mipagina.com/Ventas/pagoOK.php?a='.$var_codigo.'&b='.$total_cesta.'&c= '.$iva.'&d='.$total_costo.'&e='.$total_portes;
$paginaKO='http://www.mipagina.com/Ventas/pagoKO.php';

$var_amount=number_format($total_cesta, 2, ",", ".");

$var_amount_punto=str_replace ( ".", "", $var_amount);
$var_amount_coma =str_replace ( ",", "", $var_amount_punto);
$amount= $var_amount_coma;

?>
<table width="560" height="35" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="Middle">
<tr>
<th class="Estilo5" scope="col">Seleccione la forma que desea pagar :</th>
</tr>
</table>

<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">
<form name="compra" action="<? echo $url_tpvv; ?>" method="post" target="tpv">
<input name="Ds_Merchant_Amount" type="hidden" value="<? echo $amount; ?>" >
<input name="Ds_Merchant_Currency" type="hidden" value="<? echo $currency; ?>" >
<input name="Ds_Merchant_Order" type="hidden" value="<? echo $order; ?>" >
<input name="Ds_Merchant_MerchantCode" type="hidden" value="<? echo $code; ?>" >
<input name="Ds_Merchant_Terminal" type="hidden" value="<? echo $terminal; ?>" >
<input name="Ds_Merchant_TransactionType" type="hidden" value="<? echo $transactionType; ?>" >
<input name="Ds_Merchant_MerchantURL" type="hidden" value="<? echo $urlMerchant; ?>" >
<input name="Ds_Merchant_UrlOK " type="hidden" value="<? echo $paginaOK; ?>" >
<input name="Ds_Merchant_UrlKO" type="hidden" value="<? echo $paginaKO; ?>" >
<?
$message = $amount.$order.$code.$currency.$transactionType.$u rlMerchant.$clave;
$signature = strtoupper(sha1($message));
?>
<input name="Ds_Merchant_MerchantSignature" type="hidden" value="<? echo $signature; ?>" >
<center><a href='javascript:calc()'> <img src='../Imagenes/Web/tp_tarjeta_credito.jpg' ALT='TPV Virtual' width="169" height="37" border=0></a></center>
</form>
</th>
<th scope="col">
<input name="imageField" type="image" src="../Imagenes/Web/tp_transferencia_bancaria.jpg" width="169" height="37" border="0" onClick="window.location = 'generar_pedido.php?id=<? echo $var_codigo; ?>&subtotal=<? echo $total_costo; ?>&portes=<? echo $total_portes; ?>&iva=<? echo $iva; ?>&total=<? echo $total_cesta;?>&id_chk=' + document.getElementById('chk_plantilla').value">
</th>
</tr>
</table>


y en una pagina externa JS tengo esto:


function estado_check()
{
if (document.getElementById('chk_plantilla').checked)
{ x=document.getElementById('chk_plantilla').value=" S"; }
else
{ x=document.getElementById('chk_plantilla').value=" N"; }
}


Bueno alli esta todo el codigo, Como veras es para enviar parametros para pagar con tarjeta de credito y transferencia bancaria(Aca el valor del check lo recogo bien y no tengo problemas), el problema esta cuando hago el pago con tarjeta de credito ya que esa paginaOK se envia como parametro oculto, el cual este mismo tambien tien parametros.

Haber di me dan un mano ya que me me tiene esto cabezon.

Gracias