2012-02-01 11 views
0

このページでは、simpleCart JavaScriptライブラリを使用しているショッピングカートについて説明します。この機能は、カートの送料を変更します。カートで使用する機能を実装するにはどうすればよいですか?Simplecart合計重量

<div class="simpleCart_items"></div> 
<a href="#" class="simpleCart_empty">Svuota Carrello</a> 
<strong>Sub Total: <span class="simpleCart_total"></span></strong> <br /> 
<strong>TAX:<span class="simpleCart_taxCost"</span> </strong> <br /> 
<strong>Productions numbers:<span class="simpleCart_quantity"></span></strong> <br /> 
<strong>Total Weight:???????</span></strong> <br /> 
<strong>Shipping:????</strong> <br /> 

私の現在の機能は次のとおりです。

me.shipping = function() 
{ 
    var q = 0; 
    q += item.weight*item.quantity; 

    if(q <= 3000){ 
     return 19.00; 
    } 
    if((q <= 10000)) { 
     return 23.00; 
    } 
    if((q <= 20000)){ 
     return 24.00; 
    } 
    if((q <= 30000)){ 
     return 26.00; 
    } 
    if((q <= 50000)){ 
     return 32.00; 
    } 
    if((q <= 75000)){ 
     return 35.00; 
    } 
    if((q <= 100000)){ 
     return 39.00; 
    } 
} 

答えて

0

パーsimpleCartドキュメントは、彼らはあなたが送料をカスタマイズできるようにする多くの方法があります。

CartItem.prototype.shipping=function(){ 
// we are using a 'size' field to calculate the shipping, 
// so we first make sure the item has a size 
    if(this.size){ 
     if(this.size == 'small'){ 
      return this.quantity*5.00; 
     } else if(this.size == 'large') { 
      return this.quantity*7.50; 
     } else { 
      return this.quantity*10.00; 
     } 
    } else { 
     // use a default of $2.00 per item if there is no 'size' field 
     return this.quantity*2.00; 
    } 
} 

これは、あなたが出荷の計算方法を編集することができます方法を示しています。私が見た、特に一つは、ほぼ正確に私が(ポストが読みすることが困難であった)あなたが望む何を考えていました。この例では、サイトのドキュメントごとに多くの他のものが利用可能です:http://simplecartjs.com/documentation.html

+0

タンク。重量の異なる出荷のための機能は不可能です。私のクライアント商取引ブドウは重量のために。重量<3000 = 19ユーロ。重量<10000 = 24ユーロなど – Gio73

関連する問題