先找到該目錄下的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了。這樣你點擊立即購買就能直接跳到結賬頁面。點擊加入購物車跳到購物車頁面