限制ECShop参与对比的产品数量
效果:
方法:
打开 /js/compare.js 在以下位置添加以下代码:
/* $Id: compare.js 15469 2008-12-19 06:34:44Z testyang $ */
var Compare = new Object();
Compare = {
  add : function(goodsId, goodsName, type)
  {
    var count = 0;
    for (var k in this.data)
    {
      if (typeof(this.data[k]) == "function")
      continue;
      if (this.data[k].t != type) {
        alert(goods_type_different.replace("%s", goodsName));
        return;
      }
      count++;
    // 添加的代码开始:
    if(count >= 4) {
        alert('T_T,只能选择不超过4款产品');
        return;
    }
    // 添加的代码结束。
    }
    if (this.data[goodsId])
    {
      alert(exist.replace("%s",goodsName));
      return;
    }
<完>

