Jump to content
Sign in to follow this  
yogeshnaik

Paypal Fee not getting displayed in Paypal page

Recommended Posts

Hi People.

 

I've got some issue with paypal_standard...... I know where is the issue, but I'm not able to rectify it........

 

Problem is, in my checkout_confirmation.php .....prices of products and Paypal Fee value clearly gets displayed.....

 

But when I hit "Confirm Order" button.... it leads me to Paypal Page...... here product name, prices... everything is visible, except Paypal Fee.

 

I just checked paypal_standard.php page via firebug on mozilla... and there i saw these entries...

 

 

<input type="hidden" value="_cart" name="cmd">

 

<input type="hidden" value="1" name="upload">

 

<input type="hidden" value="8.50" name="handling_cart">

 

<input type="hidden" value="STORE_URL/FILENAME_STORE" name="shopping_url">

 

<input type="hidden" value="0.00" name="tax_cart">

 

that tax_cart value i changed in firebug editor itself and clicked the "Confirm Order" button... and this time "Paypal Fee" was visible...

 

In paypal_standard.php the code is like....

 

$process_button_string = '';

$parameters = array('cmd' => '_cart',

'upload' => '1',

'handling_cart' => $this->format_raw($order->info['shipping_cost']),

'shopping_url' => STORE_URL.'/'.FILENAME_STORE,

'tax_cart' => $this->format_raw($order->info['tax']),

'business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID,

'currency_code' => $currency,

 

Issue is somewhere here I guess 'tax_cart' => $this->format_raw($order->info['tax']),

 

Any idea how to fix this .... ?


A man is great by Deeds, not by Birth....

Share this post


Link to post
Share on other sites

Hi

 

Tax will be any order tax - your PayPal fee is likely a different ot_ module so find a way of gettng that module amount into the tax_cart field.

I think btw that PayPal may smack you if they think you are doing this (well they used to but maybe times have changed)

Share this post


Link to post
Share on other sites

Hi

 

Tax will be any order tax - your PayPal fee is likely a different ot_ module so find a way of gettng that module amount into the tax_cart field.

I think btw that PayPal may smack you if they think you are doing this (well they used to but maybe times have changed)

 

Thanx for your reply sir....

 

Actually I'm using this add on....

 

http://addons.oscommerce.com/info/3132/v,22


A man is great by Deeds, not by Birth....

Share this post


Link to post
Share on other sites

Hi Yogesh

 

Looking at that module there's a chunk of code

  if (MODULE_ORDER_TOTAL_PAYPAL_STATUS == 'true') {
    //check if payment method is paypal. If yes, add fee.
	 if ($GLOBALS['payment'] == 'paypal_standard') {
	 $paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
	    $order->info['total'] += $paypal_fee;//<--------------- this updates the total
///////////////////////////////// this but just displays the fee //////////////////////////////////////////////////////
	    $this->output[] = array('title' => $this->title . ' (' . MODULE_ORDER_TOTAL_PAYPAL_FEE . '%):',
							    'text' => $currencies->format($paypal_fee, true,  $order->info['currency'], $order->info['currency_value']),
							    'value' => $paypal_fee);
    }
  }
}

 

That adds the paypal % to the order->total send to PayPal so whilst it appears in the checkout_confirmation page as an individual amount the % does not get sent to PayPal by itself - have a look at the actual order amount and see if that holds the extra amount?

Share this post


Link to post
Share on other sites

Hi Yogesh

 

Looking at that module there's a chunk of code

 if (MODULE_ORDER_TOTAL_PAYPAL_STATUS == 'true') {
 //check if payment method is paypal. If yes, add fee.
	 if ($GLOBALS['payment'] == 'paypal_standard') {
	 $paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
	 $order->info['total'] += $paypal_fee;//<--------------- this updates the total
///////////////////////////////// this but just displays the fee //////////////////////////////////////////////////////
	 $this->output[] = array('title' => $this->title . ' (' . MODULE_ORDER_TOTAL_PAYPAL_FEE . '%):',
							 'text' => $currencies->format($paypal_fee, true, $order->info['currency'], $order->info['currency_value']),
							 'value' => $paypal_fee);
 }
 }
}

 

That adds the paypal % to the order->total send to PayPal so whilst it appears in the checkout_confirmation page as an individual amount the % does not get sent to PayPal by itself - have a look at the actual order amount and see if that holds the extra amount?

 

Thanx Sir,

 

I put this code in paypal_standard.php (catalog/includes/modules/payment)

 

$paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);

 

inside function process_button() {

 

so its like

 


function process_button() {
 global $customer_id, $order, $sendto, $currency, $cart_PayPal_Standard_ID, $shipping;

$paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);



 $process_button_string = '';
	 $parameters = array('cmd' => '_cart',
					 'upload' => '1',
					 'handling_cart' => $this->format_raw($order->info['shipping_cost']),
					 'shopping_url' => STORE_URL.'/'.FILENAME_STORE,
					 'tax_cart' => $paypal_fee,
					 'business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID,

 

Thing is.... Paypal Fee is now visible in Paypal page... but it rounds off the amount... I mean if Paypal fee is 0.64 it will show as 1.00

 

Is there any way to show the exact amount..?

 

I guess it rounds up... Is it because of tep_round function..?

 

any other function can I put instead of tep_round...?

Edited by yogeshnaik

A man is great by Deeds, not by Birth....

Share this post


Link to post
Share on other sites

Hi

 

try this instead (I seem to have a different PayPal file but this works here)

 

reset the payment file to it's original and then go to the includes/modules/order_total/ot_paypal_fee.php file and find the line

 

$order->info['total'] += $paypal_fee;

 

duplicate that below and change total to tax

 

$order->info['tax'] += $paypal_fee;

 

So you should have something that looks like

 

function process() {
 global $order, $currencies, $paypal_fee;

 if (MODULE_ORDER_TOTAL_PAYPAL_STATUS == 'true') {
 //check if payment method is paypal. If yes, add fee.
	 if ($GLOBALS['payment'] == 'paypal_standard') {
	 $paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
	 $order->info['total'] += $paypal_fee;
$order->info['tax'] += $paypal_fee;
	 $this->output[] = array('title' => $this->title . ' (' . MODULE_ORDER_TOTAL_PAYPAL_FEE . '%):',
							 'text' => $currencies->format($paypal_fee, true, $order->info['currency'], $order->info['currency_value']),
							 'value' => $paypal_fee);
 }
 }
}

 

That should get the totals running for you in the checkout_confirmation.php correctly (trying it your way I found that the paypal % fee was getting added twice as it was being calculated in the order total file and there it was being added to order_total - the later calculation from the payment file was then calculating the %fee again but on the new order_total

Edited by Bob Terveuren

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×