hi, just to confirm to panikos that this code seems to work but need to be modified this way for me to see it work in france (and europe...hope it will be usefull) but the address form stays empty ... i have just configure it like this... (for france you don't need to put the country and state, neither the "no_shipping" value put as "0" not "1")
<?php
$url = "https://securepayments.paypal.com/acquiringweb";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
$order_id = $db->f("order_id") ;
// get user info i.e. address etc
$dbb = new ps_DB;
$q = "SELECT * FROM jos_vm_user_info ";
$q .= "WHERE user_id ='".$my->id."' ";
$dbb->setQuery($q);
$dbb->query();
//Query used to find whether to use Bill Address or Ship to address
$dboui = new ps_DB;
$q_oui = "SELECT * FROM #__vm_order_user_info ";
$q_oui .= "WHERE #__vm_order_user_info.order_id='$order_id' ORDER BY #__vm_order_user_info.order_info_id DESC";
$dboui->setQuery($q_oui);
$dboui->query($q_oui);
$oui_st = $dboui->f("address_type");
//now lets see if the order was placed using a shipping address we then send paypal the shipping address
if($oui_st == "ST"){
$db1 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$dboui->f("country")."' ORDER BY country_2_code ASC";
$db1->setQuery($q);
$db1->query($q);
$first_name = $dboui->f("first_name");
$last_name = $dboui->f("last_name");
$address1 = $dboui->f("address_1");
$address2 = $dboui->f("address_2");
$zip = $dboui->f("zip");
$city = $dboui->f("city");
$email = $dboui->f("user_email");
$night_phone_b = $dboui->f("phone_1");
}
//if no shipping address we use send paypal the bill to address
else {
$db2 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$dbb->f("country")."' ORDER BY country_2_code ASC";
$db2->setQuery($q);
$db2->query($q);
$first_name = $dbb->f("first_name");
$last_name = $dbb->f("last_name");
$address1 = $dbb->f("address_1");
$address2 = $dbb->f("address_2");
$zip = $dbb->f("zip");
$city = $dbb->f("city");
$email = $dbb->f("user_email");
$night_phone_b = $dbbt->f("phone_1");
}
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$shipping = $db->f("order_shipping");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_hosted-payment",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"subtotal" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $currency,
"address_override" => "1",
"buyer_email" => $email,
"billing_first_name" => $first_name,
"billing_last_name" => $last_name,
"billing_address1" => $address_1,
"billing_address2" => $address_2,
"billing_city" => $city,
"billing_country" => $country,
"billing_zip" => $zip,
"night_phone_b" => $phone_1,
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.cancel.php&order_id=".$db->f("order_id")."&invoice=".$db->f("order_number"),
"undefined_quantity" => "0",
"test_ipn" => PAYPAL_DEBUG,
"pal" => "XXXXXXXXX(pal_number)",
"no_shipping" => "0",
"no_note" => "1"
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
} else {
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="https://www.paypal.com/XXXXXXXXX_limagedetonchoix.gif" alt="bla la la lala " />';
foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';
}
?>
Will tell you if there's any changes in the way it works...