我正在尝试构建自定义支付方式。它应该像 Paypal 一样工作,当用户点击“下订单”时,它应该将他重定向到外部网关。诀窍是它必须发送 POST 数据。
为了创建模块,我遵循了几个教程,但主要是这个 Incho
模型/标准.php
public function getOrderPlaceRedirectUrl()
{
Mage::Log('Called ' . __METHOD__);
return Mage::getUrl('payment/Standard/Redirect', array('_secure' => true));
}
在我点击程序后,它会将我重定向到
> http://192.168.0.15/magento/index.php/payment/Standard/Redirect
然后我收到 404 错误。在日志文件中,我可以看到它命中了方法 getOrderPlaceRedirectUrl,但它没有到达 redirectAction。谁能帮我解决这个问题,我是 magento 的新手。
Controller /StandardController.php
public function redirectAction()
{
Mage::Log('Called ' . __METHOD__);
//do something
}
block /标准/Redirect.php
protected function _toHtml()
{
Mage::Log('Called ' . __METHOD__);
//do POST
}
最佳答案
Phtml 文件不应该是这里的问题。在本教程中, Controller 是这样注册的:
<frontend>
<routers>
<mycheckout>
<use>standard</use>
<args>
<module>Inchoo_Mycheckout</module>
<frontname>customcard</frontname>
</args>
</mycheckout>
</routers>
</frontend>
同时将 'customcard/standard/redirect'
设为小写。如果您需要进一步的支持并更改模块和类名,请将它们添加到您的问题中。
关于php - magento 自定义支付方式重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18557933/