$link[0]['href'] = 'category.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'category.php?act=list'; sys_msg($_LANG['catadd_succed'], 0, $link); } } /*------------------------------------------------------ */ //-- 编辑商品分类信息 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit') { admin_priv('cat_manage'); // 权限检查 $cat_id = intval($_REQUEST['cat_id']); $cat_info = get_cat_info($cat_id); // 查询分类信息数据 $attr_list = get_attr_list(); $filter_attr_list = array(); if ($cat_info['filter_attr']) { $filter_attr = explode(",", $cat_info['filter_attr']); //把多个筛选属性放到数组中 foreach ($filter_attr as $k => $v) { $attr_cat_id = $db->getOne("SELECT cat_id FROM " . $ecs->table('attribute') . " WHERE attr_id = '" . intval($v) . "'"); $filter_attr_list[$k]['goods_type_list'] = goods_type_list($attr_cat_id); //取得每个属性的商品类型 $filter_attr_list[$k]['filter_attr'] = $v; $attr_option = array(); foreach ($attr_list[$attr_cat_id] as $val) { $attr_option[key($val)] = current($val); } $filter_attr_list[$k]['option'] = $attr_option; }
/** * 根据属性数组创建属性的表单 * * @access public * @param int $cat_id 分类编号 * @param int $goods_id 商品编号 * @return string */ function build_attr_html($cat_id, $goods_id = 0, $bar_code = 0) { $attr = get_attr_list($cat_id, $goods_id); $html = '<table width="100%" id="attrTable">'; $spec = 0; foreach ($attr as $key => $val) { $html .= "<tr><td class='label'>"; if ($val['attr_type'] == 1 || $val['attr_type'] == 2) { $html .= $spec != $val['attr_id'] ? "<a href='javascript:;' onclick='addSpec(this)'>[+]</a>" : "<a href='javascript:;' onclick='removeSpec(this)'>[-]</a>"; $spec = $val['attr_id']; } $html .= "{$val['attr_name']}</td><td><input type='hidden' name='attr_id_list[]' value='{$val['attr_id']}' txm='{$val['attr_txm']}' class='ctxm_{$val['attr_txm']}' />"; if ($val['attr_input_type'] == 0) { $html .= '<input name="attr_value_list[]" type="text" value="' . htmlspecialchars($val['attr_value']) . '" size="40" /> '; } elseif ($val['attr_input_type'] == 2) { $html .= '<textarea name="attr_value_list[]" rows="3" cols="40">' . htmlspecialchars($val['attr_value']) . '</textarea>'; } else { /* * * * *条形码点击事件开始 */ if ($val[attr_txm] > 0) { $html .= '<select class=attr_num_' . $val[attr_id] . ' name="attr_value_list[]" onchange="getType(' . $val[attr_txm] . ',' . $cat_id . ',' . $this . value . ',' . $goods_id . ')">'; } else { $html .= '<select class=attr_num_' . $val[attr_id] . ' name="attr_value_list[]" >'; } /*条形码点击事件结束*/ $html .= '<option value="">' . $GLOBALS['_LANG']['select_please'] . '</option>'; $attr_values = explode("\n", $val['attr_values']); foreach ($attr_values as $opt) { $opt = trim(htmlspecialchars($opt)); $html .= $val['attr_value'] != $opt ? '<option value="' . $opt . '">' . $opt . '</option>' : '<option value="' . $opt . '" selected="selected">' . $opt . '</option>'; } $html .= '</select> '; } $html .= $val['attr_type'] == 1 || $val['attr_type'] == 2 ? $GLOBALS['_LANG']['spec_price'] . ' <input type="text" name="attr_price_list[]" value="' . $val['attr_price'] . '" size="5" maxlength="10" />' : ' <input type="hidden" name="attr_price_list[]" value="0" />'; $html .= '</td></tr>'; } /* * *702460594 * *条形码的显示开始 * */ if ($bar_code) { $html .= '<table id="input" width="100%" ><tbody>'; foreach ($bar_code as $value) { $html .= '<tr><td class="label">条形码</td><td><input type="hidden" name="txm_shu[]" value=' . $value['taypes'] . '>' . $value['taypes'] . '<td/><td><input type="text" name="tiaoxingm[]" value=' . $value['bar_code'] . '></td></tr>'; } $html .= '</table >'; } $html .= '<table id="input" width="100%" ></table >'; /*条形码显示结束*/ $html .= '</table>'; return $html; }
/** * 根据属性数组创建属性的表单 * * @access public * @param int $cat_id 分类编号 * @param int $goods_id 商品编号 * @return string */ function build_attr_html($cat_id, $goods_id = 0) { $attr = get_attr_list($cat_id, $goods_id); $html = '<table width="100%" id="attrTable">'; $spec = 0; foreach ($attr as $key => $val) { $html .= "<tr><td class='label'>"; if ($val['attr_type'] == 1 || $val['attr_type'] == 2) { $html .= $spec != $val['attr_id'] ? "<a href='javascript:;' onclick='addSpec(this)'>[+]</a>" : "<a href='javascript:;' onclick='removeSpec(this)'>[-]</a>"; $spec = $val['attr_id']; } $html .= "{$val['attr_name']}</td><td><input type='hidden' name='attr_id_list[]' value='{$val['attr_id']}' />"; if ($val['attr_input_type'] == 0) { $html .= '<input name="attr_value_list[]" type="text" value="' . htmlspecialchars($val['attr_value']) . '" size="40" /> '; } elseif ($val['attr_input_type'] == 2) { $html .= '<textarea name="attr_value_list[]" rows="3" cols="40">' . htmlspecialchars($val['attr_value']) . '</textarea>'; } else { $html .= '<select name="attr_value_list[]">'; $html .= '<option value="">' . $GLOBALS['_LANG']['select_please'] . '</option>'; $attr_values = explode("\n", $val['attr_values']); foreach ($attr_values as $opt) { $opt = trim(htmlspecialchars($opt)); $html .= $val['attr_value'] != $opt ? '<option value="' . $opt . '">' . $opt . '</option>' : '<option value="' . $opt . '" selected="selected">' . $opt . '</option>'; } $html .= '</select> '; } $html .= $val['attr_type'] == 1 || $val['attr_type'] == 2 ? $GLOBALS['_LANG']['spec_price'] . ' <input type="text" name="attr_price_list[]" value="' . $val['attr_price'] . '" size="5" maxlength="10" />' : ' <input type="hidden" name="attr_price_list[]" value="0" />'; $html .= '</td></tr>'; } $html .= '</table>'; return $html; }
/** * 根据属性数组创建属性的表单 * * @access public * @param int $cat_id 分类编号 * @param int $goods_id 商品编号 * @return string */ function build_attr_html($cat_id, $goods_id = 0) { $attr = get_attr_list($cat_id, $goods_id); $html = '<table width="100%" id="attrTable">'; $spec = 0; foreach ($attr as $key => $val) { $html .= "<tr><td class='label'>"; if ($val['attr_type'] == 1 || $val['attr_type'] == 2) { $html .= $spec != $val['attr_id'] ? "<a href='javascript:;' onclick='addSpec(this)'>[+]</a>" : "<a href='javascript:;' onclick='removeSpec(this)'>[-]</a>"; $spec = $val['attr_id']; } /*模板堂修改 start by zhouH*/ $html .= "{$val['attr_name']}</td><td><input type='hidden' name='attr_id_list[]' value='{$val['attr_id']}' /><input type='hidden' name='attr_img_id[]' value='" . $val['img_id'] . "' />"; /*模板堂修改 end by zhouH*/ if ($val['attr_input_type'] == 0) { $html .= '<input name="attr_value_list[]" type="text" value="' . htmlspecialchars($val['attr_value']) . '" size="40" /> '; } elseif ($val['attr_input_type'] == 2) { $html .= '<textarea name="attr_value_list[]" rows="3" cols="40">' . htmlspecialchars($val['attr_value']) . '</textarea>'; } else { $html .= '<select name="attr_value_list[]">'; $html .= '<option value="">' . $GLOBALS['_LANG']['select_please'] . '</option>'; $attr_values = explode("\n", $val['attr_values']); foreach ($attr_values as $opt) { $opt = trim(htmlspecialchars($opt)); $html .= $val['attr_value'] != $opt ? '<option value="' . $opt . '">' . $opt . '</option>' : '<option value="' . $opt . '" selected="selected">' . $opt . '</option>'; } $html .= '</select> '; } /*模板堂修改 start by zhouH*/ $sql = 'SELECT is_show_img FROM ' . $GLOBALS['ecs']->table('attribute') . ' WHERE attr_id = ' . $val['attr_id']; $is_show_img = $GLOBALS['db']->getOne($sql); if ($is_show_img == 1) { $html .= $val['attr_type'] == 1 || $val['attr_type'] == 2 ? $GLOBALS['_LANG']['spec_price'] . ' <input type="text" name="attr_price_list[]" value="' . $val['attr_price'] . '" size="5" maxlength="10" /> <input type="button" value="选择属性图片" class="button"onclick="show_goods_gallery(' . $goods_id . ',this);">' : ' <input type="hidden" name="attr_price_list[]" value="0" />'; } else { $html .= $val['attr_type'] == 1 || $val['attr_type'] == 2 ? $GLOBALS['_LANG']['spec_price'] . ' <input type="text" name="attr_price_list[]" value="' . $val['attr_price'] . '" size="5" maxlength="10" />' : ' <input type="hidden" name="attr_price_list[]" value="0" />'; } /*模板堂修改 end by zhouH*/ $html .= '</td></tr>'; } $html .= '</table>'; return $html; }