VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Payment VM 1.1 => PayPal / PayPal Pro VM 1.1 => Topic started by: actionsprite on December 07, 2008, 22:08:15 PM

Title: Shipping address in paypal displaying bill to address
Post by: actionsprite on December 07, 2008, 22:08:15 PM
Hi, I'm using Joomla 1.5.7 and virtuemart 1.1.2.

For some reason when the customer completes their transaction at paypal, under the heading "Ship To" it lists the user's Billing address rather than the shipping address they've entered/selected...

I'm using the default paypal module supplied with virtuemart, and ideas how to fix this?

p.s. I've set up virtuemart not to require registration (via the options drop down).

the code:
<?php
$db1 
= new ps_DB();
$q "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);

$url "https://www.paypal.com/cgi-bin/webscr";
$tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"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"),
"amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
"shipping" => sprintf("%.2f"$db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,

"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",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"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/en_US/i/btn/x-click-but6.gif" border="0" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( 
$post_variables as $name => $value ) {
echo 
'<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo 
'</form>';

}
?>
Title: Re: Shipping address in paypal displaying bill to address
Post by: GCDR0812 on January 09, 2009, 12:05:54 PM
I can sort this, please send me an email
Title: Re: Shipping address in paypal displaying bill to address
Post by: cinos on January 12, 2009, 13:49:35 PM
Could someone post the solution to this?

I'm having the same troubles. :(
Title: Re: Shipping address in paypal displaying bill to address
Post by: cinos on January 16, 2009, 21:19:44 PM
Bump
Title: Re: Shipping address in paypal displaying bill to address
Post by: ajredding on February 25, 2009, 11:31:37 AM
Just to give ya'll an update on this issue I've posted a majorly modified code related to this. 

Take a look here http://forum.virtuemart.net/index.php?topic=49535.msg169004#msg169004 (http://forum.virtuemart.net/index.php?topic=49535.msg169004#msg169004)  This will give you a run down of all of the changes that has gone on with this code and the results.  Most of them are well worth the change in code.
Title: Re: Shipping address in paypal displaying bill to address
Post by: actionsprite on February 25, 2009, 12:53:05 PM
Thanks for posting AJ,
I was excited ot use your new script, and it seemed to work until I realised that the first screen on the paypal page is asking for your billing information and not your shipping information.

i.e. Your script is managing to post the shipping address fine, but it's actually being inserted into paypal's billing information, which is just as bad, only in the reverse of what's now happening (shipping address on next screen is actually filled out with billing address details.)

Seems like a catch 22, unless there is room in the paypal api for seperate billing and shipping addresses?
Title: Re: Shipping address in paypal displaying bill to address
Post by: ajredding on February 25, 2009, 13:22:33 PM
There isn't a way around this the variables passed to paypal doesn't support for a different bill to / ship to.  It supports a "Ship to"  although there is an option in the variables to show a "ship to" address field in Paypal.  But now I get to thinking about this and now it's a mess in how this would work out in the end (I'll have to experiment some more at a later time)  But I did run a transaction through the sandbox with changing out the billing information and it still maintained the ship to address once the transaction was complete.  This might take a real world test to figure out if it really works properly. 
Title: Re: Shipping address in paypal displaying bill to address
Post by: actionsprite on February 25, 2009, 23:05:28 PM
Ahh, that's crazy. I'm suprised by that on Paypal's behalf as it's a very common situation.
Title: Re: Shipping address in paypal displaying bill to address
Post by: pashis on March 05, 2009, 04:21:32 AM
ajredding thank you so much for the code..
everything works great except of the shipping or billing info.. None of that information is passed on to paypal.. i dont mind whether its shipping or billing..is there a reason for that?
Title: Re: Shipping address in paypal displaying bill to address
Post by: pashis on March 05, 2009, 20:04:01 PM
Ok the shipping info gets through just fine.. is there a way however to include the phone number?
Anyone?
Title: Re: Shipping address in paypal displaying bill to address
Post by: baggiesmad on February 26, 2013, 23:26:32 PM
I'm experiencing this issue with the latest version of Virtuemart. Does anyone have a fix for this?