yogeshnaik Posted April 20, 2013 Posted April 20, 2013 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 .... ? Quote A man is great by Deeds, not by Birth....
Bob Terveuren Posted April 21, 2013 Posted April 21, 2013 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) Quote
yogeshnaik Posted April 22, 2013 Author Posted April 22, 2013 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 Quote A man is great by Deeds, not by Birth....
Bob Terveuren Posted May 1, 2013 Posted May 1, 2013 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? Quote
yogeshnaik Posted May 4, 2013 Author Posted May 4, 2013 (edited) 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 May 4, 2013 by yogeshnaik Quote A man is great by Deeds, not by Birth....
Bob Terveuren Posted May 12, 2013 Posted May 12, 2013 (edited) 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 May 12, 2013 by Bob Terveuren Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.