News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

2CO Script

Started by bashar09, April 03, 2009, 12:52:02 PM

Previous topic - Next topic

bashar09

Hello Guys,

I need the script for 2CO module to put it inside the extra info for 2checkout module.

Thanx,

jacksun

This is what's in mine by default. Remove the tags when you paste it in.


<?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>


Wayne