SEOHelper::updateProductMeta($_POST); } } /** 错误处理 */ if (isset($errors)) { UIAdminAlerts::MError($errors); } /** 导航 */ $breadcrumb = new UIAdminBreadcrumb(); $breadcrumb->home(); $breadcrumb->add(array('href' => 'index.php?rule=seo_meta', 'title' => 'Meta管理')); $breadcrumb->add(array('title' => '编辑', 'active' => true)); $bread = $breadcrumb->draw(); $btn_group = array(array('type' => 'a', 'title' => '分类Metat管理', 'href' => 'index.php?rule=seo_meta', 'class' => 'btn-primary', 'icon' => 'share'), array('type' => 'button', 'title' => '更新', 'id' => 'save-seo-meta-form', 'class' => 'btn-success', 'icon' => 'save')); echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb'); /** 构建表单 */ $form = new UIAdminEditForm('post', 'index.php?rule=seo_meta', 'form-horizontal', 'seo-meta-form'); $cate = array(); if (isset($_POST['categoryBox'])) { $cate = Tools::getRequest('categoryBox'); } $brands = Brand::loadData(); $brandKeyVal = array(); if ($brands) { foreach ($brands['items'] as $brand) { $brandKeyVal[$brand['id_brand']] = $brand['name']; } } $trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开', 'Check All' => '全选', 'Uncheck All' => '全不选'); $form->items = array('title' => array('title' => 'Title规则', 'type' => 'text', 'value' => Tools::Q('title'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'keywords' => array('title' => 'Keywords规则', 'type' => 'text', 'value' => Tools::Q('keywords'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'description' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('description'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'rewrite' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('rewrite'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'categoryBox' => array('title' => '应用到分类', 'type' => 'custom', 'value' => Helper::renderAdminCategorieTree($trads, $cate, 'categoryBox', false, 'Tree')), 'id_brands' => array('title' => '应用到品牌', 'type' => 'select', 'value' => Tools::Q('id_brands'), 'option' => $brandKeyVal, 'info' => '不选则应用到所有品牌'), 'SEOProductMetaUpdate' => array('type' => 'submit', 'class' => 'btn-success', 'icon' => 'save', 'title' => '生成')); echo UIViewBlock::area(array('title' => '编辑', 'body' => $form->draw()), 'panel');
echo isset($obj) && $obj->id_category_default == $cat['id_category'] ? 'selected="selected"' : ''; ?> ><?php echo $cat['name']; ?> </option> <?php } } ?> </select> <p class="text-muted" id="no_default_category">默认分类需要先选择关联分类.</p> </div> </div> <?php $brandData = Brand::loadData(); if ($brandData) { $brands = $brandData['items']; ?> <div class="form-group"> <label for="categoryBox" class="col-sm-2 control-label">品牌</label> <div class="col-sm-10"> <select name="id_brand" class="form-control" id="id_brand"> <option value="0">----</option> <?php foreach ($brands as $brand) { ?> <option value="<?php echo $brand['id_brand']; ?> " <?php
} } elseif (intval(Tools::getRequest('toggleStatus')) > 0) { $object = new Brand(intval(Tools::getRequest('toggleStatus'))); if (Validate::isLoadedObject($object)) { $object->toggleStatus(); } if (is_array($object->_errors) and count($object->_errors) > 0) { $errors = $object->_errors; } else { echo '<div class="conf">更新对象状态成功</div>'; } } $table = new UIAdminTable('brand', 'Brand', 'id_brand'); $table->header = array(array('sort' => false, 'isCheckAll' => 'brandBox[]'), array('name' => 'id_brand', 'title' => 'ID', 'filter' => 'string'), array('sort' => false, 'name' => 'image_small', 'isImage' => true, 'title' => '图片'), array('name' => 'name', 'title' => '名称', 'filter' => 'string'), array('name' => 'active', 'title' => '状态', 'filter' => 'bool'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'view', 'delete'))); $filter = $table->initFilter(); $orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_brand'; $orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'asc'; $limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50'; $p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1; $result = Brand::loadData($p, $limit, $orderBy, $orderWay, $filter); if (isset($errors)) { UIAdminAlerts::MError($errors); } $breadcrumb = new UIAdminBreadcrumb(); $breadcrumb->home(); $breadcrumb->add(array('title' => '购物车', 'active' => true)); $bread = $breadcrumb->draw(); $btn_groups = array(array('type' => 'a', 'title' => '新分类', 'href' => 'index.php?rule=category_edit', 'class' => 'btn-success', 'icon' => 'plus')); echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_groups), 'breadcrumb'); $btn_group = array(array('type' => 'button', 'title' => '批量删除', 'confirm' => '你确定要删除选中项?', 'name' => 'deleteItems', 'class' => 'btn-danger', 'icon' => 'remove'), array('type' => 'button', 'title' => '批量启用', 'name' => 'subActiveON', 'class' => 'btn-default'), array('type' => 'button', 'title' => '批量关闭', 'name' => 'subActiveOFF', 'class' => 'btn-default')); echo UIViewBlock::area(array('title' => '地址列表', 'table' => $table, 'result' => $result, 'limit' => $limit, 'btn_groups' => $btn_group), 'table');