2016-06-13 11 views
0

私は、カートのアイコンを削除し、 HTMLタグを追加するように変更しました。opencartのaddtocartボタンをクリックすると、ヘッダカートの情報がデフォルトに変更されます

language/english/common/cart.php 
$_['text_items']  = '<p>Mycart</p><span><em>%s</em> item(s) - %s</span>'; 

common/cart.tpl 
    <button type="button" data-toggle="dropdown" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-inverse btn-block btn-lg dropdown-toggle"><!-- <i class="fa fa-shopping-cart"></i> --><span id="cart-total"><?php echo $text_items; ?></span></button> 

それが正常に動作しますが、私はaddtocartボタンをクリックしたときには、Ajax 、デフォルトにリセット以前の修正カートのタグを使用してロードします。リフレッシュすると再び が動作します。誰もがこれについて知っていた。

答えて

1

私たちが共通/カート を同期させる必要があるので、それはAJAXを使用して、クリックイベントや負荷 チェックアウト/カートに呼び出し関数を呼び出しますため、私たちは製品にaddtocartボタンを detialページをクリックしたときに何が起こっています は、次のような情報とchekout /カートinfourmation
私は問題を解決する:あなたは内部addtocart

追加product.tplまたはその他のページで

$('#button-cart').on('click', function() { 

我々は 言語/英語/チェックアウト/ cart.php

$_['text_items']    = '<p>Mycart</p><span><em>%s</em> item(s) - %s</span>'; 
に変更

if (json['success']) { 
       $('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>'); 

       $('#cart > button').html('<!--<i class="fa fa-shopping-cart"></i>--> ' + json['total']);//here you can get the cart icon and comment out he icon code 

       $('html, body').animate({ scrollTop: 0 }, 'slow'); 

       $('#cart > ul').load('index.php?route=common/cart/info ul li'); 
      } 

を見つけるためのカート情報内の他のタグを追加します

関連する問題