VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Payment VM 1.1 => 2Checkout VM 1 => Topic started by: tallerdigitalvw.com on May 08, 2009, 10:43:17 AM

Title: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: tallerdigitalvw.com on May 08, 2009, 10:43:17 AM
Hola amigos hace unos días me toco integrar un carro en linea de Virtue Mart con 2checkout y la verdad me costo mucho poder hacer que las cosas funcionaran bien por lo cual les contare mis experiencias para que no tengan que sufrir tanto leyengo manuales y manuales para poder configurar lo.

Los problemas que tuve?
1-.Configure el modulo de 2checkout(si no sabes como configurar lo, sigue leyendo que lo explicare mas tarde) y cuando enviaba la confirmación de la compra me aparecía una información que decía "Parameter Error":

Solución: Resulta ser que 2checkout tiene 2 tipos de paneles administrativos, el clásico y el nuevo, el nuevo tiene ciertos problemas por lo cual aun no informa de los avisos importantes, por lo que deberán ingresar al panel clásico para poder ver todas las advertencias, resulto ser que el error era que aun no había confirmado el código de seguridad que 2checkout solicita a la hora de crear una cuenta nueva por lo cual la cuenta es bloqueada y marcada como cuenta en riesgo, lo cual impide que puedas utilizar tu interfaces de pago. ahora ya sabes si te aparece el error "Parameter Error" no significa específicamente que tu Virtue Mart 2checkout este malo el script, significa que tu cuenta por alguna información faltante 2checkout la tiene en riesgo, por lo cual solo continua rellenando la información y tu cuenta saldrá de riego.

2-.Después me tope con que solo me enviaba la información del shiping y no envia la de billing, el cliente tenia que rellenarla por el mismo lo cual consideraba que era innecesario que el cliente tuviera que llenar dos veces su info.

Solución: Navegando en todo el foro de Virtue Mart y sufriendo con el ingles al fin encontré una solución al problema. y resulto ser que solo había que quitar un par de lineas del script para que todo funcionara, a continuación les envió los ejemplos del script.

script en su forma original.
<?php
      $q  
"SELECT * FROM #__users WHERE user_info_id='".$db->f("user_info_id")."'";
    
$dbbt = new ps_DB;
   
$dbbt->setQuery($q);
        
$dbbt->query();
      
$dbbt->next_record();
       
// Get ship_to information
    
if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {
         
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";
    
$dbst = new ps_DB;
   
$dbst->setQuery($q2);
       
$dbst->query();
      
$dbst->next_record();
      }
     else  {
         
$dbst $dbbt;
    }


      
//Authnet vars to send
        
$formdata = array (
   
'x_login' => TWOCO_LOGIN,
   
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),

      
// Customer Name and Billing Address
  
'x_first_name' => $dbbt->f("first_name"),
        
'x_last_name' => $dbbt->f("last_name"),
  
'x_company' => $dbbt->f("company"),
      
'x_address' => $dbbt->f("address_1"),
    
'x_city' => $dbbt->f("city"),
    
'x_state' => $dbbt->f("state"),
  
'x_zip' => $dbbt->f("zip"),
      
'x_country' => $dbbt->f("country"),
      
'x_phone' => $dbbt->f("phone_1"),
        
'x_fax' => $dbbt->f("fax"),
      
'x_email' => $dbbt->f("email"),

       
// Customer Shipping Address
  
'x_ship_to_first_name' => $dbst->f("first_name"),
        
'x_ship_to_last_name' => $dbst->f("last_name"),
  
'x_ship_to_company' => $dbst->f("company"),
      
'x_ship_to_address' => $dbst->f("address_1"),
    
'x_ship_to_city' => $dbst->f("city"),
    
'x_ship_to_state' => $dbst->f("state"),
  
'x_ship_to_zip' => $dbst->f("zip"),
      
'x_ship_to_country' => $dbst->f("country"),

       
'x_invoice_num' => $db->f("order_number"),
       
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"
  
);

     if( 
TWOCO_TESTMODE == "Y" )
   
$formdata['demo'] = "Y";

       
$version "2";
    
$url "https://www2.2checkout.com/2co/buyer/purchase";
    
$formdata['x_amount'] = number_format($db->f("order_total"), 2'.''');

       
//build the post string
       
$poststring '';
       
  foreach(
$formdata AS $key => $val){
          
$poststring .= "<input type='hidden' name='$key' value='$val' />
 "
;
    }

      
?>

    <form action="<?php echo $url ?>" method="post" target="_blank">
       <?php echo $poststring ?>
    <p>Click on the Image below to pay...</p>
     <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
      </form>


Por lo cual solo había que quitar estas lineas innecesarias que aparecen al principio, en pocas palabras lo que aparecía antes de // Get ship_to information.
      $q  = "SELECT * FROM #__users WHERE user_info_id='".$db->f("user_info_id")."'";
    $dbbt = new ps_DB;
   $dbbt->setQuery($q);
        $dbbt->query();
      $dbbt->next_record();


El script ya arreglado deberá verse así.
<?php
       
// Get ship_to information
    
if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {
         
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";
    
$dbst = new ps_DB;
   
$dbst->setQuery($q2);
       
$dbst->query();
      
$dbst->next_record();
      }
     else  {
         
$dbst $dbbt;
    }


      
//Authnet vars to send
        
$formdata = array (
   
'x_login' => TWOCO_LOGIN,
   
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),

      
// Customer Name and Billing Address
  
'x_first_name' => $dbbt->f("first_name"),
        
'x_last_name' => $dbbt->f("last_name"),
  
'x_company' => $dbbt->f("company"),
      
'x_address' => $dbbt->f("address_1"),
    
'x_city' => $dbbt->f("city"),
    
'x_state' => $dbbt->f("state"),
  
'x_zip' => $dbbt->f("zip"),
      
'x_country' => $dbbt->f("country"),
      
'x_phone' => $dbbt->f("phone_1"),
        
'x_fax' => $dbbt->f("fax"),
      
'x_email' => $dbbt->f("email"),

       
// Customer Shipping Address
  
'x_ship_to_first_name' => $dbst->f("first_name"),
        
'x_ship_to_last_name' => $dbst->f("last_name"),
  
'x_ship_to_company' => $dbst->f("company"),
      
'x_ship_to_address' => $dbst->f("address_1"),
    
'x_ship_to_city' => $dbst->f("city"),
    
'x_ship_to_state' => $dbst->f("state"),
  
'x_ship_to_zip' => $dbst->f("zip"),
      
'x_ship_to_country' => $dbst->f("country"),

       
'x_invoice_num' => $db->f("order_number"),
       
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"
  
);

     if( 
TWOCO_TESTMODE == "Y" )
   
$formdata['demo'] = "Y";

       
$version "2";
    
$url "https://www2.2checkout.com/2co/buyer/purchase";
    
$formdata['x_amount'] = number_format($db->f("order_total"), 2'.''');

       
//build the post string
       
$poststring '';

  foreach(
$formdata AS $key => $val){
          
$poststring .= "<input type='hidden' name='$key' value='$val' />
 "
;
    }

      
?>

    <form action="<?php echo $url ?>" method="post" target="_blank">
       <?php echo $poststring ?>
    <p>Click on the Image below to pay...</p>
     <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
      </form>


3-.ok ya enviaba la info completa pero resultaba ser que en la información del producto aparecía un hash mero feo lo cual considero que causaría desconfianza a nuestros compradores por lo cual tenia que encontrar algo mejor y buscando dentro del foro encontré que había otro script que eliminaba el hash, pero necesitaba que el el producto estuviera en el carro de Virtue Mart y en el carro de 2checkout así que funciono pero como siempre problema con la info de billing y a continuación pongo el código.

Así quedo el código.
<?php

       $q  
"SELECT * FROM #__users WHERE user_info_id='".$db->f("user_info_id")."'";

       
$dbbt = new ps_DB;

       
$dbbt->setQuery($q);

       
$dbbt->query();

       
$dbbt->next_record();

       
// Get ship_to information

       
if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {

         
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";

         
$dbst = new ps_DB;

         
$dbst->setQuery($q2);

         
$dbst->query();

         
$dbst->next_record();

       }

       else  {

         
$dbst $dbbt;

       }



       
$q3 "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";

       
$dbcprod = new ps_DB;

       
$dbcprod->setQuery($q3);

       
$dbcprod->query();

       
$dbcprod->next_record();





       for(
$i 0$i count($dbcprod->record); $i++){ //sort out user orders

          
$orders[$i] = $dbcprod->record[$i]->order_id;

       }

       
arsort($orders);

       
$this_order_id current($orders); //sets most recent order number for user



       
for($i 0$i count($dbcprod->record); $i++){ //gets all product info entries for this order number

           
if($dbcprod->record[$i]->order_id == $this_order_id){

             
$this_order[$i] = $dbcprod->record[$i];

           }

       }

       
sort($this_order);



       
//2co c_prods to send

       
for($i 0$i count($this_order); $i++){ //creates 2co c_prod parameters

          
$twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .","$this_order[$i]->product_quantity;

          
$twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;

          
$twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;

          
$twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .","$this_order[$i]->product_attribute;

       }



       
//Authnet vars to send

       
$formdata = array (

       
'x_login' => TWOCO_LOGIN,

       
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),

       
'id_type' => 1//added for c_prod compliance



       // Customer Name and Billing Address

       
'x_first_name' => $dbbt->f("first_name"),

       
'x_last_name' => $dbbt->f("last_name"),

       
'x_company' => $dbbt->f("company"),

       
'x_address' => $dbbt->f("address_1"),

       
'x_city' => $dbbt->f("city"),

       
'x_state' => $dbbt->f("state"),

       
'x_zip' => $dbbt->f("zip"),

       
'x_country' => $dbbt->f("country"),

       
'x_phone' => $dbbt->f("phone_1"),

       
'x_fax' => $dbbt->f("fax"),

       
'x_email' => $dbbt->f("email"),



       
// Customer Shipping Address

       
'x_ship_to_first_name' => $dbst->f("first_name"),

       
'x_ship_to_last_name' => $dbst->f("last_name"),

       
'x_ship_to_company' => $dbst->f("company"),

       
'x_ship_to_address' => $dbst->f("address_1"),

       
'x_ship_to_city' => $dbst->f("city"),

       
'x_ship_to_state' => $dbst->f("state"),

       
'x_ship_to_zip' => $dbst->f("zip"),

       
'x_ship_to_country' => $dbst->f("country"),



       
'x_invoice_num' => $db->f("order_id"),

       
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"

       
);



       
$formdata array_merge($twoco_prod_info$formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co



       
if( TWOCO_TESTMODE == "Y" )

       
$formdata['demo'] = "Y";

       
$version "2";

       
$url "https://www2.2checkout.com/2co/buyer/purchase";

       
$formdata['x_amount'] = number_format($db->f("order_total"), 2'.''');



       
//build the post string

       
$poststring '';

       foreach(
$formdata AS $key => $val){

       
$poststring .= "<input type='hidden' name='$key' value='$val' />

       "
;

       }



?>

   <form action="<?php echo $url ?>" method="post" target="_self">
   <?php echo $poststring ?>
   <p>Click on the Image below to pay...</p>
   <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
   </form>


4-. ooooooo no otra vez!!! el nuevo código no envía la info de Billing así que decidí hacer con el script nuevo lo que hice con el script anterior.

Nuevo codigo ya con info de billing.
<?php
       
// Get ship_to information

       
if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {

         
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";

         
$dbst = new ps_DB;

         
$dbst->setQuery($q2);

         
$dbst->query();

         
$dbst->next_record();

       }

       else  {

         
$dbst $dbbt;

       }



       
$q3 "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";

       
$dbcprod = new ps_DB;

       
$dbcprod->setQuery($q3);

       
$dbcprod->query();

       
$dbcprod->next_record();





       for(
$i 0$i count($dbcprod->record); $i++){ //sort out user orders

          
$orders[$i] = $dbcprod->record[$i]->order_id;

       }

       
arsort($orders);

       
$this_order_id current($orders); //sets most recent order number for user



       
for($i 0$i count($dbcprod->record); $i++){ //gets all product info entries for this order number

           
if($dbcprod->record[$i]->order_id == $this_order_id){

             
$this_order[$i] = $dbcprod->record[$i];

           }

       }

       
sort($this_order);



       
//2co c_prods to send

       
for($i 0$i count($this_order); $i++){ //creates 2co c_prod parameters

          
$twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .","$this_order[$i]->product_quantity;

          
$twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;

          
$twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;

          
$twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .","$this_order[$i]->product_attribute;

       }



       
//Authnet vars to send

       
$formdata = array (

       
'x_login' => TWOCO_LOGIN,

       
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),

       
'id_type' => 1//added for c_prod compliance



       // Customer Name and Billing Address

       
'x_first_name' => $dbbt->f("first_name"),

       
'x_last_name' => $dbbt->f("last_name"),

       
'x_company' => $dbbt->f("company"),

       
'x_address' => $dbbt->f("address_1"),

       
'x_city' => $dbbt->f("city"),

       
'x_state' => $dbbt->f("state"),

       
'x_zip' => $dbbt->f("zip"),

       
'x_country' => $dbbt->f("country"),

       
'x_phone' => $dbbt->f("phone_1"),

       
'x_fax' => $dbbt->f("fax"),

       
'x_email' => $dbbt->f("email"),



       
// Customer Shipping Address

       
'x_ship_to_first_name' => $dbst->f("first_name"),

       
'x_ship_to_last_name' => $dbst->f("last_name"),

       
'x_ship_to_company' => $dbst->f("company"),

       
'x_ship_to_address' => $dbst->f("address_1"),

       
'x_ship_to_city' => $dbst->f("city"),

       
'x_ship_to_state' => $dbst->f("state"),

       
'x_ship_to_zip' => $dbst->f("zip"),

       
'x_ship_to_country' => $dbst->f("country"),



       
'x_invoice_num' => $db->f("order_id"),

       
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"

       
);



       
$formdata array_merge($twoco_prod_info$formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co



       
if( TWOCO_TESTMODE == "Y" )

       
$formdata['demo'] = "Y";

       
$version "2";

       
$url "https://www2.2checkout.com/2co/buyer/purchase";

       
$formdata['x_amount'] = number_format($db->f("order_total"), 2'.''');



       
//build the post string

       
$poststring '';

       foreach(
$formdata AS $key => $val){

       
$poststring .= "<input type='hidden' name='$key' value='$val' />

       "
;

       }



?>

   <form action="<?php echo $url ?>" method="post" target="_self">
   <?php echo $poststring ?>
   <p>Click on the Image below to pay...</p>
   <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
   </form>


Continua en el siguiente post ==) ???


Esto a sido elaborado gracias al foro de virtue mart a Ruppert, leona, John Sawatdee, subvención, a los amigos de 2checkout, a mis compañeros del trabajo en http://www.tallerdigitalvw.com (http://www.tallerdigitalvw.com) y principalmente a Dios que nos da la sabiduria para poder crear y aprender de todos los developers.


Importante: Favor comentarme si me e equivocado en algo para poder corregirlo, recuerden que postear un reply dando un simple gracias es muy importante para que un foro cresca y lo mas importante es que debemos de fomentar la cultura de donar, por que es bueno donar? por que cada developer que crea interfaces tan maravillosas como es Virtue Mart tiene hijos o esposa o simplemente nesecidades y pasan dias, meses y años sentados en su computadora a tiempo completo creando interfaces sin animo de lucro, solamente con el deseo de crecer en conocimiento y ayudar al progimo, por eso y muchas cosas mas es necesario que donemos aunque sea solo $1 pero ten por seguro que sera de mucha ayuda.

Si deseas Donar a Virtue Mart ve a la pagina principal y busca al lado izquierdo la viñeta de soporte y preciona el botón de donar.


Continua en el siguiente post ==) ???
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: tallerdigitalvw.com on May 08, 2009, 11:00:03 AM
5-.El otro problema era que cuando el usuario confirmaba su compra en el carro de Virtue Mart tenia que presionar el botón de pagar en el logo de 2checkout por lo cual investigue un poco mas en el foro y descubrí que alguien había utilizado una parte del script de paypal para que cuando el cliente confirmara su orden de una vez se fuera al área de pago.

El script que envia la info de Billing y de Shiping, de una vez envia a la pagina de 2checkout al confirmar la orden y elimina el hash y lo vuelve mas estetico.
<?php
       
// Get ship_to information

       
if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {

         
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";

         
$dbst = new ps_DB;

         
$dbst->setQuery($q2);

         
$dbst->query();

         
$dbst->next_record();

       }

       else  {

         
$dbst $dbbt;

       }



       
$q3 "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";

       
$dbcprod = new ps_DB;

       
$dbcprod->setQuery($q3);

       
$dbcprod->query();

       
$dbcprod->next_record();





       for(
$i 0$i count($dbcprod->record); $i++){ //sort out user orders

          
$orders[$i] = $dbcprod->record[$i]->order_id;

       }

       
arsort($orders);

       
$this_order_id current($orders); //sets most recent order number for user



       
for($i 0$i count($dbcprod->record); $i++){ //gets all product info entries for this order number

           
if($dbcprod->record[$i]->order_id == $this_order_id){

             
$this_order[$i] = $dbcprod->record[$i];

           }

       }

       
sort($this_order);



       
//2co c_prods to send

       
for($i 0$i count($this_order); $i++){ //creates 2co c_prod parameters

          
$twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .","$this_order[$i]->product_quantity;

          
$twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;

          
$twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;

          
$twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .","$this_order[$i]->product_attribute;

       }



       
//Authnet vars to send

       
$formdata = array (

       
'x_login' => TWOCO_LOGIN,

       
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),

       
'id_type' => 1//added for c_prod compliance



       // Customer Name and Billing Address

       
'x_first_name' => $dbbt->f("first_name"),

       
'x_last_name' => $dbbt->f("last_name"),

       
'x_company' => $dbbt->f("company"),

       
'x_address' => $dbbt->f("address_1"),

       
'x_city' => $dbbt->f("city"),

       
'x_state' => $dbbt->f("state"),

       
'x_zip' => $dbbt->f("zip"),

       
'x_country' => $dbbt->f("country"),

       
'x_phone' => $dbbt->f("phone_1"),

       
'x_fax' => $dbbt->f("fax"),

       
'x_email' => $dbbt->f("email"),



       
// Customer Shipping Address

       
'x_ship_to_first_name' => $dbst->f("first_name"),

       
'x_ship_to_last_name' => $dbst->f("last_name"),

       
'x_ship_to_company' => $dbst->f("company"),

       
'x_ship_to_address' => $dbst->f("address_1"),

       
'x_ship_to_city' => $dbst->f("city"),

       
'x_ship_to_state' => $dbst->f("state"),

       
'x_ship_to_zip' => $dbst->f("zip"),

       
'x_ship_to_country' => $dbst->f("country"),



       
'x_invoice_num' => $db->f("order_id"),

       
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"

       
);



       
$formdata array_merge($twoco_prod_info$formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co



       
if( TWOCO_TESTMODE == "Y" )

       
$formdata['demo'] = "Y";

       
$version "2";

       
$url "https://www2.2checkout.com/2co/buyer/purchase";

       
$formdata['x_amount'] = number_format($db->f("order_total"), 2'.''');



       
//build the post string

       
$poststring '';

       foreach(
$formdata AS $key => $val){

       
$poststring .= "<input type='hidden' name='$key' value='$val' />

       "
;

       }



?>

   <form id="cho" action="<?php echo $url ?>" method="post" target="_self">
   <?php echo $poststring ?>
   <p>Click on the Image below to pay...</p>
   <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
   </form>
   <script language="JavaScript" type="text/javascript">
   <!--
   document.getElementById('cho').submit();
   //-->
   </script>


por alguna razon el script me esta funcionando sin que tenga que agregar el producto en el carro de 2checkout pero eso es algo que aun no se por que pero la cosa es que me esta funcionando.

6-.Como configurar el plugin de 2checkout?

Simplemente debes de llenar los datos del plugin con tu numero de cliente 2checkout, la palabra de seguridad, orden aceptada en aceptada y orden denegada en Cancelada, y modo demo activado en lo que realizas tus pruebas.

7-.ya todo estaba configurado pero cuando recibía el correo de demo aparecía en error "no hay item para enviar por lo cual su orden sera enviada y no se le cargara a su tarjeta".

Solución: Esas palabras son normales en modo demo pero si te vas a tu panel administrativo de 2checkout y lo pones en live sales vera que ya no habrá problemas.

8-.2checkout no redirege al terminar la compra a mi tienda en linea.

Solución: hay que copiar un archivo por ftp path /www/dominio.com/administrator/components/com_virtuemart/2checkout_notify.php a tu path /www/dominio.com/2checkout_notify.php luego tendras que entrar en tu panel nuevo de 2checkout y pulsar en Account/Site Management y el la parte de abajo donde dice Approved URL y Pending URL escribir lo siguiente http:www.dominio.com/2checkout_notify.php y luego guardar. Luego en el menu Notification en el area de global settings escribir nuevamente http:www.dominio.com/2checkout_notify.php luego marcar casilla Enable All Notifications y presionar el botón de aplicar y guardar y listo ya debera funcionar.

Esto a sido elaborado gracias al foro de virtue mart a Ruppert, leona, John Sawatdee, subvención, a los amigos de 2checkout, a mis compañeros del trabajo en http://www.tallerdigitalvw.com (http://www.tallerdigitalvw.com) y principalmente a Dios que nos da la sabiduria para poder crear y aprender de todos los developers.


Importante: Favor comentarme si me e equivocado en algo para poder corregirlo, recuerden que postear un reply dando un simple gracias es muy importante para que un foro cresca y lo mas importante es que debemos de fomentar la cultura de donar, por que es bueno donar? por que cada developer que crea interfaces tan maravillosas como es Virtue Mart tiene hijos o esposa o simplemente nesecidades y pasan dias, meses y años sentados en su computadora a tiempo completo creando interfaces sin animo de lucro, solamente con el deseo de crecer en conocimiento y ayudar al progimo, por eso y muchas cosas mas es necesario que donemos aunque sea solo $1 pero ten por seguro que sera de mucha ayuda.

Si deseas Donar a Virtue Mart ve a la pagina principal y busca al lado izquierdo la viñeta de soporte y preciona el botón de donar.
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: tallerdigitalvw.com on May 08, 2009, 11:42:40 AM
To view this post in English, please press this link http://translate.google.com.gt/translate?u=http%3A%2F%2Fforum.virtuemart.net%2Findex.php%3Ftopic%3D55302.0&sl=es&tl=en&hl=es&ie=UTF-8 (http://translate.google.com.gt/translate?u=http%3A%2F%2Fforum.virtuemart.net%2Findex.php%3Ftopic%3D55302.0&sl=es&tl=en&hl=es&ie=UTF-8)
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: dragoncia on July 30, 2009, 10:02:12 AM
Hola! Primero 1000% gracias. Muy buena la guía me dio resultado todo, yo soy completamente nueva y no tuve mayor dificultad, pero aún así tengo algunas preguntas extras que agradecería mucho si me ayudan.

1. El módulo de VirtueMart me pide los datos de la tarjeta pero al llevarme a la página de 2CO me pide los datos de nuevo... es esto normal? se supone que sea así?

2. Para usuarios en español como se puede cambiar el hecho de que te lleve a la página de 2CO en inglés por la de español de manera automática... sin que el usuario de la página tenga que elegir su idioma? será posible esto?

3. Cuando termina la transacción me envía de nuevo al site original... pero de una manera muy súbita! no me avisa si la transacción fue aceptada o no, o si tuvo problemas o al menos que revise mi correo. Es posible cambiar eso o así se supone que sea?

4. Y último... el recibo de venta de 2CO "sales receipt" que me llega a mi correo informándome que la compra se realizó es un poco simple, se puede personalizar?? como? se puede configurar para que se envíe en español??

De nuevo muchas gracias en avance. Gracias por tu comentario sobre las donaciones parece mentira que a veces la donación sólo se queda en intención cuando haces uso de estos recursos pero tu post hizo que llevara a cabo la acción.  :)
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: tallerdigitalvw.com on July 30, 2009, 17:28:07 PM
Saludos Dragoncia:

A continuación te envió las respuestas que solicitaste.

1-.esta te la quedo pendiente

2-.con respecto a lo de los usuarios en español podrías probar lo siguiente:

me imagino que tu script quedo algo asi.

Quote<?php
       // Get ship_to information

       if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {

         $q2  = "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";

         $dbst = new ps_DB;

         $dbst->setQuery($q2);

         $dbst->query();

         $dbst->next_record();

       }

       else  {

         $dbst = $dbbt;

       }



       $q3 = "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";

       $dbcprod = new ps_DB;

       $dbcprod->setQuery($q3);

       $dbcprod->query();

       $dbcprod->next_record();





       for($i = 0; $i < count($dbcprod->record); $i++){ //sort out user orders

          $orders[$i] = $dbcprod->record[$i]->order_id;

       }

       arsort($orders);

       $this_order_id = current($orders); //sets most recent order number for user



       for($i = 0; $i < count($dbcprod->record); $i++){ //gets all product info entries for this order number

           if($dbcprod->record[$i]->order_id == $this_order_id){

             $this_order[$i] = $dbcprod->record[$i];

           }

       }

       sort($this_order);



       //2co c_prods to send

       for($i = 0; $i < count($this_order); $i++){ //creates 2co c_prod parameters

          $twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .",". $this_order[$i]->product_quantity;

          $twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;

          $twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;

          $twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .",". $this_order[$i]->product_attribute;

       }



       //Authnet vars to send

       $formdata = array (

       'x_login' => TWOCO_LOGIN,

       'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' : 'FALSE'),

       'id_type' => 1, //added for c_prod compliance



       // Customer Name and Billing Address

       'x_first_name' => $dbbt->f("first_name"),

       'x_last_name' => $dbbt->f("last_name"),

       'x_company' => $dbbt->f("company"),

       'x_address' => $dbbt->f("address_1"),

       'x_city' => $dbbt->f("city"),

       'x_state' => $dbbt->f("state"),

       'x_zip' => $dbbt->f("zip"),

       'x_country' => $dbbt->f("country"),

       'x_phone' => $dbbt->f("phone_1"),

       'x_fax' => $dbbt->f("fax"),

       'x_email' => $dbbt->f("email"),



       // Customer Shipping Address

       'x_ship_to_first_name' => $dbst->f("first_name"),

       'x_ship_to_last_name' => $dbst->f("last_name"),

       'x_ship_to_company' => $dbst->f("company"),

       'x_ship_to_address' => $dbst->f("address_1"),

       'x_ship_to_city' => $dbst->f("city"),

       'x_ship_to_state' => $dbst->f("state"),

       'x_ship_to_zip' => $dbst->f("zip"),

       'x_ship_to_country' => $dbst->f("country"),



       'x_invoice_num' => $db->f("order_id"),

       'x_receipt_link_url' => SECUREURL."2checkout_notify.php"

       );



       $formdata = array_merge($twoco_prod_info, $formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co



       if( TWOCO_TESTMODE == "Y" )

       $formdata['demo'] = "Y";

       $version = "2";

       $url = "https://www2.2checkout.com/2co/buyer/purchase";

       $formdata['x_amount'] = number_format($db->f("order_total"), 2, '.', '');



       //build the post string

       $poststring = '';

       foreach($formdata AS $key => $val){

       $poststring .= "<input type='hidden' name='$key' value='$val' />

       ";

       }



?>
   <form id="cho" action="<?php echo $url ?>" method="post" target="_self">
   <?php echo $poststring ?>
   <p>Click on the Image below to pay...</p>
   <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
   </form>
   <script language="JavaScript" type="text/javascript">
   <!--
   document.getElementById('cho').submit();
   //-->
   </script>

por que no pruevas cambiar la linea
$url = "https://www2.2checkout.com/2co/buyer/purchase";
por
$url = "https://www2.2checkout.com/checkout/purchase?lang=es_la";

y te quedara haci
Quote<?php
       // Get ship_to information

       if( $db->f("user_info_id") != $dbbt->f("user_info_id")) {

         $q2  = "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'";

         $dbst = new ps_DB;

         $dbst->setQuery($q2);

         $dbst->query();

         $dbst->next_record();

       }

       else  {

         $dbst = $dbbt;

       }



       $q3 = "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";

       $dbcprod = new ps_DB;

       $dbcprod->setQuery($q3);

       $dbcprod->query();

       $dbcprod->next_record();





       for($i = 0; $i < count($dbcprod->record); $i++){ //sort out user orders

          $orders[$i] = $dbcprod->record[$i]->order_id;

       }

       arsort($orders);

       $this_order_id = current($orders); //sets most recent order number for user



       for($i = 0; $i < count($dbcprod->record); $i++){ //gets all product info entries for this order number

           if($dbcprod->record[$i]->order_id == $this_order_id){

             $this_order[$i] = $dbcprod->record[$i];

           }

       }

       sort($this_order);



       //2co c_prods to send

       for($i = 0; $i < count($this_order); $i++){ //creates 2co c_prod parameters

          $twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .",". $this_order[$i]->product_quantity;

          $twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;

          $twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;

          $twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .",". $this_order[$i]->product_attribute;

       }



       //Authnet vars to send

       $formdata = array (

       'x_login' => TWOCO_LOGIN,

       'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' : 'FALSE'),

       'id_type' => 1, //added for c_prod compliance



       // Customer Name and Billing Address

       'x_first_name' => $dbbt->f("first_name"),

       'x_last_name' => $dbbt->f("last_name"),

       'x_company' => $dbbt->f("company"),

       'x_address' => $dbbt->f("address_1"),

       'x_city' => $dbbt->f("city"),

       'x_state' => $dbbt->f("state"),

       'x_zip' => $dbbt->f("zip"),

       'x_country' => $dbbt->f("country"),

       'x_phone' => $dbbt->f("phone_1"),

       'x_fax' => $dbbt->f("fax"),

       'x_email' => $dbbt->f("email"),



       // Customer Shipping Address

       'x_ship_to_first_name' => $dbst->f("first_name"),

       'x_ship_to_last_name' => $dbst->f("last_name"),

       'x_ship_to_company' => $dbst->f("company"),

       'x_ship_to_address' => $dbst->f("address_1"),

       'x_ship_to_city' => $dbst->f("city"),

       'x_ship_to_state' => $dbst->f("state"),

       'x_ship_to_zip' => $dbst->f("zip"),

       'x_ship_to_country' => $dbst->f("country"),



       'x_invoice_num' => $db->f("order_id"),

       'x_receipt_link_url' => SECUREURL."2checkout_notify.php"

       );



       $formdata = array_merge($twoco_prod_info, $formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co



       if( TWOCO_TESTMODE == "Y" )

       $formdata['demo'] = "Y";

       $version = "2";

       $url = "https://www2.2checkout.com/checkout/purchase?lang=es_la";

       $formdata['x_amount'] = number_format($db->f("order_total"), 2, '.', '');



       //build the post string

       $poststring = '';

       foreach($formdata AS $key => $val){

       $poststring .= "<input type='hidden' name='$key' value='$val' />

       ";

       }



?>
   <form id="cho" action="<?php echo $url ?>" method="post" target="_self">
   <?php echo $poststring ?>
   <p>Click on the Image below to pay...</p>
   <input type="image" name="submit" src="https://www.2checkout.com/images/buy_logo.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
   </form>
   <script language="JavaScript" type="text/javascript">
   <!--
   document.getElementById('cho').submit();
   //-->
   </script>

3-.con respecto a los detalles de la transaccion dame tiempesito en lo que piensao tu solucion.

4-.Esto debera solucionarse con arreglar lo que te puse en el insiso 2

Saludos

TallerDigitalVW.com
Title: virutemart 2checkout
Post by: metalgear on October 04, 2009, 01:39:50 AM

Hola

acabo de registrarme en 2checkout y tengo lista, pero no se como integrar 2checkout al ir mi administrador lo hice fue poner el ID de 2checkout y eso fue

Entonces probando el componente trate de realizar un compra , pero cuando llega a complete order me sale este mensaje y no se como solucionarlo

Please review the provided data and confirm the order!

Shipping Address: No valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND state_2_code=''' at line 1 SQL=SELECT * FROM jos_vm_state WHERE country_id= AND state_2_code=''


Espero me puedan ayudar
saludos

Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checko
Post by: Nome on October 22, 2009, 11:26:39 AM
I'd like to share the following code
<?php
// Get ship_to information
if( $db->f("user_info_id") != $dbbt->f("user_info_id"))
{
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'"
$dbst = new ps_DB;
$dbst->setQuery($q2);
$dbst->query();
$dbst->next_record();
} else {
$dbst $dbbt;

           
$q3 "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";
$dbcprod = new ps_DB;
$dbcprod->setQuery($q3);
$dbcprod->query();
$dbcprod->next_record();

//sort out user orders
for($i 0$i count($dbcprod->record); $i++){ $orders[$i] = $dbcprod->record[$i]->order_id; }
arsort($orders);
$this_order_id current($orders); //sets most recent order number for user

//gets all product info entries for this order number
for($i 0$i count($dbcprod->record); $i++)

if($dbcprod->record[$i]->order_id == $this_order_id) { $this_order[$i] = $dbcprod->record[$i]; }
}
sort($this_order);

//2co c_prods to send
//creates 2co c_prod parameters
for($i 0$i count($this_order); $i++)

$twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .","$this_order[$i]->product_quantity;
$twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;
$twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;
$twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .","$this_order[$i]->product_attribute;

}
   
//Authnet vars to send
$formdata = array (
'x_login' => TWOCO_LOGIN,
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),
'id_type' => 1//added for c_prod compliance

// Customer Name and Billing Address
'x_first_name' => $dbbt->f("first_name"),
'x_last_name' => $dbbt->f("last_name"),
'x_company' => $dbbt->f("company"),
'x_address' => $dbbt->f("address_1"),
'x_city' => $dbbt->f("city"),
'x_state' => $dbbt->f("state"),
'x_zip' => $dbbt->f("zip"),
'x_country' => $dbbt->f("country"),
'x_phone' => $dbbt->f("phone_1"),
'x_fax' => $dbbt->f("fax"),
'x_email' => $dbbt->f("email"),
 
// Customer Shipping Address
'x_ship_to_first_name' => $dbst->f("first_name"),
'x_ship_to_last_name' => $dbst->f("last_name"),
'x_ship_to_company' => $dbst->f("company"),
'x_ship_to_address' => $dbst->f("address_1"),
'x_ship_to_city' => $dbst->f("city"),
'x_ship_to_state' => $dbst->f("state"),
'x_ship_to_zip' => $dbst->f("zip"),
'x_ship_to_country' => $dbst->f("country"),
 
'x_invoice_num' => $db->f("order_id"),
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"
 );

$formdata array_merge($twoco_prod_info$formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co
 
if( TWOCO_TESTMODE == "Y" )
$formdata['demo'] = "Y";
       
$version "2";
$url "https://www2.2checkout.com/2co/buyer/purchase";
    
//Convert the currency 
$my_2co_default_currency 'USD';
$order_total $db->f("order_total");
if (
$db->f('order_currency') != $my_2co_default_currency 
{
$order_total $GLOBALS['CURRENCY']->convert$db->f("order_total") , $db->f('order_currency'), $my_2co_default_currency );
}
$formdata['x_amount'] = number_format($order_total2'.''');

if( 
$page == "checkout.thankyou" )
{
$query_string "?";
foreach( $formdata as $name => $value )
{
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
//build the post string
$poststring '';
foreach($formdata AS $key => $val)
{
$poststring .= "<input type='hidden' name='$key' value='$val' />
"
;

    
//old buy logo: https://www.2checkout.com/images/buy_logo.gif
?>

<form id="cho" action="<?php echo $url ?>" method="post" target="_blank">
<?php echo $poststring?>
<p><font size=+1>Click on the Image below to pay...</font></p>
<input type="image" name="submit" src="https://www2.2checkout.com/static/checkout/CheckoutButton2COCards.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
</form>
<?php 
}
?>

Its a compilation of existing codes and includes the following features:
- proper item name and desc transferred to 2CO web
- proper & full contact info sent to 2CO
- currency conversion
- quick link to 2CO (no image clicking to pay)

regards to all who contributed & hope it'll save somebody a couple of days
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: jcl on December 01, 2009, 18:33:43 PM
El script funciona bien, ahora mis productos salen en el detalle
de la pagina de 2CO, pero ahora tengo un problema,..mis productos son descargables, y utilizando el script virtuemart no envia los links de descarga,..sin el script si los envia pero se ve el codigo largo en 2CO.

Gracias por su ayuda!!
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: PRO on December 01, 2009, 18:48:52 PM
Mira en tu configuacion de la pago

Foto Below



[attachment cleanup by admin]
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: jcl on December 01, 2009, 19:02:11 PM
Creo que esa parte la tengo bien configurada,..
Ver imagen...

[attachment cleanup by admin]
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: PRO on December 01, 2009, 19:26:33 PM
si pero en configuracion de "paga" "confirmed"

[attachment cleanup by admin]
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: jcl on December 01, 2009, 20:30:02 PM
Si tambien esta en "Confirmed"...
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checko
Post by: mariemusic on March 01, 2010, 18:41:06 PM
Saludos: Me alegra tengan ayuda en español. Mi tienda está activa en este momento y hasta ahora mis clientes hacen sus pagos a trav´ś de PayPal, pero quisiera que tuviesen la oportunidad de escoger hacerlo directamente con su tarjeta de crédito y no necesariamente teniendo una cuenta de PayPal. Es por eso que abrí una cuenta con 2checkout y tengo mi númnero de vendedor. El problema es que en mi configuración (módulos) de Virtuemart no se como configurarlo pues en ninguna parte me sale un blanco para escribir mi palabra secreta, etc tak como describen en las instrucciones. No será que me falta algo?? Me pueden ayudar? Se los agradecería mucho.

Cuando voy a Virtuemart--->Store--->List Payment Methods---->2checkout  tengo esto:
(http://cuatristas.com/virtue.png)

Nada que tenga que ver con relacionarse con 2checkut...no tengo más modulos que digan 2checkout...me falta algo?

Como puedo solucionar esto?

Gracias!!!


Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Jumbo! on April 12, 2010, 19:42:35 PM
I managed to install 2CO module correctly as discussed above. Now product details are trasferred to 2CO correctly.

But I am still having a major issue. On completion of the Payment, order status does not get updated to "Confirmed". It still remain as pending.

However it work fine with PayPal.

Can anyone help me please?
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Sanyaaa on April 19, 2010, 01:10:58 AM
Hi guys! When i try scripts from here http://forum.virtuemart.net/index.php?topic=55302.msg204027#msg204027 and here http://forum.virtuemart.net/index.php?topic=55302.msg180824#msg180824i've got an error message when buyer goes back from 2co page.
QuoteNo valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT order_item_id FROM jos_vm_order_item WHERE order_id=
Samebody help, how to fix it? :(
(http://img27.imageshack.us/img27/7713/errorhu.th.jpg) (http://img27.imageshack.us/i/errorhu.jpg/)
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: milstan on May 07, 2010, 18:20:54 PM
The code posted by Nome works fine, except it doesn't change order status to CONFIRMED after payment on 2CO site. I am selling downloadable goods.
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Sanyaaa on May 09, 2010, 23:35:06 PM
happier  :'(
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Silent_Dave on March 22, 2011, 12:52:57 PM
This thread is superb, first of all - easily the single most informative thread on 2CheckOut use with VM ...

However, while everything here works, I continue to encounter a specific problem.

The script replacement compiled from this thread and provided by nome works perfectly (NB: if you replace the purchase link with https://www.2checkout.com/checkout/spurchase instead of https://www2.2checkout.com/2co/buyer/purchase, you can use the 2CO single page checkout - much better!)

However, on the passback from 2CO, problems occur.

Initially, I was receiving 403 errors, but these were rectified by doing some security clearance for VM.

Then I encountered a new problem: "Order ID is not set or emtpy!"

(NB: The spelling is built-in to the VM code - I haven't tracked it down yet, but that's not a major concern for me right now)

In looking at the URL returned by 2CO, we get the following info:

http://www.MYSITE.com/2checkout_notify.php?
x_address=22MyStreet
&x_Address=22MyStreet
&x_email_merchant=TRUE
&x_city=MyCity
&x_first_name=Joe
&x_State=XX
&x_trans_id=1234567890
&x_ship_to_country=GBR
&order_number=1234567890
&x_ship_to_first_name=Joe
&x_email=joe%40hisemail.com
&lang=en
&x_login=123456
&x_2checked=Y
&x_Zip=123ZIPCODE
&x_ship_to_zip=123ZIPCODE
&x_ship_to_company=MYCOMPANY
&x_last_name=Bloggs
&x_ship_to_city=MyCity
&x_ship_to_address=22MyStreet
&x_country=GBR
&x_fax=
&fixed=Y
&x_state=XX
&x_zip=123ZIPCODE
&x_Phone=12345678
&x_Country=GBR
&x_ship_to_last_name=Bloggs
&x_Email=joe%40hisemail.com
&merchant_order_id=
&ip_country=United+Kingdom
&x_MD5_Hash=HASHASHASHASHAHAHAHAHA
&x_company=MYCOMPANY
&demo=Y
&pay_method=CC
&x_phone=12345678
&x_invoice_num=10
&x_ship_to_state=XX
&x_response_code=1
&x_amount=15.00
&x_City=MyCity
&x_Login=123456
&x_receipt_link_url=http%3A%2F%2Fwww.MYSITE.com%2F2checkout_notify.php
&card_holder_name=Joe++Bloggs

As you can see, there is no order_id. Also note that merchant_order_id is blank when sent back from 2CO.

Now, assuming that x_2checked=Y is understood, I would have assumed that x_invoice_num would have been interpreted as order_id somewhere between 2checkout_notify.php, checkout.2Checkout_result.php, and ps_order.php. But this is not the case ...

The net result of this issue is that Orders go through the VM system, are paid for at 2CO, but when the customer checks their orders on-site, they are greeted with a Pending Status (regardless of what has been set in the 2CO payment method configuration), and a link to pay for their order.

Not ideal at all ...

Looking through this forum, it is clear that the 2CheckOut Payment method is both rarely used, and any problems relating to it are rarely addressed (at least, rarely answered with a solution; they are usually answered with more questions or a cry of "me too!")

The Payment method script provided by VM for 2CO was an absolute non-starter for me, giving me all manner of errors, and failing to reach 2CO at all ... I got server 500 errors most of the time ...

Searching via Google for any kind of resolution to this or similar issues seems to lead straight to open requests on freelancer forums and so forth ... I know that, like many, my budget is not going to stretch to paying someone to fix this issue ... but the question is: why is this an issue at all?  ???

My shop will - hopefully - provide both physical and downloadable goods ...

But use of 2CheckOut seems to be a dead end when coupled with VM. Considering I've used 2CO for around 4 years or so, without too much trouble I have to say, I would like to continue using them and their services (I have always found their Customer Support to be excellent).

The idea of switching to PayPal at this point, or any other payment processor for that matter, is distinctly unappealing ...

So ... long questions short: has anyone managed to get the 2checkoutnotify.php script, placed in the site root, to function correctly with the 2CO checkout process using the script provided by nome in this thread?

Did anyone encounter a similar order_id missing issue? Or another issue?

It would be nice to solve this once and for all, instead of having potential users of both 2CO and VM wandering from forum to forum and repeatedly searching the same things for hours - or, as in my case - days on end ...

Thanks!

Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Silent_Dave on March 23, 2011, 11:56:24 AM
Regarding the spelling mistake mentioned above (Order ID is not set or emtpy)

It can be found in ROOT/administrator/components/com_virtuemart/languages/checkout/english.php

I'm still figuring out what is going wrong with the status confirmation and order_id from 2CO, though ...
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Silent_Dave on March 23, 2011, 12:07:14 PM
OK.

I'm posting this stuff as I go in hopes that someone else with more knowledge and/or experience of php and VM will be able to pick up on something.

The error message pertaining to order_id not being set originates from this file:

checkout.2Checkout_result.php (found in ROOT/administrator/components/com_virtuemart/html)

On lines 30 - 31 it says:

if( !isset( $_REQUEST["merchant_order_id"] ) || empty( $_REQUEST["merchant_order_id"] ))
  echo $VM_LANG->_('VM_CHECKOUT_ORDERIDNOTSET');


And as noted in my first post, the merchant_order_id returned by 2CO is empty.

Now, my next experiment must be to remove the demo mode from 2CO to see if that is having any effect upon the return of merchant_order_id. (I've avoided this up until now as making Live payments into 2CO and then refunding them can cause all manner of issues from the point of view of 2CO account maintenance, but in this case, I think the test is necessary ...).

I am guessing that nothing will change in relation to this, but there's only one way to find out ...

Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Silent_Dave on March 23, 2011, 13:17:22 PM
Well, live purchase mode didn't make a jot of difference ...

Same error.

However, I tried this code:

<?php
// Get ship_to information
if( $db->f("user_info_id") != $dbbt->f("user_info_id"))
{
$q2  "SELECT * FROM #__vm_user_info WHERE user_info_id='".$db->f("user_info_id")."'"
$dbst = new ps_DB;
$dbst->setQuery($q2);
$dbst->query();
$dbst->next_record();
} else {
$dbst $dbbt;

           
$q3 "SELECT * FROM #__vm_order_item WHERE user_info_id='".$db->f("user_info_id")."'";
$dbcprod = new ps_DB;
$dbcprod->setQuery($q3);
$dbcprod->query();
$dbcprod->next_record();

//sort out user orders
for($i 0$i count($dbcprod->record); $i++){ $orders[$i] = $dbcprod->record[$i]->order_id; }
arsort($orders);
$this_order_id current($orders); //sets most recent order number for user

//gets all product info entries for this order number
for($i 0$i count($dbcprod->record); $i++)

if($dbcprod->record[$i]->order_id == $this_order_id) { $this_order[$i] = $dbcprod->record[$i]; }
}
sort($this_order);

//2co c_prods to send
//creates 2co c_prod parameters
for($i 0$i count($this_order); $i++)

$twoco_prod_info["c_prod_$i"] = $this_order[$i]->order_item_sku .","$this_order[$i]->product_quantity;
$twoco_prod_info["c_name_$i"] = $this_order[$i]->order_item_name;
$twoco_prod_info["c_price_$i"] = $this_order[$i]->product_final_price;
$twoco_prod_info["c_description_$i"] = $this_order[$i]->order_item_name .","$this_order[$i]->product_attribute;

}
   
//Authnet vars to send
$formdata = array (
'x_login' => TWOCO_LOGIN,
'x_email_merchant' => ((TWOCO_MERCHANT_EMAIL == 'True') ? 'TRUE' 'FALSE'),
'id_type' => 1//added for c_prod compliance

// Customer Name and Billing Address
'x_first_name' => $dbbt->f("first_name"),
'x_last_name' => $dbbt->f("last_name"),
'x_company' => $dbbt->f("company"),
'x_address' => $dbbt->f("address_1"),
'x_city' => $dbbt->f("city"),
'x_state' => $dbbt->f("state"),
'x_zip' => $dbbt->f("zip"),
'x_country' => $dbbt->f("country"),
'x_phone' => $dbbt->f("phone_1"),
'x_fax' => $dbbt->f("fax"),
'x_email' => $dbbt->f("email"),
 
// Customer Shipping Address
'x_ship_to_first_name' => $dbst->f("first_name"),
'x_ship_to_last_name' => $dbst->f("last_name"),
'x_ship_to_company' => $dbst->f("company"),
'x_ship_to_address' => $dbst->f("address_1"),
'x_ship_to_city' => $dbst->f("city"),
'x_ship_to_state' => $dbst->f("state"),
'x_ship_to_zip' => $dbst->f("zip"),
'x_ship_to_country' => $dbst->f("country"),
 
'x_invoice_num' => $db->f("order_id"),
'merchant_order_id' => $db->f("order_number"),
'x_receipt_link_url' => SECUREURL."2checkout_notify.php"
 );

$formdata array_merge($twoco_prod_info$formdata); //combine formdata with twoco_prod_info so c_prod info gets sent to 2co
 
if( TWOCO_TESTMODE == "Y" )
$formdata['demo'] = "Y";
       
$version "2";
$url "https://www.2checkout.com/checkout/spurchase";
    
//Convert the currency 
$my_2co_default_currency 'EUR';
$order_total $db->f("order_total");
if (
$db->f('order_currency') != $my_2co_default_currency 
{
$order_total $GLOBALS['CURRENCY']->convert$db->f("order_total") , $db->f('order_currency'), $my_2co_default_currency );
}
$formdata['x_amount'] = number_format($order_total2'.''');

if( 
$page == "checkout.thankyou" )
{
$query_string "?";
foreach( $formdata as $name => $value )
{
$query_string .= $name"=" urlencode($value) ."&";
}
vmRedirect$url $query_string );
} else {
//build the post string
$poststring '';
foreach($formdata AS $key => $val)
{
$poststring .= "<input type='hidden' name='$key' value='$val' />
"
;

    
//old buy logo: https://www.2checkout.com/images/buy_logo.gif
?>

<form id="cho" action="<?php echo $url ?>" method="post" target="_blank">
<?php echo $poststring?>
<p><font size=+1>Click on the Image below to pay...</font></p>
<input type="image" name="submit" src="https://www2.2checkout.com/static/checkout/CheckoutButton2COCards.gif" border="0" alt="Make payments with 2Checkout, it's fast and secure!" title="Pay your Order with 2Checkout, it's fast and secure!" />
</form>
<?php 
}
?>



Guess what. It worked  :)

The order passed back successfully, the merchant_order_id was successfully populated.

This will require additional testing, of course. My test where it worked was done in demo mode.

Live testing still to happen, and multiple customers also still to be checked in case of some conflict or other.

But it's a step in the right direction, I think.

I hope this helps someone (to make it better, or, if it turns out to be the best solution, to get the whole process working smoothly ...)

NB: Also to be tested: downloadable products. Tests thus far have only been done on shippable product items.

Silent Dave
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Silent_Dave on March 23, 2011, 13:21:47 PM
The difference, by the way, was the inclusion of this line:

'merchant_order_id' => $db->f("order_number")


The clue was in the comments in the checkout.2Checkout_result.php file:

/* merchant_order_id is the name of the variable that holds OUR order_number */
  $order_number = $_REQUEST['merchant_order_id'];


Again, I hope this clarifies some things for anyone wishing to take this further.

Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: Manutov0309 on January 08, 2012, 09:24:11 AM
soy nuevo usando VM, este Post esta muy bien me ha sido muy util, pero tengo una duda talvez muy simple pero bueno.. duda es duda, es lo siguiente

Si quiero vender un producto procesado por 2checkout, Debo crear el poducto en: ¿en ambos... VM y 2CO? ¿solo en VM? ¿solo en2CO?
Supongo que al crear un produto en VM, 2CO procesa sin problema... pero tengo la duda agradezco su colaboración.


If I sell a product processed by 2checkout, I create it in: in both ... VM and 2CO? only With VM? only With 2CO?
I guess to create a product in VM, 2CO processed without problem ... but I have certainly appreciate your cooperation.
Title: Re: Como Configurar Virtue Mart con 2checkout, how to config Virtue Mart 2checkout
Post by: zhiveta on August 11, 2012, 05:35:34 AM
Tengo configurado todo bien en 2checkout y virtuemart pero las ordenes se quedan en pending y no en confirmed, alguien sabe porque sucede eso????