|
@@ -52,6 +52,27 @@ class store_goods_addControl extends BaseSellerControl
|
|
Tpl::showpage('store_goods_add.step1');
|
|
Tpl::showpage('store_goods_add.step1');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function class_level($goods_class, $gc_id)
|
|
|
|
+ {
|
|
|
|
+ $result[] = $gc_id;
|
|
|
|
+ do {
|
|
|
|
+ $parent_id = $goods_class[$gc_id]['gc_parent_id'];
|
|
|
|
+ if ($parent_id > 0) {
|
|
|
|
+ $result[] = $parent_id;
|
|
|
|
+ $gc_id = $parent_id;
|
|
|
|
+ } else {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } while (true);
|
|
|
|
+
|
|
|
|
+ $result = array_reverse($result);
|
|
|
|
+ while (count($result) < 3) {
|
|
|
|
+ $result[] = 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 添加商品
|
|
* 添加商品
|
|
*/
|
|
*/
|
|
@@ -79,35 +100,14 @@ class store_goods_addControl extends BaseSellerControl
|
|
$model_bind_class = Model('store_bind_class');
|
|
$model_bind_class = Model('store_bind_class');
|
|
$goods_class = Model('goods_class')->getGoodsClassForCacheModel();
|
|
$goods_class = Model('goods_class')->getGoodsClassForCacheModel();
|
|
$where['store_id'] = $_SESSION['store_id'];
|
|
$where['store_id'] = $_SESSION['store_id'];
|
|
- $class_2 = $goods_class[$gc_id]['gc_parent_id'];
|
|
|
|
- $class_1 = $goods_class[$class_2]['gc_parent_id'];
|
|
|
|
- $where['class_1'] = $class_1;
|
|
|
|
- $where['class_2'] = $class_2;
|
|
|
|
- $where['class_3'] = $gc_id;
|
|
|
|
- $bind_info = $model_bind_class->getStoreBindClassInfo($where);
|
|
|
|
- if (empty($bind_info))
|
|
|
|
- {
|
|
|
|
- $where['class_3'] = 0;
|
|
|
|
- $bind_info = $model_bind_class->getStoreBindClassInfo($where);
|
|
|
|
- if (empty($bind_info))
|
|
|
|
- {
|
|
|
|
- $where['class_2'] = 0;
|
|
|
|
- $where['class_3'] = 0;
|
|
|
|
- $bind_info = $model_bind_class->getStoreBindClassInfo($where);
|
|
|
|
- if (empty($bind_info))
|
|
|
|
- {
|
|
|
|
- $where['class_1'] = 0;
|
|
|
|
- $where['class_2'] = 0;
|
|
|
|
- $where['class_3'] = 0;
|
|
|
|
- $bind_info = Model('store_bind_class')->getStoreBindClassInfo($where);
|
|
|
|
- if (empty($bind_info))
|
|
|
|
- {
|
|
|
|
- showDialog(L('store_goods_index_again_choose_category2'));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ [$class_1, $class_2, $gc_id] = $this->class_level($goods_class, $gc_id);
|
|
|
|
|
|
|
|
+ $where['class_1'] = $class_1;
|
|
|
|
+ $where['class_2'] = $class_2;
|
|
|
|
+ $where['class_3'] = $gc_id;
|
|
|
|
+ $bind_info = $model_bind_class->getStoreBindClassInfo($where);
|
|
|
|
+ if (empty($bind_info)) {
|
|
|
|
+ showDialog(L('store_goods_index_again_choose_category2'));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -118,7 +118,7 @@ class store_goods_addControl extends BaseSellerControl
|
|
|
|
|
|
// 获取类型相关数据
|
|
// 获取类型相关数据
|
|
$typeinfo = Model('type')->getAttr($goods_class['type_id'], $_SESSION['store_id'], $gc_id);
|
|
$typeinfo = Model('type')->getAttr($goods_class['type_id'], $_SESSION['store_id'], $gc_id);
|
|
- list($spec_json, $spec_list, $attr_list, $brand_list) = $typeinfo;
|
|
|
|
|
|
+ [$spec_json, $spec_list, $attr_list, $brand_list] = $typeinfo;
|
|
Tpl::output('sign_i', count($spec_list));
|
|
Tpl::output('sign_i', count($spec_list));
|
|
Tpl::output('spec_list', $spec_list);
|
|
Tpl::output('spec_list', $spec_list);
|
|
Tpl::output('attr_list', $attr_list);
|
|
Tpl::output('attr_list', $attr_list);
|
|
@@ -566,7 +566,7 @@ class store_goods_addControl extends BaseSellerControl
|
|
$img_path = $upload->getSysSetPath() . $upload->file_name;
|
|
$img_path = $upload->getSysSetPath() . $upload->file_name;
|
|
|
|
|
|
// 取得图像大小
|
|
// 取得图像大小
|
|
- list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . '/' . ATTACH_GOODS . '/' . $_SESSION['store_id'] . DS . $img_path);
|
|
|
|
|
|
+ [$width, $height, $type, $attr] = getimagesize(BASE_UPLOAD_PATH . '/' . ATTACH_GOODS . '/' . $_SESSION['store_id'] . DS . $img_path);
|
|
|
|
|
|
// 存入相册
|
|
// 存入相册
|
|
$image = explode('.', $_FILES[$_POST['name']]["name"]);
|
|
$image = explode('.', $_FILES[$_POST['name']]["name"]);
|