【发布时间】:2014-06-06 19:59:31
【问题描述】:
我在 opencart 产品页面中添加了一个“立即购买”按钮(也可以添加到购物车)
首先我编辑了catalog/view/theme/mytheme/template/product/product.tpl(在产品页面中获得“立即购买”按钮)
<?php if ($stock == "In Stock") { echo '<input type="button" value="Add to Cart" id="button-cart" class="button-product-page" />'; echo " "; echo '<input type="button" value="Buy Now" id="button-cart-buy" class="button-product-page" />'; } else {echo '<input type="button" value="Out Of Stock" class="button-product-page"/>'; } ?>
在此之后,在 product.tpl 中,我为立即购买创建了一个类似于按钮购物车功能的新功能 (button-cart-buy),但我将 json['success'] 更改为如下所示:
if (json['success']) {window.location='index.php?route=checkout/checkout'; }
当我们在链接为 (http://domain.com/Product) 的产品页面上单击“立即购买”时,它可以工作,但如果我们在浏览类别(即 http://domain.com/MainCategory/SubCategory/Product)后单击“立即购买”,则它不起作用,那么我得到的网址为 http://domain.com/MainCategory/SubCategory/index.php?route=checkout/checkout。但是该产品正在添加到购物车中。
这个问题主要出现在 IE 中,有时也会出现在 Mozilla 中。
我也尝试过在 common.js 中复制 addtoCart 函数。但还是不行。
我错过了什么或需要改变..?请帮忙
感谢 Jay Gilford:
感谢杰伊·吉尔福德的回复。
此答案有助于解决 opencart 论坛上的 5-6 个开放线程。
【问题讨论】: