先找到该目录下的app\design\frontend\default\blank\template\catalog\product\view\
addtocart.phtml 文件
然后对这个文件做修改:
<button id="checknow" type="button" title="<?php echo $this->__('立即购买') ?>" class="button btn-cart" >
<span>
<?php echo $this->__('立即购买') ?></span>
</button>
<input type="hidden" name="return_url" id="return_url" value="" />
新增立即购买按钮,隐藏跳转地址。
再新增jQuery方法操作:
jQuery("#checknow").click(function(){
jQuery("input#return_url").val("<?php echo $this->getUrl('checkout/onepage/'); ?>");
productAddToCartForm.submit();
})
OK了。这样你点击立即购买就能直接跳到结账页面。点击加入购物车跳到购物车页面