/**
  * 点击刷新购物车
  */
 public function ajax_update_cart()
 {
     //格式化返回数组
     $result = array('error' => 0, 'message' => '');
     // 是否有接收值
     if (isset($_POST['rec_id']) && isset($_POST['goods_number'])) {
         $key = $_POST['rec_id'];
         $val = $_POST['goods_number'];
         $val = intval(make_semiangle($val));
         if ($val <= 0 && !is_numeric($key)) {
             $result['error'] = 99;
             $result['message'] = '';
             die(json_encode($result));
         }
         // 查询:
         $condition = " rec_id='{$key}' AND session_id='" . SESS_ID . "'";
         $goods = $this->model->table('cart')->field('goods_id,goods_attr_id,product_id,extension_code')->where($condition)->find();
         $sql = "SELECT g.goods_name,g.goods_number " . "FROM " . $this->model->pre . "goods AS g, " . $this->model->pre . "cart AS c " . "WHERE g.goods_id =c.goods_id AND c.rec_id = '{$key}'";
         $res = $this->model->query($sql);
         $row = $res[0];
         // 查询:系统启用了库存,检查输入的商品数量是否有效
         if (intval(C('use_storage')) > 0) {
             if ($row['goods_number'] < $val) {
                 $result['error'] = 1;
                 $result['message'] = sprintf(L('stock_insufficiency'), $row['goods_name'], $row['goods_number'], $row['goods_number']);
                 $result['err_max_number'] = $row['goods_number'];
                 die(json_encode($result));
             }
             /* 是货品 */
             $goods['product_id'] = trim($goods['product_id']);
             if (!empty($goods['product_id'])) {
                 $condition = " goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $goods['product_id'] . "'";
                 $product_number = $this->model->table('products')->field('product_number')->where($condition)->getOne();
                 if ($product_number < $val) {
                     $result['error'] = 2;
                     $result['message'] = sprintf(L('stock_insufficiency'), $row['goods_name'], $product_number, $product_number);
                     die(json_encode($result));
                 }
             }
         }
         /* 查询:检查该项是否为基本件 以及是否存在配件 */
         /* 此处配件是指添加商品时附加的并且是设置了优惠价格的配件 此类配件都有parent_idgoods_number为1 */
         $sql = "SELECT b.goods_number,b.rec_id\r\n\t\t\tFROM " . $this->model->pre . "cart a, " . $this->model->pre . "cart b\r\n\t\t\t\tWHERE a.rec_id = '{$key}'\r\n\t\t\t\tAND a.session_id = '" . SESS_ID . "'\r\n\t\t\tAND b.parent_id = a.goods_id\r\n\t\t\tAND b.session_id = '" . SESS_ID . "'";
         $offers_accessories_res = $this->model->query($sql);
         // 订货数量大于0
         if ($val > 0) {
             /* 判断是否为超出数量的优惠价格的配件 删除 */
             $row_num = 1;
             foreach ($offers_accessories_res as $offers_accessories_row) {
                 if ($row_num > $val) {
                     $sql = "DELETE FROM" . $this->model->pre . "cart WHERE session_id = '" . SESS_ID . "' " . " AND rec_id ='" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                     $this->model->query($sql);
                 }
                 $row_num++;
             }
             $attr_id = empty($goods['goods_attr_id']) ? array() : explode(',', $goods['goods_attr_id']);
             $goods_price = model('GoodsBase')->get_final_price($goods['goods_id'], $val, true, $attr_id);
             // 更新购物车中的商品数量
             $sql = "UPDATE " . $this->model->pre . "cart SET goods_number= '{$val}', goods_price = '{$goods_price}' WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
         } else {
             /* 如果是基本件并且有优惠价格的配件则删除优惠价格的配件 */
             foreach ($offers_accessories_res as $offers_accessories_row) {
                 $sql = "DELETE FROM " . $this->model->pre . "cart WHERE session_id= '" . SESS_ID . "' " . "AND rec_id ='" . $offers_accessories_row['rec_id'] . "' LIMIT 1";
                 $this->model->query($sql);
             }
             $sql = "DELETE FROM " . $this->model->pre . "cart WHERE rec_id='{$key}' AND session_id='" . SESS_ID . "'";
         }
         $this->model->query($sql);
         /* 删除所有赠品 */
         $sql = "DELETE FROM " . $this->model->pre . "cart WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0";
         $this->model->query($sql);
         $result['rec_id'] = $key;
         $result['goods_number'] = $val;
         $result['goods_subtotal'] = '';
         $result['total_desc'] = '';
         $result['cart_info'] = insert_cart_info();
         /* 计算合计 */
         $cart_goods = model('Order')->get_cart_goods();
         foreach ($cart_goods['goods_list'] as $goods) {
             if ($goods['rec_id'] == $key) {
                 $result['goods_subtotal'] = $goods['subtotal'];
                 break;
             }
         }
         $market_price_desc = sprintf(L('than_market_price'), $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']);
         /* 计算折扣 */
         $discount = model('Order')->compute_discount();
         $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']);
         $your_discount = sprintf('', $favour_name, price_format($discount['discount']));
         $result['total_desc'] = $cart_goods['total']['goods_price'];
         $result['total_number'] = $cart_goods['total']['total_number'];
         $result['market_total'] = $cart_goods['total']['market_price'];
         //市场价格
         die(json_encode($result));
     } else {
         $result['error'] = 100;
         $result['message'] = '';
         die(json_encode($result));
     }
 }
Exemple #2
0
    if ($_CFG['one_step_buy'] == '1') {
        clear_cart();
    }
    /* 商品数量是否合法 */
    if (!is_numeric($package->number) || intval($package->number) <= 0) {
        $result['error'] = 1;
        $result['message'] = $_LANG['invalid_number'];
    } else {
        /* 添加到购物车 */
        if (add_package_to_cart($package->package_id, $package->number)) {
            if ($_CFG['cart_confirm'] > 2) {
                $result['message'] = '';
            } else {
                $result['message'] = $_CFG['cart_confirm'] == 1 ? $_LANG['addto_cart_success_1'] : $_LANG['addto_cart_success_2'];
            }
            $result['content'] = insert_cart_info();
            $result['one_step_buy'] = $_CFG['one_step_buy'];
        } else {
            $result['message'] = $err->last_message();
            $result['error'] = $err->error_no;
            $result['package_id'] = stripslashes($package->package_id);
        }
    }
    $result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
    die($json->encode($result));
} else {
    /* 标记购物流程为普通商品 */
    $_SESSION['flow_type'] = CART_GENERAL_GOODS;
    /* 如果是一步购物,跳到结算中心 */
    if ($_CFG['one_step_buy'] == '1') {
        ecs_header("Location: flow.php?step=checkout\n");
 public function add_to_gift()
 {
     //对goods处理
     $_POST['goods'] = strip_tags(urldecode($_POST['goods']));
     $_POST['goods'] = json_str_iconv($_POST['goods']);
     if (!empty($_REQUEST['goods_id']) && empty($_POST['goods'])) {
         if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) {
             ecs_header("Location:./\n");
         }
         exit;
     }
     // 初始化返回数组
     $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '', 'product_spec' => '');
     if (empty($_POST['goods'])) {
         $result['error'] = 1;
         die(json_encode($result));
     }
     $json = new EcsJson();
     $goods = $json->decode($_POST['goods']);
     $result['goods_id'] = $goods->goods_id;
     $result['product_spec'] = $goods->spec;
     // 检查:如果商品有规格,而post的数据没有规格,把商品的规格属性通过JSON传到前台
     if (empty($goods->spec) and empty($goods->quick)) {
         $sql = "SELECT a.attr_id, a.attr_name, a.attr_type, " . "g.goods_attr_id, g.attr_value, g.attr_price " . 'FROM ' . $this->model->pre . 'goods_attr AS g ' . 'LEFT JOIN ' . $this->model->pre . 'attribute AS a ON a.attr_id = g.attr_id ' . "WHERE a.attr_type != 0 AND g.goods_id = '" . $goods->goods_id . "' " . 'ORDER BY a.sort_order, g.attr_price, g.goods_attr_id';
         $res = $this->model->query($sql);
         if (!empty($res)) {
             $spe_arr = array();
             foreach ($res as $row) {
                 $spe_arr[$row['attr_id']]['attr_type'] = $row['attr_type'];
                 $spe_arr[$row['attr_id']]['name'] = $row['attr_name'];
                 $spe_arr[$row['attr_id']]['attr_id'] = $row['attr_id'];
                 $spe_arr[$row['attr_id']]['values'][] = array('label' => $row['attr_value'], 'price' => $row['attr_price'], 'format_price' => price_format($row['attr_price'], false), 'id' => $row['goods_attr_id']);
             }
             $i = 0;
             $spe_array = array();
             foreach ($spe_arr as $row) {
                 $spe_array[] = $row;
             }
             $result['error'] = ERR_NEED_SELECT_ATTR;
             $result['goods_id'] = $goods->goods_id;
             $result['parent'] = $goods->parent;
             $result['message'] = $spe_array;
             die(json_encode($result));
         }
     }
     // 购买礼包商品清空购物车
     model('Order')->clear_cart(CART_GIFT_GOODS);
     // 查询:系统启用了库存,检查输入的商品数量是否有效
     // 查询
     $arrGoods = $this->model->table('goods')->field('goods_name,goods_number,extension_code')->where('goods_id =' . $goods->goods_id)->find();
     $goodsnmber = model('Users')->get_goods_number($goods->goods_id);
     $goodsnmber += $goods->number;
     if (intval(C('use_storage')) > 0) {
         if ($arrGoods['goods_number'] < $goodsnmber) {
             $result['error'] = 1;
             $result['message'] = sprintf(L('stock_insufficiency'), $arrGoods['goods_name'], $arrGoods['goods_number'], $arrGoods['goods_number']);
             if (C('use_how_oos') == 1) {
                 $result['message'] = L('oos_tips');
             }
             die(json_encode($result));
         }
     }
     // 检查:商品数量是否合法
     if (!is_numeric($goods->number) || intval($goods->number) <= 0) {
         $result['error'] = 1;
         $result['message'] = L('invalid_number');
     } else {
         // 更新:添加到购物车
         $_SESSION['flow_type'] = CART_GIFT_GOODS;
         $_SESSION['extension_code'] = "gift_goods";
         $_SESSION['extension_id'] = CART_GIFT_GOODS;
         if (model('Order')->addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent, CART_GIFT_GOODS)) {
             if (C('cart_confirm') > 2) {
                 $result['message'] = '';
             } else {
                 $result['message'] = C('cart_confirm') == 1 ? L('addto_cart_success_1') : L('addto_cart_success_2');
             }
             $result['content'] = insert_cart_info();
             $result['one_step_buy'] = C('one_step_buy');
         } else {
             $result['message'] = ECTouch::err()->last_message();
             $result['error'] = ECTouch::err()->error_no;
             $result['goods_id'] = stripslashes($goods->goods_id);
             if (is_array($goods->spec)) {
                 $result['product_spec'] = implode(',', $goods->spec);
             } else {
                 $result['product_spec'] = $goods->spec;
             }
         }
     }
     $cart_confirm = C('cart_confirm');
     $result['confirm_type'] = !empty($cart_confirm) ? C('cart_confirm') : 2;
     // 返回购物车商品总数量
     $result['cart_number'] = insert_cart_info_number();
     die(json_encode($result));
 }
 /**
  * 添加礼包到购物车
  */
 public function add_package_to_cart()
 {
     $_POST['package_info'] = json_str_iconv($_POST['package_info']);
     $result = array('error' => 0, 'message' => '', 'content' => '', 'package_id' => '');
     if (empty($_POST['package_info'])) {
         $result['error'] = 1;
         die(json_encode($result));
     }
     $json = new EcsJson();
     $package = $json->decode($_POST['package_info']);
     /* 如果是一步购物,先清空购物车 */
     if (C('one_step_buy') == '1') {
         model('Order')->clear_cart();
     }
     /* 商品数量是否合法 */
     if (!is_numeric($package->number) || intval($package->number) <= 0) {
         $result['error'] = 1;
         $result['message'] = L('invalid_number');
     } else {
         /* 添加到购物车 */
         if (model('Order')->add_package_to_cart($package->package_id, $package->number)) {
             if (C('cart_confirm') > 2) {
                 $result['message'] = '';
             } else {
                 $result['message'] = C('cart_confirm') == 1 ? L('addto_cart_success_1') : L('addto_cart_success_2');
             }
             $result['content'] = insert_cart_info();
             $result['one_step_buy'] = C('one_step_buy');
         } else {
             $result['message'] = ECTouch::err()->last_message();
             $result['error'] = ECTouch::err()->error_no;
             $result['package_id'] = stripslashes($package->package_id);
         }
     }
     $cart_confirm = C('cart_confirm');
     $result['confirm_type'] = !empty($cart_confirm) ? $cart_confirm : 2;
     die(json_encode($result));
 }
    function content_559878bbf3b0e7_68420577($_smarty_tpl)
    {
        if (!is_callable('smarty_function_insert_scripts')) {
            include 'D:\\WWW\\ecshoptk\\ThinkPHP\\Library\\Vendor\\Smarty\\plugins\\function.insert_scripts.php';
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="<?php 
        echo $_smarty_tpl->tpl_vars['keywords']->value;
        ?>
" />
<meta name="Description" content="<?php 
        echo $_smarty_tpl->tpl_vars['description']->value;
        ?>
" />
<!-- TemplateBeginEditable name="doctitle" -->
<title><?php 
        echo $_smarty_tpl->tpl_vars['page_title']->value;
        ?>
</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="animated_favicon.gif" type="image/gif" />
<link href="<?php 
        echo $_smarty_tpl->tpl_vars['ecs_css_path']->value;
        ?>
" rel="stylesheet" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="RSS|<?php 
        echo $_smarty_tpl->tpl_vars['page_title']->value;
        ?>
" href="<?php 
        echo $_smarty_tpl->tpl_vars['feed_url']->value;
        ?>
" />

<?php 
        echo smarty_function_insert_scripts(array('files' => 'common.js,index.js'), $_smarty_tpl);
        ?>

</head>
<body>
<?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/page_header.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

<div class="blank"></div>
<div class="block clearfix">
  <!--left start-->
  <div class="AreaL">
    <!--站内公告 start-->
    <div class="box">
     <div class="box_1">
      <h3><span><?php 
        echo $_smarty_tpl->tpl_vars['lang']->value['shop_notice'];
        ?>
</span></h3>
      <div class="boxCenterList RelaArticle">
        <?php 
        echo $_smarty_tpl->tpl_vars['shop_notice']->value;
        ?>

      </div>
     </div>
    </div>
    <div class="blank5"></div>
    <!--站内公告 end-->
  <!-- TemplateBeginEditable name="左边区域" -->
<!-- #BeginLibraryItem "/library/cart.lbi" -->

<?php 
        echo smarty_function_insert_scripts(array('files' => 'transport.js'), $_smarty_tpl);
        ?>

<div class="cart" id="ECS_CARTINFO">
 <?php 
        echo insert_cart_info(array(), $_smarty_tpl);
        ?>

</div>
<div class="blank5"></div>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/category_tree.lbi" -->

<div class="box">
 <div class="box_1">
  <div id="category_tree">
    <?php 
        $_smarty_tpl->tpl_vars['cat'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['cat']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['categories']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['cat']->key => $_smarty_tpl->tpl_vars['cat']->value) {
            $_smarty_tpl->tpl_vars['cat']->_loop = true;
            ?>
     <dl>
     <dt><a href="<?php 
            echo $_smarty_tpl->tpl_vars['cat']->value['url'];
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['cat']->value['name'], ENT_QUOTES, 'UTF-8', true);
            ?>
</a></dt>
     <?php 
            $_smarty_tpl->tpl_vars['child'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['child']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['cat']->value['cat_id'];
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['child']->key => $_smarty_tpl->tpl_vars['child']->value) {
                $_smarty_tpl->tpl_vars['child']->_loop = true;
                ?>
     <dd><a href="<?php 
                echo $_smarty_tpl->tpl_vars['child']->value['url'];
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['child']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
</a></dd>
       <?php 
                $_smarty_tpl->tpl_vars['childer'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['childer']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['child']->value['cat_id'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['childer']->key => $_smarty_tpl->tpl_vars['childer']->value) {
                    $_smarty_tpl->tpl_vars['childer']->_loop = true;
                    ?>
       <dd>&nbsp;&nbsp;<a href="<?php 
                    echo $_smarty_tpl->tpl_vars['childer']->value['url'];
                    ?>
"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['childer']->value['name'], ENT_QUOTES, 'UTF-8', true);
                    ?>
</a></dd>
       <?php 
                }
                ?>
     <?php 
            }
            ?>
       
       </dl>
    <?php 
        }
        ?>
 
  </div>
 </div>
</div>
<div class="blank5"></div>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/top10.lbi" -->

<div class="box">
 <div class="box_2">
  <div class="top10Tit"></div>
  <div class="top10List clearfix">
  <?php 
        $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['goods']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['top_goods']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        $_smarty_tpl->tpl_vars['smarty']->value['foreach']['top_goods']['iteration'] = 0;
        foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value) {
            $_smarty_tpl->tpl_vars['goods']->_loop = true;
            $_smarty_tpl->tpl_vars['smarty']->value['foreach']['top_goods']['iteration']++;
            ?>
  <ul class="clearfix">
	<img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
top_<?php 
            echo $_smarty_tpl->getVariable('smarty')->value['foreach']['top_goods']['iteration'];
            ?>
.gif" class="iteration" />
	<?php 
            if ($_smarty_tpl->getVariable('smarty')->value['foreach']['top_goods']['iteration'] < 4) {
                ?>
      <li class="topimg">
      <a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="samllimg" /></a>
      </li>
	<?php 
            }
            ?>
		
      <li <?php 
            if ($_smarty_tpl->getVariable('smarty')->value['foreach']['top_goods']['iteration'] < 4) {
                ?>
class="iteration1"<?php 
            }
            ?>
>
      <a href="<?php 
            echo $_smarty_tpl->tpl_vars['goods']->value['url'];
            ?>
" title="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['goods']->value['short_name'];
            ?>
</a><br />
      <?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['shop_price'];
            ?>
<font class="f1"><?php 
            echo $_smarty_tpl->tpl_vars['goods']->value['price'];
            ?>
</font><br />
      </li>
    </ul>
  <?php 
        }
        ?>
  </div>
 </div>
</div>
<div class="blank5"></div>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/promotion_info.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['promotion_info']->value) {
            ?>
<!-- 促销信息 -->
<div class="box">
 <div class="box_1">
  <h3><span><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['promotion_info'];
            ?>
</span></h3>
  <div class="boxCenterList RelaArticle">
    <?php 
            $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['item']->_loop = false;
            $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable();
            $_from = $_smarty_tpl->tpl_vars['promotion_info']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value) {
                $_smarty_tpl->tpl_vars['item']->_loop = true;
                $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['item']->key;
                ?>
    <?php 
                if ($_smarty_tpl->tpl_vars['item']->value['type'] == "snatch") {
                    ?>
    <a href="snatch.php" title="<?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value[$_smarty_tpl->tpl_vars['item']->value]['type'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['snatch_promotion'];
                    ?>
</a>
    <?php 
                } elseif ($_smarty_tpl->tpl_vars['item']->value['type'] == "group_buy") {
                    ?>
    <a href="group_buy.php" title="<?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value[$_smarty_tpl->tpl_vars['item']->value]['type'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['group_promotion'];
                    ?>
</a>
    <?php 
                } elseif ($_smarty_tpl->tpl_vars['item']->value['type'] == "auction") {
                    ?>
    <a href="auction.php" title="<?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value[$_smarty_tpl->tpl_vars['item']->value]['type'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['auction_promotion'];
                    ?>
</a>
    <?php 
                } elseif ($_smarty_tpl->tpl_vars['item']->value['type'] == "favourable") {
                    ?>
    <a href="activity.php" title="<?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value[$_smarty_tpl->tpl_vars['item']->value]['type'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['favourable_promotion'];
                    ?>
</a>
    <?php 
                }
                ?>
    <a href="<?php 
                echo $_smarty_tpl->tpl_vars['item']->value['url'];
                ?>
" title="<?php 
                echo $_smarty_tpl->tpl_vars['lang']->value[$_smarty_tpl->tpl_vars['item']->value]['type'];
                ?>
 <?php 
                echo $_smarty_tpl->tpl_vars['item']->value['act_name'];
                echo $_smarty_tpl->tpl_vars['item']->value['time'];
                ?>
" style="background:none; padding-left:0px;"><?php 
                echo $_smarty_tpl->tpl_vars['item']->value['act_name'];
                ?>
</a><br />
    <?php 
            }
            ?>
  </div>
 </div>
</div>
<div class="blank5"></div>
<?php 
        }
        ?>
 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/order_query.lbi" -->

<?php 
        if (empty($_smarty_tpl->tpl_vars['order_query']->value)) {
            echo '<script';
            ?>
>var invalid_order_sn = "<?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['invalid_order_sn'];
            ?>
"<?php 
            echo '</script';
            ?>
>
<div class="box">
 <div class="box_1">
  <h3><span><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['order_query'];
            ?>
</span></h3>
  <div class="boxCenterList">
    <form name="ecsOrderQuery">
    <input type="text" name="order_sn" class="inputBg" /><br />
    <div class="blank5"></div>
    <input type="button" value="<?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['query_order'];
            ?>
" class="bnt_blue_2" onclick="orderQuery()" />
    </form>
    <div id="ECS_ORDER_QUERY" style="margin-top:8px;">
      <?php 
        } else {
            ?>
      <?php 
            if ($_smarty_tpl->tpl_vars['order_query']->value['user_id']) {
                ?>
<b><?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['order_number'];
                ?>
:</b><a href="user.php?act=order_detail&order_id=<?php 
                echo $_smarty_tpl->tpl_vars['order_query']->value['order_id'];
                ?>
" class="f6"><?php 
                echo $_smarty_tpl->tpl_vars['order_query']->value['order_sn'];
                ?>
</a><br>
  <?php 
            } else {
                ?>
<b><?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['order_number'];
                ?>
:</b><?php 
                echo $_smarty_tpl->tpl_vars['order_query']->value['order_sn'];
                ?>
<br>
  <?php 
            }
            ?>
<b><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['order_status'];
            ?>
:</b><br><font class="f1"><?php 
            echo $_smarty_tpl->tpl_vars['order_query']->value['order_status'];
            ?>
</font><br>
  <?php 
            if ($_smarty_tpl->tpl_vars['order_query']->value['invoice_no']) {
                ?>
<b><?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['consignment'];
                ?>
:</b><?php 
                echo $_smarty_tpl->tpl_vars['order_query']->value['invoice_no'];
                ?>
<br>
  <?php 
            }
            ?>
      <?php 
            if ($_smarty_tpl->tpl_vars['order_query']->value['shipping_date']) {
                ?>
:<?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['shipping_date'];
                ?>
 <?php 
                echo $_smarty_tpl->tpl_vars['order_query']->value['shipping_date'];
                ?>
<br>
  <?php 
            }
            ?>
  <?php 
        }
        ?>
    </div>
  </div>
 </div>
</div>
<div class="blank5"></div>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/invoice_query.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['invoice_list']->value) {
            ?>
<style type="text/css">
.boxCenterList form{ display:inline; }
.boxCenterList form a{ color:#404040; text-decoration:underline; }
</style>
<div class="box">
 <div class="box_1">
  <h3><span><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['shipping_query'];
            ?>
</span></h3>
  <div class="boxCenterList">
    <!-- 发货单查询<?php 
            $_smarty_tpl->tpl_vars['invoice'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['invoice']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['invoice_list']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['invoice']->key => $_smarty_tpl->tpl_vars['invoice']->value) {
                $_smarty_tpl->tpl_vars['invoice']->_loop = true;
                ?>
   <?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['order_number'];
                ?>
 <?php 
                echo $_smarty_tpl->tpl_vars['invoice']->value['order_sn'];
                ?>
<br />
   <?php 
                echo $_smarty_tpl->tpl_vars['lang']->value['consignment'];
                ?>
 <?php 
                echo $_smarty_tpl->tpl_vars['invoice']->value['invoice_no'];
                ?>

   <div class="blank"></div>
   <!-- 结束发货单查询<?php 
            }
            ?>
  </div>
 </div>
</div>
<div class="blank5"></div>
<?php 
        }
        ?>
 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/vote_list.lbi" -->

<?php 
        echo insert_vote(array(), $_smarty_tpl);
        ?>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/email_list.lbi" -->

<div class="box">
 <div class="box_1">
  <h3><span><?php 
        echo $_smarty_tpl->tpl_vars['lang']->value['email_subscribe'];
        ?>
</span></h3>
  <div class="boxCenterList RelaArticle">
    <input type="text" id="user_email" class="inputBg" /><br />
    <div class="blank5"></div>
    <input type="button" class="bnt_blue" value="<?php 
        echo $_smarty_tpl->tpl_vars['lang']->value['email_list_ok'];
        ?>
" onclick="add_email_list();" />
    <input type="button" class="bnt_bonus"  value="<?php 
        echo $_smarty_tpl->tpl_vars['lang']->value['email_list_cancel'];
        ?>
" onclick="cancel_email_list();" />
  </div>
 </div>
</div>
<div class="blank5"></div>
<?php 
        echo '<script';
        ?>
 type="text/javascript">
var email = document.getElementById('user_email');
function add_email_list()
{
  if (check_email())
  {
    Ajax.call('user.php?act=email_list&job=add&email=' + email.value, '', rep_add_email_list, 'GET', 'TEXT');
  }
}
function rep_add_email_list(text)
{
  alert(text);
}
function cancel_email_list()
{
  if (check_email())
  {
    Ajax.call('user.php?act=email_list&job=del&email=' + email.value, '', rep_cancel_email_list, 'GET', 'TEXT');
  }
}
function rep_cancel_email_list(text)
{
  alert(text);
}
function check_email()
{
  if (Utils.isEmail(email.value))
  {
    return true;
  }
  else
  {
    alert('<?php 
        echo $_smarty_tpl->tpl_vars['lang']->value['email_invalid'];
        ?>
');
    return false;
  }
}
<?php 
        echo '</script';
        ?>
>

 <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->

  </div>
  <!--left end-->
  <!--right start-->
  <div class="AreaR">
   <!--焦点图和站内快讯 START-->
    <div class="box clearfix">
     <div class="box_1 clearfix">
       <div class="f_l" id="focus">
       <?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/index_ad.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

       </div>
       <!--news-->
       <div id="mallNews" class="f_r">
        <div class="NewsTit"></div>
        <div class="NewsList tc">
         <!-- TemplateBeginEditable name="站内快讯上广告位(宽:210px)" -->
<!-- TemplateEndEditable -->
        <?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/new_articles.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

        </div>
       </div>
       <!--news end-->
     </div>
    </div>
    <div class="blank5"></div>
   <!--焦点图和站内快讯 END-->
   <!--今日特价,品牌 start-->
    <div class="clearfix">
      <!--特价-->
      <?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/recommend_promotion.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

      <!--品牌-->
      <div class="box f_r brandsIe6">
       <div class="box_1 clearfix" id="brands">
        <?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/brands.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

       </div>
      </div>
    </div>
    <div class="blank5"></div>
   <!-- TemplateBeginEditable name="右边主区域" -->
<!-- #BeginLibraryItem "/library/recommend_best.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['best_goods']->value) {
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
<div class="box">
<div class="box_2 centerPadd">
  <div class="itemTit" id="itemBest">
      <?php 
                if ($_smarty_tpl->tpl_vars['cat_rec']->value[1]) {
                    ?>
      <h2><a href="javascript:void(0)" onclick="change_tab_style('itemBest', 'h2', this);get_cat_recommend(1, 0);"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['all_goods'];
                    ?>
</a></h2>
      <?php 
                    $_smarty_tpl->tpl_vars['rec_data'] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars['rec_data']->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['cat_rec']->value[1];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars['rec_data']->key => $_smarty_tpl->tpl_vars['rec_data']->value) {
                        $_smarty_tpl->tpl_vars['rec_data']->_loop = true;
                        ?>
      <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemBest', 'h2', this);get_cat_recommend(1, <?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_id'];
                        ?>
)"><?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_name'];
                        ?>
</a></h2>
      <?php 
                    }
                    ?>
      <?php 
                }
                ?>
  </div>
  <div id="show_best_area" class="clearfix goodsBox">
  <?php 
            }
            ?>
  <?php 
            $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['goods']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['best_goods']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value) {
                $_smarty_tpl->tpl_vars['goods']->_loop = true;
                ?>
  <div class="goodsItem">
         <span class="best"></span>
           <a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="goodsimg" /></a><br />
           <p><a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
" title="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
"><?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['short_style_name'];
                ?>
</a></p>
           <font class="f1">
           <?php 
                if ($_smarty_tpl->tpl_vars['goods']->value['promote_price'] != '') {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['promote_price'];
                    ?>

          <?php 
                } else {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['shop_price'];
                    ?>

          <?php 
                }
                ?>
           </font>
        </div>
  <?php 
            }
            ?>
  <div class="more"><a href="../search.php?intro=best"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
more.gif" /></a></div>
  <?php 
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
  </div>
</div>
</div>
<div class="blank5"></div>
  <?php 
            }
        }
        ?>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/recommend_new.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['new_goods']->value) {
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
<div class="box">
<div class="box_2 centerPadd">
  <div class="itemTit New" id="itemNew">
      <?php 
                if ($_smarty_tpl->tpl_vars['cat_rec']->value[2]) {
                    ?>
      <h2><a href="javascript:void(0)" onclick="change_tab_style('itemNew', 'h2', this);get_cat_recommend(2, 0);"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['all_goods'];
                    ?>
</a></h2>
      <?php 
                    $_smarty_tpl->tpl_vars['rec_data'] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars['rec_data']->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['cat_rec']->value[2];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars['rec_data']->key => $_smarty_tpl->tpl_vars['rec_data']->value) {
                        $_smarty_tpl->tpl_vars['rec_data']->_loop = true;
                        ?>
      <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemNew', 'h2', this);get_cat_recommend(2, <?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_id'];
                        ?>
)"><?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_name'];
                        ?>
</a></h2>
      <?php 
                    }
                    ?>
      <?php 
                }
                ?>
  </div>
  <div id="show_new_area" class="clearfix goodsBox">
  <?php 
            }
            ?>
  <?php 
            $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['goods']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['new_goods']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value) {
                $_smarty_tpl->tpl_vars['goods']->_loop = true;
                ?>
  <div class="goodsItem">
         <span class="news"></span>
           <a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="goodsimg" /></a><br />
           <p><a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
" title="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
"><?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['short_style_name'];
                ?>
</a></p>
           <font class="f1">
           <?php 
                if ($_smarty_tpl->tpl_vars['goods']->value['promote_price'] != '') {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['promote_price'];
                    ?>

          <?php 
                } else {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['shop_price'];
                    ?>

          <?php 
                }
                ?>
           </font>
        </div>
  <?php 
            }
            ?>
  <div class="more"><a href="../search.php?intro=new"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
more.gif" /></a></div>
  <?php 
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
  </div>
</div>
</div>
<div class="blank5"></div>
  <?php 
            }
        }
        ?>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/recommend_hot.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['hot_goods']->value) {
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
<div class="box">
<div class="box_2 centerPadd">
  <div class="itemTit Hot" id="itemHot">
      <?php 
                if ($_smarty_tpl->tpl_vars['cat_rec']->value[3]) {
                    ?>
      <h2><a href="javascript:void(0)" onclick="change_tab_style('itemHot', 'h2', this);get_cat_recommend(3, 0);"><?php 
                    echo $_smarty_tpl->tpl_vars['lang']->value['all_goods'];
                    ?>
</a></h2>
      <?php 
                    $_smarty_tpl->tpl_vars['rec_data'] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars['rec_data']->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['cat_rec']->value[3];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars['rec_data']->key => $_smarty_tpl->tpl_vars['rec_data']->value) {
                        $_smarty_tpl->tpl_vars['rec_data']->_loop = true;
                        ?>
      <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemHot', 'h2', this);get_cat_recommend(3, <?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_id'];
                        ?>
)"><?php 
                        echo $_smarty_tpl->tpl_vars['rec_data']->value['cat_name'];
                        ?>
</a></h2>
      <?php 
                    }
                    ?>
      <?php 
                }
                ?>
  </div>
  <div id="show_hot_area" class="clearfix goodsBox">
  <?php 
            }
            ?>
  <?php 
            $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['goods']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['hot_goods']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value) {
                $_smarty_tpl->tpl_vars['goods']->_loop = true;
                ?>
  <div class="goodsItem">
         <span class="hot"></span>
           <a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="goodsimg" /></a><br />
           <p><a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
" title="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['name'], ENT_QUOTES, 'UTF-8', true);
                ?>
"><?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['short_style_name'];
                ?>
</a></p>
           <font class="f1">
           <?php 
                if ($_smarty_tpl->tpl_vars['goods']->value['promote_price'] != '') {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['promote_price'];
                    ?>

          <?php 
                } else {
                    ?>
          <?php 
                    echo $_smarty_tpl->tpl_vars['goods']->value['shop_price'];
                    ?>

          <?php 
                }
                ?>
           </font>
        </div>
  <?php 
            }
            ?>
  <div class="more"><a href="../search.php?intro=hot"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
more.gif" /></a></div>
  <?php 
            if ($_smarty_tpl->tpl_vars['cat_rec_sign']->value != 1) {
                ?>
  </div>
</div>
</div>
<div class="blank5"></div>
  <?php 
            }
        }
        ?>

 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/auction.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['auction_list']->value) {
            ?>
<div class="box">
 <div class="box_1">
  <h3><span><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['auction_goods'];
            ?>
</span><a href="auction.php"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
more.gif"></a></h3>
    <div class="centerPadd">
    <div class="clearfix goodsBox" style="border:none;">
      <?php 
            $_smarty_tpl->tpl_vars['auction'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['auction']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['auction_list']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['auction']->key => $_smarty_tpl->tpl_vars['auction']->value) {
                $_smarty_tpl->tpl_vars['auction']->_loop = true;
                ?>
      <div class="goodsItem">
           <a href="<?php 
                echo $_smarty_tpl->tpl_vars['auction']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['auction']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['auction']->value['goods_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="goodsimg" /></a><br />
           <p><a href="<?php 
                echo $_smarty_tpl->tpl_vars['auction']->value['url'];
                ?>
" title="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['auction']->value['goods_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['auction']->value['short_style_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
</a></p>
           <font class="shop_s"><?php 
                echo $_smarty_tpl->tpl_vars['auction']->value['formated_start_price'];
                ?>
</font>
        </div>
      <?php 
            }
            ?>
    </div>
    </div>
 </div>
</div>
<div class="blank5"></div>
<?php 
        }
        ?>
 <!-- #EndLibraryItem -->
<!-- #BeginLibraryItem "/library/group_buy.lbi" -->

<?php 
        if ($_smarty_tpl->tpl_vars['group_buy_goods']->value) {
            ?>
<div class="box">
 <div class="box_1">
  <h3><span><?php 
            echo $_smarty_tpl->tpl_vars['lang']->value['group_buy_goods'];
            ?>
</span><a href="group_buy.php"><img src="<?php 
            echo $_smarty_tpl->tpl_vars['ecs_images_path']->value;
            ?>
more.gif"></a></h3>
    <div class="centerPadd">
    <div class="clearfix goodsBox" style="border:none;">
      <?php 
            $_smarty_tpl->tpl_vars['goods'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['goods']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['group_buy_goods']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['goods']->key => $_smarty_tpl->tpl_vars['goods']->value) {
                $_smarty_tpl->tpl_vars['goods']->_loop = true;
                ?>
      <div class="goodsItem">
           <a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['thumb'];
                ?>
" alt="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['goods_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
" class="goodsimg" /></a><br />
					 <p><a href="<?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['url'];
                ?>
" title="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['goods_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['goods']->value['short_style_name'], ENT_QUOTES, 'UTF-8', true);
                ?>
</a></p>
           <font class="shop_s"><?php 
                echo $_smarty_tpl->tpl_vars['goods']->value['last_price'];
                ?>
</font>
        </div>
      <?php 
            }
            ?>
    </div>
    </div>
 </div>
</div>
<div class="blank5"></div>
<?php 
        }
        ?>
 <!-- #EndLibraryItem -->
<!-- TemplateEndEditable -->
  </div>
  <!--right end-->
</div>
<div class="blank5"></div>
<!--帮助-->
<div class="block">
  <div class="box">
   <div class="helpTitBg clearfix">
    <?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/help.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

   </div>
  </div>
</div>
<div class="blank"></div>
<!--帮助-->
<!--友情链接 start-->
<?php 
        if ($_smarty_tpl->tpl_vars['img_links']->value || $_smarty_tpl->tpl_vars['txt_links']->value) {
            ?>
<div id="bottomNav" class="box">
 <div class="box_1">
  <div class="links clearfix">
    <!--开始图片类型的友情链接<?php 
            $_smarty_tpl->tpl_vars['link'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['link']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['img_links']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['link']->key => $_smarty_tpl->tpl_vars['link']->value) {
                $_smarty_tpl->tpl_vars['link']->_loop = true;
                ?>
    <a href="<?php 
                echo $_smarty_tpl->tpl_vars['link']->value['url'];
                ?>
" target="_blank" title="<?php 
                echo $_smarty_tpl->tpl_vars['link']->value['name'];
                ?>
"><img src="<?php 
                echo $_smarty_tpl->tpl_vars['link']->value['logo'];
                ?>
" alt="<?php 
                echo $_smarty_tpl->tpl_vars['link']->value['name'];
                ?>
" border="0" /></a>
    <!--结束图片类型的友情链接<?php 
            }
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['txt_links']->value) {
                ?>
    <!--开始文字类型的友情链接<?php 
                $_smarty_tpl->tpl_vars['link'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['link']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['txt_links']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['link']->key => $_smarty_tpl->tpl_vars['link']->value) {
                    $_smarty_tpl->tpl_vars['link']->_loop = true;
                    ?>
    [<a href="<?php 
                    echo $_smarty_tpl->tpl_vars['link']->value['url'];
                    ?>
" target="_blank" title="<?php 
                    echo $_smarty_tpl->tpl_vars['link']->value['name'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['link']->value['name'];
                    ?>
</a>]
    <!--结束文字类型的友情链接<?php 
                }
                ?>
    <?php 
            }
            ?>
  </div>
 </div>
</div>
<?php 
        }
        ?>
<!--友情链接 end-->
<div class="blank"></div>
<?php 
        echo $_smarty_tpl->getSubTemplate((string) $_smarty_tpl->tpl_vars['tplstyle']->value . "/library/page_footer.lbi", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
        ?>

</body>
</html>
<?php 
    }
 public function receive_gift()
 {
     //对goods处理
     $_POST['goods'] = strip_tags(urldecode($_POST['gift']));
     $_POST['goods'] = json_str_iconv($_POST['gift']);
     // 初始化返回数组
     $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '', 'product_spec' => '');
     if (empty($_POST['goods'])) {
         $result['error'] = 1;
         die(json_encode($result));
     }
     $json = new EcsJson();
     $gift = $json->decode($_POST['gift']);
     $result['sn'] = $gift->sn;
     $result['product_spec'] = $gift->spec;
     // 购买礼包商品清空购物车
     model('Order')->clear_cart(CART_RECEIVE_GIFTS);
     // 查询:系统启用了库存,检查输入的商品数量是否有效
     // 查询
     $Gift = $this->model->table('gift_sn')->field('goods_name,amount,sn_id,goods_id')->where("sn_id='" . $gift->sn . "'")->find();
     if ($gift->number > $Gift['amount']) {
         $result['error'] = 1;
         $result['message'] = sprintf(L('stock_insufficiency'), $Gift['goods_name'], $Gift['goods_number'], $Gift['goods_number']);
         if (C('use_how_oos') == 1) {
             $result['message'] = L('oos_tips');
         }
         die(json_encode($result));
     }
     // 检查:商品数量是否合法
     if (!is_numeric($gift->number) || intval($gift->number) <= 0) {
         $result['error'] = 1;
         $result['message'] = L('invalid_number');
     } else {
         // 更新:添加到购物车
         $_SESSION['flow_type'] = CART_RECEIVE_GIFTS;
         $_SESSION['extension_code'] = "receive_gift";
         $_SESSION['extension_id'] = CART_RECEIVE_GIFTS;
         if (model('Order')->addto_cart($Gift['goods_id'], $gift->number, $gift->spec, $gift->parent, CART_RECEIVE_GIFTS)) {
             if (C('cart_confirm') > 2) {
                 $result['message'] = '';
             } else {
                 $result['message'] = C('cart_confirm') == 1 ? L('addto_cart_success_1') : L('addto_cart_success_2');
             }
             $result['content'] = insert_cart_info();
             $result['one_step_buy'] = C('one_step_buy');
         } else {
             $result['message'] = ECTouch::err()->last_message();
             $result['error'] = ECTouch::err()->error_no;
             $result['goods_id'] = stripslashes($Gift['goods_id']);
             if (is_array($goods->spec)) {
                 $result['product_spec'] = implode(',', $gift->spec);
             } else {
                 $result['product_spec'] = $gift->spec;
             }
         }
     }
     $cart_confirm = C('cart_confirm');
     $result['confirm_type'] = !empty($cart_confirm) ? C('cart_confirm') : 2;
     // 返回购物车商品总数量
     $result['cart_number'] = insert_cart_info_number();
     die(json_encode($result));
 }
 public function add_to_cart_cf()
 {
     //对goods处理
     $_POST['goods'] = strip_tags(urldecode($_POST['goods']));
     $_POST['goods'] = json_str_iconv($_POST['goods']);
     if (!empty($_REQUEST['goods_id']) && empty($_POST['goods'])) {
         if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) {
             ecs_header("Location:./\n");
         }
         exit;
     }
     // 初始化返回数组
     $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '', 'product_spec' => '');
     if (empty($_POST['goods'])) {
         $result['error'] = 1;
         die(json_encode($result));
     }
     $json = new EcsJson();
     $goods = $json->decode($_POST['goods']);
     $result['goods_id'] = $goods->goods_id;
     $result['product_spec'] = $goods->spec;
     // 清空众筹购物车
     model('Order')->clear_cart(CART_CF_GOODS);
     //TODO 查询众筹库存
     /*
             $arrGoods = $this->model->table('goods')->field('goods_name,goods_number,extension_code')->where('goods_id =' . $goods->goods_id)->find();
             $goodsnmber = model('Users')->get_goods_number($goods->goods_id);
             $goodsnmber+=$goods->number;
     if ($arrGoods ['goods_number'] < $goodsnmber) {
                 $result['error'] = 1;
                 $result['message'] = sprintf(L('stock_insufficiency'), $arrGoods ['goods_name'], $arrGoods ['goods_number'], $arrGoods ['goods_number']);
                 if (C('use_how_oos') == 1){
                     $result['message'] =L('oos_tips');
                 }
                 die(json_encode($result));
             }
     */
     // 检查:商品数量是否合法
     if (!is_numeric($goods->number) || intval($goods->number) <= 0) {
         $result['error'] = 1;
         $result['message'] = L('invalid_number');
     } else {
         // 更新:添加到购物车
         $_SESSION['flow_type'] = CART_CF_GOODS;
         $_SESSION['extension_code'] = "Crowdfunding";
         $_SESSION['extension_id'] = CART_CF_GOODS;
         if (model('Order')->addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent, CART_CF_GOODS)) {
             if (C('cart_confirm') > 2) {
                 $result['message'] = '';
             } else {
                 $result['message'] = C('cart_confirm') == 1 ? L('addto_cart_success_1') : L('addto_cart_success_2');
             }
             $result['content'] = insert_cart_info();
             $result['one_step_buy'] = C('one_step_buy');
         } else {
             $result['message'] = ECTouch::err()->last_message();
             $result['error'] = ECTouch::err()->error_no;
             $result['goods_id'] = stripslashes($goods->goods_id);
             if (is_array($goods->spec)) {
                 $result['product_spec'] = implode(',', $goods->spec);
             } else {
                 $result['product_spec'] = $goods->spec;
             }
         }
     }
     $cart_confirm = C('cart_confirm');
     $result['confirm_type'] = !empty($cart_confirm) ? C('cart_confirm') : 2;
     // 返回购物车商品总数量
     $result['cart_number'] = insert_cart_info_number();
     die(json_encode($result));
 }