Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

prices like 9.90 becomes 9.9 when processeds to send to gateway it becomes 0.99
 
tubadc
Sr. Member
 
Total Posts:  95
Joined:  2008-05-07
Floripa | BR
 

I have to send to mys gateway prices with no commas or dots… so if the price is 9.90, i have to transform it to 990 and send it… but… when i do that the last zero dissapear… why?

my code

if ($items{
                $i 
1;
                foreach(
$items as $item){
                     
//echo "<pre>"; print_r($item->getData()); echo"</pre>";
                     
$preco=$item->getBaseCalculationPrice();
                     
$desconto=$item->getBaseDiscountAmount();
                     
$totalproduto=$preco-$desconto;
                     
$totalproduto=str_replace(".","",$totalproduto);
                     
$totalproduto=str_replace(",","",$totalproduto);
                     
$sArr array_merge($sArr, array(
                        
'item_descr_'.$i      => $item->getName(),
                        
'item_id_'.$i      => $item->getSku(),
                        
'item_quant_'.$i      => $item->getQty(),
                        
'item_valor_'.$i      => $totalproduto,
                    ));

tks

 
Magento Community Magento Community
Magento Community
Magento Community
 
tubadc
Sr. Member
 
Total Posts:  95
Joined:  2008-05-07
Floripa | BR
 

i use number_format and work now… sorry to bother…

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

How about just multiplying the price by 100?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top