|
@@ -66,7 +66,8 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
/**
|
|
|
* 编辑商品页面
|
|
|
*/
|
|
|
- public function edit_goodsOp() {
|
|
|
+ public function edit_goodsOp()
|
|
|
+ {
|
|
|
$common_id = $_GET['commonid'];
|
|
|
if ($common_id <= 0) {
|
|
|
showMessage(L('wrong_argument'), '', 'html', 'error');
|
|
@@ -77,7 +78,7 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
showMessage(L('wrong_argument'), '', 'html', 'error');
|
|
|
}
|
|
|
|
|
|
- $where = array('goods_commonid' => $common_id, 'store_id' => $_SESSION['store_id']);
|
|
|
+ $where = ['goods_commonid' => $common_id, 'store_id' => $_SESSION['store_id']];
|
|
|
$goodscommon_info['g_storage'] = $model_goods->getGoodsSum($where, 'goods_storage');
|
|
|
$goodscommon_info['spec_name'] = unserialize($goodscommon_info['spec_name']);
|
|
|
if ($goodscommon_info['mobile_body'] != '') {
|
|
@@ -95,6 +96,7 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
$model_type = Model('type');
|
|
|
// 获取类型相关数据
|
|
|
$typeinfo = $model_type->getAttr($goods_class['type_id'], $_SESSION['store_id'], $goodscommon_info['gc_id']);
|
|
|
+
|
|
|
list($spec_json, $spec_list, $attr_list, $brand_list) = $typeinfo;
|
|
|
Tpl::output('spec_json', $spec_json);
|
|
|
Tpl::output('sign_i', count($spec_list));
|
|
@@ -104,22 +106,21 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
|
|
|
// 取得商品规格的输入值
|
|
|
$goods_array = $model_goods->getGoodsList($where, 'goods_id,goods_marketprice,goods_price,goods_storage,goods_serial,goods_storage_alarm,goods_spec,oms_id,goods_lowest_price,exp_date');
|
|
|
- $sp_value = array();
|
|
|
+ $sp_value = [];
|
|
|
if (is_array($goods_array) && !empty($goods_array)) {
|
|
|
|
|
|
// 取得已选择了哪些商品的属性
|
|
|
- $attr_checked_l = $model_type->typeRelatedList ( 'goods_attr_index', array (
|
|
|
- 'goods_id' => intval ( $goods_array[0]['goods_id'] )
|
|
|
- ), 'attr_value_id' );
|
|
|
+ $attr_checked_l = $model_type->typeRelatedList ( 'goods_attr_index', [
|
|
|
+ 'goods_id' => intval ( $goods_array[0]['goods_id'] )], 'attr_value_id' );
|
|
|
if (is_array ( $attr_checked_l ) && ! empty ( $attr_checked_l )) {
|
|
|
- $attr_checked = array ();
|
|
|
+ $attr_checked = [];
|
|
|
foreach ( $attr_checked_l as $val ) {
|
|
|
$attr_checked [] = $val ['attr_value_id'];
|
|
|
}
|
|
|
}
|
|
|
Tpl::output ( 'attr_checked', $attr_checked );
|
|
|
|
|
|
- $spec_checked = array();
|
|
|
+ $spec_checked = [];
|
|
|
$mod = Model();
|
|
|
foreach ( $goods_array as $k => $v ) {
|
|
|
$a = unserialize($v['goods_spec']);
|
|
@@ -162,10 +163,10 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
Tpl::output ( 'sp_value', $sp_value );
|
|
|
|
|
|
// 实例化店铺商品分类模型
|
|
|
- $store_goods_class = Model('store_goods_class')->getClassTree(array('store_id' => $_SESSION ['store_id'], 'stc_state' => '1'));
|
|
|
+ $store_goods_class = Model('store_goods_class')->getClassTree(['store_id' => $_SESSION ['store_id'], 'stc_state' => '1']);
|
|
|
Tpl::output('store_goods_class', $store_goods_class);
|
|
|
//处理商品所属分类
|
|
|
- $store_goods_class_tmp = array();
|
|
|
+ $store_goods_class_tmp = [];
|
|
|
if (!empty($store_goods_class)){
|
|
|
foreach ($store_goods_class as $k=>$v) {
|
|
|
$store_goods_class_tmp[$v['stc_id']] = $v;
|
|
@@ -177,8 +178,8 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
}
|
|
|
}
|
|
|
$goodscommon_info['goods_stcids'] = trim($goodscommon_info['goods_stcids'], ',');
|
|
|
- $goods_stcids = empty($goodscommon_info['goods_stcids'])?array():explode(',', $goodscommon_info['goods_stcids']);
|
|
|
- $goods_stcids_tmp = $goods_stcids_new = array();
|
|
|
+ $goods_stcids = empty($goodscommon_info['goods_stcids'])? [] :explode(',', $goodscommon_info['goods_stcids']);
|
|
|
+ $goods_stcids_tmp = $goods_stcids_new = [];
|
|
|
if (!empty($goods_stcids)){
|
|
|
foreach ($goods_stcids as $k=>$v){
|
|
|
$stc_parent_id = $store_goods_class_tmp[$v]['stc_parent_id'];
|
|
@@ -186,7 +187,7 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
if ($stc_parent_id > 0){//如果为二级分类,则分组到父级分类下
|
|
|
$goods_stcids_tmp[$stc_parent_id][] = $v;
|
|
|
} elseif (empty($goods_stcids_tmp[$v])) {//如果为一级分类而且分组不存在,则建立一个空分组数组
|
|
|
- $goods_stcids_tmp[$v] = array();
|
|
|
+ $goods_stcids_tmp[$v] = [];
|
|
|
}
|
|
|
}
|
|
|
foreach ($goods_stcids_tmp as $k=>$v){
|
|
@@ -211,26 +212,24 @@ class store_goods_onlineControl extends BaseSellerControl {
|
|
|
Tpl::output ( 'editor_multimedia', $editor_multimedia );
|
|
|
|
|
|
// 小时分钟显示
|
|
|
- $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');
|
|
|
+ $hour_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');
|
|
|
+ $minute_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 = Model('store_plate')->getStorePlateList(['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);
|
|
|
|
|
|
// F码
|
|
|
if ($goodscommon_info['is_fcode'] == 1) {
|
|
|
- $fcode_array = Model('goods_fcode')->getGoodsFCodeList(array('goods_commonid' => $goodscommon_info['goods_commonid']));
|
|
|
+ $fcode_array = Model('goods_fcode')->getGoodsFCodeList(['goods_commonid' => $goodscommon_info['goods_commonid']]);
|
|
|
Tpl::output('fcode_array', $fcode_array);
|
|
|
}
|
|
|
- $menu_promotion = array(
|
|
|
- 'lock' => $goodscommon_info['goods_lock'] == 1 ? true : false,
|
|
|
- 'gift' => $model_goods->checkGoodsIfAllowGift($goodscommon_info),
|
|
|
- 'combo' => $model_goods->checkGoodsIfAllowCombo($goodscommon_info)
|
|
|
- );
|
|
|
+ $menu_promotion = [ 'lock' => $goodscommon_info['goods_lock'] == 1 ? true : false,
|
|
|
+ 'gift' => $model_goods->checkGoodsIfAllowGift($goodscommon_info),
|
|
|
+ 'combo' => $model_goods->checkGoodsIfAllowCombo($goodscommon_info)];
|
|
|
$this->profile_menu('edit_detail','edit_detail', $menu_promotion);
|
|
|
Tpl::output('edit_goods_sign', true);
|
|
|
Tpl::showpage('store_goods_add.step2');
|