Example #1
0
    /**
     * 添加商品
     */
    public function add_step_twoOp() {
        // 实例化商品分类模型
        $model_goodsclass = Model('goods_class');
        // 现暂时改为从匿名“自营店铺专属等级”中判断
        $editor_multimedia = false;
        if ($this->store_grade['sg_function'] == 'editor_multimedia') {
            $editor_multimedia = true;
        }
        Tpl::output('editor_multimedia', $editor_multimedia);

        $gc_id = intval($_GET['class_id']);

        // 验证商品分类是否存在且商品分类是否为最后一级
        $data = Model('goods_class')->getGoodsClassForCacheModel();
        if (!isset($data[$gc_id]) || isset($data[$gc_id]['child']) || isset($data[$gc_id]['childchild'])) {
            showDialog(L('store_goods_index_again_choose_category1'));
        }

        // 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
        if (!checkPlatformStoreBindingAllGoodsClass()) {
            $where['class_1|class_2|class_3'] = $gc_id;
            $where['store_id'] = $_SESSION['store_id'];
            $rs = Model('store_bind_class')->getStoreBindClassInfo($where);
            if (empty($rs)) {
                showMessage(L('store_goods_index_again_choose_category2'));
            }
        }

        // 更新常用分类信息
        $goods_class = $model_goodsclass->getGoodsClassLineForTag($gc_id);
        Tpl::output('goods_class', $goods_class);
        Model('goods_class_staple')->autoIncrementStaple($goods_class, $_SESSION['member_id']);

        // 获取类型相关数据
        $typeinfo = Model('type')->getAttr($goods_class['type_id'], $_SESSION['store_id'], $gc_id);
        list($spec_json, $spec_list, $attr_list, $brand_list) = $typeinfo;
        Tpl::output('sign_i', count($spec_list));
        Tpl::output('spec_list', $spec_list);
        Tpl::output('attr_list', $attr_list);
        Tpl::output('brand_list', $brand_list);

        // 实例化店铺商品分类模型
        $store_goods_class = Model('store_goods_class')->getClassTree(array('store_id' => $_SESSION ['store_id'], 'stc_state' => '1'));
        Tpl::output('store_goods_class', $store_goods_class);

        // 小时分钟显示
        $hour_array = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
        Tpl::output('hour_array', $hour_array);
        $minute_array = array('05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55');
        Tpl::output('minute_array', $minute_array);

        // 关联版式
        $plate_list = Model('store_plate')->getStorePlateList(array('store_id' => $_SESSION['store_id']), 'plate_id,plate_name,plate_position');
        $plate_list = array_under_reset($plate_list, 'plate_position', 2);
        Tpl::output('plate_list', $plate_list);

        Tpl::showpage('store_goods_add.step2');
    }
Example #2
0
 /**
  * 取得店铺绑定的分类
  *
  * @param   number  $store_id   店铺id
  * @param   number  $pid        父级分类id
  * @param   number  $deep       深度
  * @return  array   二维数组
  */
 public function getGoodsClass($store_id, $pid = 0, $deep = 1)
 {
     // 读取商品分类 by 33 hao .com 批量添加分类修改
     $gc_list_o = $gc_list = $this->getGoodsClassListByParentId($pid);
     // 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
     if (!checkPlatformStoreBindingAllGoodsClass()) {
         $gc_list = array_under_reset($gc_list, 'gc_id');
         $model_storebindclass = Model('store_bind_class');
         $gcid_array = $model_storebindclass->getStoreBindClassList(array('store_id' => $store_id, 'state' => array('in', array(1, 2))), '', "class_{$deep} asc", "distinct class_{$deep}");
         if (!empty($gcid_array)) {
             $tmp_gc_list = array();
             foreach ($gcid_array as $value) {
                 if ($value["class_{$deep}"] == 0) {
                     return $gc_list_o;
                 }
                 if (isset($gc_list[$value["class_{$deep}"]])) {
                     $tmp_gc_list[] = $gc_list[$value["class_{$deep}"]];
                 }
             }
             $gc_list = $tmp_gc_list;
         } else {
             return array();
         }
     }
     return $gc_list;
 }
defined('InShopNC') or exit('Access Invalid!');
?>

<div class="tabmenu">
  <?php 
include template('layout/submenu');
if ($notOwnShop = !checkPlatformStore()) {
    ?>
  <a href="javascript:void(0)" class="ncsc-btn ncsc-btn-green" nc_type="dialog" dialog_title="申请新的经营类目" dialog_id="my_goods_brand_apply" dialog_width="480" uri="index.php?act=store_info&op=bind_class_add">申请新的经营类目</a>
<?php 
}
?>
  </div>

<?php 
if (checkPlatformStoreBindingAllGoodsClass()) {
    ?>
<table class="ncsc-default-table">
  <tbody>
    <tr>
      <td colspan="20" class="norecord"><div class="warning-option"><span>店铺已绑定全部商品类目</span></div></td>
    </tr>
  </tbody>
</table>

<?php 
} else {
    ?>

<table class="ncsc-default-table">
  <thead>