문제

I am integrating a custom payment gateway into magento.

I need to send the order total to them in pence, currently it is set to pounds.

My current code is below

<?php
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
?>
<form name="mygatewayform" method="get" action="gateway url">
<input type="hidden" name="Tariff" value="<?php echo $_order->getBaseGrandTotal(); ?>">
</form>

This adds the total to the 'action' gateway URL as the Tariff but total is in pounds i.e. 1.50 but needs to be in pence 150.

도움이 되었습니까?

해결책

<input type="hidden" name="Tariff" value="<?php echo ceil($_order->getBaseGrandTotal() * 100); ?>">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top