News:

Looking for documentation? Take a look on our wiki

Main Menu

PayPal Amount Dosen't Include Shipping

Started by ipock1, October 02, 2008, 15:36:02 PM

Previous topic - Next topic

ipock1

When my customer checks out the amount due for PayPal doesn't include shipping. Can anyone help on this?

Thanks,
ipock1
http://topfishingplace.com

:'(

east147


angek

can you please post your payment extra info code from the paypal configuration here. If configured correctly the shipping should be there (see screenshot).

[attachment cleanup by admin]

east147

Thank you for responding angek. My header image was hiding the payment info on the PayPal payment screen however I changed this and can confirm that the shipping was not passed over.

This is my PayPal info

<?php
$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" => "_xclick",
"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_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address_street" => $dbbt->f('address_1'),
"address_zip" => $dbbt->f('zip'),
"address_city" => $dbbt->f('city'),
"address_state" => $dbbt->f('state'),
"address_country" => $dbbt->f('country'),
"image_url" => $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) ."&";
}
mosRedirect( $url . $query_string );
} else {

echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!" />';

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

echo '</form>';

}
?>

fidel

I too have this issue and was under the impression it was due to an oversight in configuration, but after much aggravation, I believe there may be some other culprit.

I have included screenshots and the code. Have either of you found a solution?


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

}
?>



[attachment cleanup by admin]

jonbyler

I am having the same problem, am new to virtue mart and it looks like a great program, but I hope someone can help with this issue!

ajredding

Ok so I have figured out that PayPal doesn't have a "shipping" field that can be used for the whole cart.  It's kind of an odd way to make this work you wouldn't think it would show up right but it does.

I've done a lot of research and here is what you want to do.  If you are only concerned with having the shipping charge show up then you will want to change the following
"shipping" => sprintf("%.2f", $db->f("order_shipping"))
to
"handling_cart" => sprintf("%.2f", $db->f("order_shipping"))

This will show up in the paypal checkout as "Shipping and Handling" and it will total correctly.

Now if you want to take this further I'm going to start another post about showing the "Attributes" as options in paypal.  Basically I wasn't happy with the way that info was being translated and inserted into the paypal checkout. 

I'll edit this with the link.
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

jonbyler

I had the same problem, found this help on the forum and it worked for me. It was a setting on my paypal account, not in virtue mart.

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=19666.0

fidel

#8
@ajredding

Where can we find this file?

The closest I came to finding this code was in:

administrator/components/com_virtuemart/classes/ps_checkout.php

But the references were not close enough.

Thanks.

ajredding

The lines that you need to modify is in the PayPal Config.  I've attached a screen shot of where this is.
The Path to get to this section is as follows

Components > VirtueMart (if you aren't there already) 

Now there is two ways to get to the "Payment Method List"  from the "Control Panel" using the "List Payment Methods" icon or by clicking on "Store" from the menu on the left then click on "List Payment Methods"

Once you have the screen that lists the payment methods Click on "PayPal" once the "Payment Method Form" is loaded you will see that you have a "Configuration" tab at the top.  Click that to show the code I'm talking about.



[attachment cleanup by admin]
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

fidel

AJRedding: Thanks for the response. The issue on my website resided within the configuration on PayPal itself. It seems they added some additional parameters that needed to be reconfigured and saved.

htperformance

Quote from: ajredding on February 13, 2009, 05:47:02 AM
Ok so I have figured out that PayPal doesn't have a "shipping" field that can be used for the whole cart.  It's kind of an odd way to make this work you wouldn't think it would show up right but it does.

I've done a lot of research and here is what you want to do.  If you are only concerned with having the shipping charge show up then you will want to change the following
"shipping" => sprintf("%.2f", $db->f("order_shipping"))
to
"handling_cart" => sprintf("%.2f", $db->f("order_shipping"))

This will show up in the paypal checkout as "Shipping and Handling" and it will total correctly.

Now if you want to take this further I'm going to start another post about showing the "Attributes" as options in paypal.  Basically I wasn't happy with the way that info was being translated and inserted into the paypal checkout. 

I'll edit this with the link.

Have you done anything further with this?

ajredding

@htperformance

There is a big post about the attributes if that is what you are asking about.

The link is http://forum.virtuemart.net/index.php?topic=49535.msg169004#msg169004 

Let me know if there is anything I can help you with.
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com