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

No tax passed on to Paypal on shipping

Started by Bytsy, April 14, 2009, 14:59:34 PM

Previous topic - Next topic

Bytsy

Hi,

I'm running Virtuemart 1.1.2 on Joomla 1.5.6. I have tax set to by shipping address.

At first the display during check-out was not showing tax as I wanted (which is to add VAT if an order was to ship inside the EU but not otherwise). I have modified this so that the whole display from my site is correct with tax added and shown based on shipping address as outlined. In particular the displayed tax is on the total of the goods and the shipping. Unfortunately what gets paid is just tax on the goods not on the shipping. Somewhere between the display and what is sent to PayPal there's a mismatch.

Please can anyone point me in the right direction of where I need to work to correct this.

Any comments will be very gratefully received.

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

PRO

go into your shipping module, and turn off the tax

Bytsy

Hi BanquetTables.pro,

sorry but I don't follow you - I need to charge tax on shipping. I need to have it at 15% for countries in the EU. This correctly displays during the checking out process (all the way to step 4) but when the customer pays via PayPal the amount is without tax on shipping.

Thanks,

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

PRO

Ok, sorry I read your problem wrong


Bytsy

Hi BanquetTables.pro - no problem and thanks for redirecting this to the correct forum. Any takers for a solution - or even a steer in the general direction?

Thanks

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

ajredding

1 question about this for you real fast.

Do you need to have paypal show the shipping tax as an individual line?
or
Can it be combined with the rest of the tax for the items in the cart?

I can have a solution either way.. but it will vary how much code will be required.
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

Bytsy

Hi ajredding,

thanks for your offer of help. What I have is a separate line under the Subtotal displaying the tax which is the total of tax on goods and tax on shipping. This correctly displays and is added into the total.

The difficulty I have is that, although the checkout process is correct throughout the amount the customer is billed by PayPal does not include the tax on the shipping.

I'm a complete php novice but have got this far, I guess that there is a different variable being used for display and for billing but I would love some advice!

Many thanks,

Bytsy.
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

Bytsy

Hi ajredding / anyone else,

Please can you help me find where to adjust the amount that PayPal charges to take into account the tax on shipping?

Many thanks,

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

Bytsy

If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

Bytsy

BanquetTables.Pro,

are you able to help at all? I've tried contacting ajredding's e-mail to no avail and no-one else is responding!

thanks,

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

ajredding

can you post the Paypal Extra Info code that you have listed in your paypal config.  I will modify what you have in there.
RAW Media Group - Website design - http://www.rawmediagroup.com
Cubed Hosting - Website Hosting - http://www.cubedhosting.com

Bytsy

Hi ajredding,

I wasn't sure if you meant code from administrator/components/com_virtuemart/classes/payment/ps_paypay.php. When I looked I found this comment:
* If you want to change something "internal", you must modify the 'payment extra info'
* in the payment method form of the PayPal payment method

Problem is I'm not sure where that is!

Having grepped the files I guess we are talking about administrator/components/com_virtuemart/html/account.order_details.php which I have version:

* @version $Id: account.order_details.php 1285 2008-03-02 18:48:04Z soeren_nb $

which doesn't seem to have the 'extra info code' which was in a previous version:

<?php
if ( $db->f("order_status") == "P" ) {
   // Copy the db object to prevent it gets altered
   $db_temp = ps_DB::_clone( $db );
/** Start printing out HTML Form code (Payment Extra Info) **/ ?>
<table width="100%">
  <tr>
    <td width="100%" align="center">
    <?php
    @include( CLASSPATH. "payment/".$dbpm->f("payment_class").".cfg.php" );

    echo DEBUG ? vmCommonHTML::getInfoField('Beginning to parse the payment extra info code...' ) : '';

    // Here's the place where the Payment Extra Form Code is included
    // Thanks to Steve for this solution (why make it complicated...?)
    if( eval('?>' . $dbpm->f("payment_extrainfo") . '<?php ') === false ) {
       echo vmCommonHTML::getErrorField( "Error: The code of the payment method ".$dbpm->f( 'payment_method_name').' ('.$dbpm->f('payment_method_code').') '
       .'contains a Parse Error!<br />Please correct that first' );
    }
      ?>
    </td>
  </tr>
</table>
<?php
   $db = $db_temp;
}

/** END printing out HTML Form code (Payment Extra Info) **/
?>

Is this what you were wanting??


Thanks for your support,  ;D

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

ajredding

What I'm looking for is the code that is listed in the paypal config.  This can be found following this path.

Components > VirtueMart

Then clicking on "store" on the left menu and then "List Payment Methods"  or by clicking "List Payment Methods" on the Control Panel screen of Virtue Mart.

From there click on "PayPal" then click on Configuration.

You will get a screen like the attached screenshot.

If you could copy and paste all the code in the "Payment Extra Info" box.  Then I can edit that for you.

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

Bytsy

Hi ajredding,

thanks for your assistance. Apologies for the delay - life got in the way!

The details I have are as follows:

<?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_total, 2),
"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" => "",

"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" => "SOMECODEHERE",
"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>';

}
?>

I have changed the line '"pal" => "SOMECODEHERE",' from a string of alphanumeric chars since I wasn't sure if it was a password and potentially a security problem to share it.

Any solutions gratefully received!

Bytsy
If you can keep your head when all about you are losing theirs, you obviously haven't understood the seriousness of the situation ;)

radagast

I found a few solutions to this problem... by far the best one was here:
http://www.gjcwebdesign.com/configuration-paypal-payment-module-virtuemart.html

the default extra info passes the postage cost as "shipping", the gjc solution uses "handling_cart".  but that gjc code has lots of other improvements too...