【发布时间】:2016-01-06 08:41:58
【问题描述】:
页眉上的 opencart 迷你推车有问题。我通过互联网尝试了一些解决方案,但没有一个解决方案有效,并且一些解决方案与我的代码相同。
当我单击添加到产品的购物车时,迷你车不会更新,但是当我单击迷你车时,会加载内容,这就是它会更新迷你车的时间。如何在不点击的情况下自动更新迷你车?
谢谢。
代码如下: 模块/cart.tpl
<div class="heading"> <i class="fa fa-shopping-cart "></i> <div class="cart-inner"> <h4><?php echo $heading_title; ?></h4> <a><span id="cart-total"><?php echo $text_items; ?></span></a> </div> </div>
查看/javascript/common.js
$('#cart > .heading a').live('click', function() {
$('#cart').addClass('active');
$('#cart').load('index.php?route=module/cart #cart > *');
$('#cart').live('mouseleave', function() {
$(this).removeClass('active');
});
});
【问题讨论】:
-
向我们展示您的代码以及您尝试过的内容
-
@jiboulex 我试过这个 - forum.opencart.com/viewtopic.php?t=68714 但是当我检查提到的文件时,它们是一样的。
-
common.js 代码 - $('#cart > .heading a').live('click', function() { $('#cart').addClass('active'); $('#cart').load('index.php?route=module/cart #cart > *'); $('#cart').live('mouseleave', function() { $(this). removeClass('active'); }); }); @jiboulex
-
编辑您的问题以将其放入您的代码
标签: php jquery ajax opencart shopping-cart