如何将产品名称及其信息插入magento中的redirec.phtml?

如何将产品名称及其信息插入magento中的redirec.phtml?,magento,Magento,支付网关向我提供了此代码,该代码将集成到支付页面: 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

支付网关向我提供了此代码,该代码将集成到支付页面:

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>


我不确定这段代码是否能解决您的问题,但如果我没有弄错的话,
getName()
函数不起作用是因为
$item

首先,您应该加载购物车中可用的项目

$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

// then loop on items
foreach ($items as $item) {
    echo $item->getName().'<br />';
}
$items=Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
//然后循环项目
foreach($items作为$item){
echo$item->getName()。
; }
我肯定
产品名称
不是真实的产品名称。网关提供商对您销售的产品不感兴趣。简单地说,如果您的购物车中有多个产品,您会怎么做?谢谢您的评论,但每次客户从我们的网站下订单时,我们都需要包含产品名称,该名称将显示在最终支付网关页面上,这就是为什么需要包含它的原因。每次im测试通过手动插入默认产品名称来运行它时,它都会重定向到支付网关方式,例如,您是否使用google checkout?我想您使用的是V-Money,对吗?Abiodun,如果您有网关提供商API文档,请与我共享。我应该看看他们想要什么。因为,您试图在表单中插入产品名称,但您没有想到它们是否是购物车中的多个产品!
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();

// then loop on items
foreach ($items as $item) {
    echo $item->getName().'<br />';
}