支付网关给了我这段代码,该代码旨在集成到支付页面中:
Please replace these items with the appropriate data:
• with the ID auto-generated by Gateway for the merchant.
• with the input field of the transaction amount.
• with the input field of the order id.
• with the input field of the product name.
• with the input field of the customer email.
这里的示例:
<input type="hidden" name="mercId" value="">
<input type="hidden" name="currCode" value="">
<input type="hidden" name="amt" value="">
<input type="hidden" name="orderId" value="">
<input type="hidden" name="prod" value="">
<input type="hidden" name="email" value="">
然后我尝试将它合并到正在工作的redirect.phtml中。
<?php
// Retrieve order
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
?>
<form name="mygatewayform" method="post" action="https://sample.com/MerchantServices/MakePayment.aspx">
<input type="hidden" name="orderId" value="<?php echo $orderId; ?>">
<input type="hidden" name="amt" value="<?php echo $_order->getBaseGrandTotal(); ?>">
<input type="hidden" name="mercId" value="05430">
<input type="hidden" name="prod" value="BLACKBERRY BLACK SKIN WHITE">
<input type="hidden" name="email" value="<?php echo $_order->getCustomerEmail(); ?>">
</form>
<script type="text/javascript">
document.mygatewayform.submit();
</script>
但是每次我尝试插入客户以编程方式购买的产品名称时,<?php echo $productname = $item->getName(); ?>
都不会将我重定向到支付网关页面,它只会在 www.domain.com/index.php/mygateway/payment/redirect/ 上停止。这是我尝试过的,它没有再次重定向。
<?php
// Retrieve order
$_order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
?>
<form name="mygatewayform" method="post" action="https://sample.com/MerchantServices/MakePayment.aspx">
<input type="hidden" name="orderId" value="<?php echo $orderId; ?>">
<input type="hidden" name="amt" value="<?php echo $_order->getBaseGrandTotal(); ?>">
<input type="hidden" name="mercId" value="05430">
<input type="hidden" name="prod" value="<?php echo $productname = $item->getName(); ?>">
<input type="hidden" name="email" value="<?php echo $_order->getCustomerEmail(); ?>">
</form>
<script type="text/javascript">
document.mygatewayform.submit();
</script>
请有人告诉我我做错了什么,或者更确切地说如何插入产品名称和信息或将其调用到redirect.phtml页面中?
谢谢