<?php if (Tools::G('id_feature') > 0) { $id_feature = Tools::G('id_feature'); } if (Tools::P('saveFeatureValue') == 'add' && Tools::P('id_feature') > 0) { $featureV = new FeatureValue(); $featureV->copyFromPost(); $featureV->add(); if (is_array($featureV->_errors) and count($featureV->_errors) > 0) { $errors = $featureV->_errors; } else { $_GET['id'] = $featureV->id; UIAdminAlerts::conf('商品特征值已添加'); } $id_feature = Tools::P('id_feature'); } if (isset($_GET['id'])) { $id = (int) $_GET['id']; $obj = new FeatureValue($id); $id_feature = $obj->id_feature; } if (Tools::P('saveFeatureValue') == 'edit') { if (Validate::isLoadedObject($obj)) { $obj->copyFromPost(); $obj->update(); } if (is_array($obj->_errors) and count($obj->_errors) > 0) { $errors = $obj->_errors; } else { UIAdminAlerts::conf('商品特征值已更新');