有人能帮我解决以下问题吗。
一旦一个客户在onepagecheckout点击“现在订单”按钮,我想显示一个定制页面2-3秒,并转发到付款提供商或感谢您的页面。
目前,我在"checkout_type_onepage_save_order_after“上有一个观察者在调用我的自定义模型/方法。
在这个模型/方法中我做了一个..。
$this->_forward($url); //with $url being a custom controller/method
$res->sendResponse();
exit;在这个自定义控制器/方法中,我加载和呈现我的布局,显示我的*.phtml文件,然后.
$url = Mage::getUrl("???");
$this->_forward($url);<
$res = Mage::app()->getResponse();
$res->sendResponse();这就是我迷失的地方(也许我在整件事上完全错了)。首先,控制器根本不转发(无论给出什么url或控制器)。第二,我如何知道重定向到哪里(如果它的支付提供商或感谢您页面)
是否有更好的方法“简单地”加载一个*.phtml后,用户点击“现在订单”,在他被重定向到感谢页面或付款提供商。
phtml是用户来加载跟踪代码,这些代码必须放在html中并加载。
发布于 2012-08-05 00:57:00
相反,我建议你考虑做以下工作:
。
这个示例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>https://stackoverflow.com/questions/10652815
复制相似问题