Twitter bootstrap 3 Bootstrap 3、Opencart 1.5.6.4和Cart模块

Twitter bootstrap 3 Bootstrap 3、Opencart 1.5.6.4和Cart模块,twitter-bootstrap-3,modal-dialog,opencart,cart,Twitter Bootstrap 3,Modal Dialog,Opencart,Cart,嗯。我已经改变了smth,现在它几乎可以正常工作了。只剩下一个问题。 标题中的购物车链接(id为购物车总数的div)不再位于id为购物车的div中。所以,当我在购物车模式中删除产品时,标题中的链接并没有更新,就像它仍然有产品一样 这是新代码模块/cart.tpl - - x | &时代;关 这是来自common.js /*Ajax购物车*/ $('.heading a').live('单击',函数()){ $('#cart').load('index.php?route=module/ca

嗯。我已经改变了smth,现在它几乎可以正常工作了。只剩下一个问题。 标题中的购物车链接(id为购物车总数的div)不再位于id为购物车的div中。所以,当我在购物车模式中删除产品时,标题中的链接并没有更新,就像它仍然有产品一样

这是新代码
模块/cart.tpl


-
-
x | &时代;关
这是来自
common.js

/*Ajax购物车*/
$('.heading a').live('单击',函数()){
$('#cart').load('index.php?route=module/cart#cart>*');
});
功能addToCart(产品标识、数量){
数量=类型(数量)!=“未定义”?数量:1;
$.ajax({
url:'index.php?route=checkout/cart/add',
键入:“post”,
数据:“产品id=”+产品id+”&数量=”+数量,
数据类型:“json”,
成功:函数(json){
$('.success、.warning、.attention、.information、.error').remove();
if(json['redirect']){
location=json['redirect'];
}
if(json['success']){
$('#notification').html(''+json['success']+'');
$('success').fadeIn('slow');
$('#购物车总数').html(json['total']);
$('html,body')。动画({scrollTop:0},'slow');
}   
}
});
}
我用
1.我已将
onClick
更改为:

<a alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" />
<?php echo $button_remove; ?>
</a>
致:


common.js
文件中替换此js,然后检查它

函数addToCart(产品标识、数量){
数量=类型(数量)!=“未定义”?数量:1;
$.ajax({
url:'index.php?route=checkout/cart/add',
键入:“post”,
数据:“产品id=”+产品id+”&数量=”+数量,
数据类型:“json”,
成功:函数(json){
$('.alert success、.alert warning、.alert attention、.alert info、.alert danger').remove();
if(json['redirect']){
location=json['redirect'];
}
if(json['success']){
$('#通知').html(''
+json['success']+'×;Close');
$('.alert success').fadeIn('slow');
$('#购物车总数').html(json['total']);
$('#cart').load('index.php?route=module/cart#cart>*');
$('html,body')。动画({scrollTop:0},'slow');
}   
}
});
}

问题不在于JS,也不在于向购物车添加产品(您从
common.JS
粘贴到这里的JS代码)-您自己描述的问题是我删除产品时出现的

因此,您必须查看完全不同的位置,也就是说(为了更好的可读性,我将其格式化了一点,您应该在模板中执行相同的操作):



您好@HarnishDesign,谢谢您的回答。不幸的是,这没有帮助。和对不起,您的代码与下面的代码不一样吗?也许我不是很专心,但看起来你不小心粘贴了这个代码而不是你的解决方案。谢谢你的时间和帮助。不幸的是,它不起作用。我用
包装了所有内容,替换了
$(“#cart”)中的选择器。加载(…)
,但没有。到底什么不起作用?你有什么错误吗?它什么也不做(什么也没发生)?我看不出它为什么不起作用。您能在问题中更新实际模板的代码吗?对不起,我将尝试解释
<a alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart-container').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" />
    <?php echo $button_remove; ?>
</a>
<a alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart-container').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" />
    <?php echo $button_remove; ?>
</a>
<a alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart-container').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart-container > *');" />
    <?php echo $button_remove; ?>
</a>