“下订单”后,Magento OnePage结帐重定向点击

时间:2012-05-18 12:39:44

标签: magento redirect

任何人都可以帮助解决以下问题。

一旦onechecheckout中的客户点击“立即订购”按钮,我想显示2-3秒的自定义页面,并转发到付款提供商或谢谢页面。

目前我有观察员 “checkout_type_onepage_save_order_after” 调用我的自定义模型/方法。

在这个模型/方法中,我做了......

$this->_forward($url); //with $url being a custom controller/method
$res->sendResponse();
exit;

在这个自定义控制器/方法中,我加载并渲染我的布局show my * .phtml - file然后......

$url = Mage::getUrl("???");
$this->_forward($url);<
$res = Mage::app()->getResponse();
$res->sendResponse();

这就是我迷失的地方(或者我可能完全错了)。 首先,控制器根本不转发(无论是网址还是控制器)。 其次,我如何知道重定向到哪里(如果是支付提供商或感谢页面)

在用户点击“立即订购”之后以及重定向到感谢页面或付款提供商之前,是否有更好的方法“简单地”加载* .phtml。

phtml是用户加载跟踪代码,必须在html中放置和加载。

1 个答案:

答案 0 :(得分:0)

我建议您考虑执行以下操作:

  • 将javascript操作添加到订单查看中的下订单按钮,这将有效地发出屏幕上的模式或弹出窗口
  • 发出模态的点击将设置超时3000毫秒(3秒),然后将触发Magento使用的订单提交Ajax。这很重要,因为订单提交和重定向依赖于AJAX。

此示例jQuery脚本(需要将jQuery添加到您的Magento站点,这不是标准的)会设置超时,发出模式/弹出窗口我会将此代码添加到以下文件中:

/app/design/frontend/[your theme]/template/checkout/onepage/review/button.phtml

在此行中添加一个类并删除onclick事件,以便捕获单击并插入超时:

<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="btn-place-order button btn-checkout"><span><span><?php echo $this->__('Place Order') ?></span></span></button>

<script>
    $('#myform').submit(function(event) {
        event.preventDefault();
        //issue the popup - put your html in here:
        var html = '<div style="position:absolute; top:0; left:0; min-height: 100%; width: 100%; background-color:white;"><h1>I am a popup</h1></div>';
        $('body').append(html);
        var self = this;
        window.setTimeout(function() {
        review.save();
        }, 3000);
    });
</script>