Hi, I need prices on my webpages be in Croatian kuna HRK (I have to show them in national currency by the law). I know that this is not PayPal supported currency. I had this problem already solved in on other sites (with Virtuemart). I put in payment gateway script to divide total sum with 7,4 (HRK-EUR ratio) to get amount in Euros and to send default currency euro to PayPal websites. Now, I want to do the same thing on other site (Wordpress) where I have php string: <input type="hidden" name="a3" value="'.$data['price']['total'].'">'; I tried many possibilities to put divide with 7,4 but I can't do it right. I am not that good in PHP. I need help, please. Thank you.
You'll need to show more of your code: <?php $hrk = 7.47; //division rate for the Croatian Kuna $price = 1.00; // example 1euro $hrk_price = $price / $hrk; //Euro devided by Croatian Kuna echo number_format($hrk_price, 2, '.', ''); // 0.13 for 2 decimals ?> PHP:
tnx. this is full code for paypal gateway: function gateway_paypal($data=""){ global $wpdb; $gatewaycode = ""; $gatewaycode .= '<form method="post" action="https://www.paypal.com/cgi-bin/webscr" name="checkout_paypal">'; if($_POST['rec'] == 1){ $gatewaycode .= '<input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="a3" value="'.$data['price']['total'].'">'; if(!isset($_POST['rec_days'])){ $gatewaycode .= '<input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1">'; }else{ if($_POST['rec_days'] < 8){ $gatewaycode .= '<input type="hidden" name="a3" value="'.$data['price']['total'].'"> <input type="hidden" name="p3" value="'.$_POST['rec_days'].'"> <input type="hidden" name="t3" value="D"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1">'; }elseif($_POST['rec_days'] < 30){ $numweeks = $_POST['rec_days']/7; $gatewaycode .= '<input type="hidden" name="a3" value="'.$data['price']['total'].'"> <input type="hidden" name="p3" value="'.$numweeks.'"> <input type="hidden" name="t3" value="W"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1">'; }elseif($_POST['rec_days'] < 370){ $nummonths = $_POST['rec_days']/30; $gatewaycode .= '<input type="hidden" name="a3" value="'.$data['price']['total'].'"> <input type="hidden" name="p3" value="'.$nummonths.'"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1">'; } } }else{ $gatewaycode .= '<input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="amount" value="'.$data['price']['total'].'">'; } $gatewaycode .= ' <input type="hidden" name="return" value="'.get_option('paypal_return').'?order_id='.$data['orderid'].'"> <input type="hidden" name="cancel_return" value="'.get_option('paypal_cancel').'"> <input type="hidden" name="notify_url" value="'.get_option('paypal_notify').'"> <input type="hidden" name="item_name" value="'.strip_tags($data['description']).'"> <input type="hidden" name="item_number" value="'.$data['orderid'].'"> <input type="hidden" name="business" value="'.get_option('paypal_email').'"> <input type="hidden" name="currency_code" value="'.get_option('paypal_currency').'"> <input type="hidden" name="custom" value="'.$data['orderid'].'"> <p class="CheckoutBtn"><a href="javascript:document.checkout_paypal.submit();">'.SPEC($GLOBALS['_LANG']['_checkout']) .'</a></p> </form>'; return $gatewaycode; } It is WP couponpress gateway for paypal. I will also need to give default currency code - EURO to be sent to PayPAl.
All that code is the php file creating the html. You do the conversion in the php code that sends the price to the gateway - that's somewhere else in the code.
$price = round($data['price']['total'] / 7.4, 2); (Note - . not , for the decimal separator.) You can round it to as many digits as you need, but I think Euros go to 2 digits.
is anyone solve this problem?? I need help about that code. I've the same problem like shmizla, but i dont know hot to figure it out. Tnx