'图片', 'price' => '价格', 'quantity' => '数量', 'sn' => '编码', ]; /** * 构造函数 */ public function __construct(...$params) { parent::__construct(...$params); $this->fieldtype = ['DECIMAL' => '10,2']; // TRUE表全部可用字段类型,自定义格式为 array('可用字段类型名称' => '默认长度', ... ) $this->defaulttype = 'DECIMAL'; // 当用户没有选择字段类型时的缺省值 } /** * 字段相关属性参数 * * @param array $value 值 * @return string */ public function option($option, $field = null) { $myfield = $this->showfield; !$option['field'] && $option['field'] = []; !$option['payfile'] && $option['payfile'] = 'buy.html'; foreach ($field as $t) { $t['fieldtype'] == 'Paystext' && $myfield[$t['fieldname']] = $t['name']; } $param_html = ''; foreach ($myfield as $id => $t) { $param_html.= '
'; $param_html.= ' '; $param_html.= '
'; } $tpl_group = $this->_get_tpl_group('data[setting][option][sku]'); $tpl_value = $this->_get_tpl_value('data[setting][option][sku]'); $value = $option; // 显示字段 $result = ''; if (isset($value['sku']['group']) && $value['sku']['group']) { foreach ($value['sku']['group'] as $id => $name) { $html = ''; if (isset($value['sku']['name'][$id]) && $value['sku']['name'][$id]) { foreach ($value['sku']['name'][$id] as $iid => $vname) { $html.= str_replace( ['{id}', '{name}', '{iid}'], [$id, $vname, $iid], $tpl_value ); } } $result.= str_replace( ['{id}', '{name}', '{value}'], [$id, $name, $html], $tpl_group ); } } $opt = '