Example #1
0
        echo '<div class="conf">删除分类成功</div>';
    }
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::getRequest('productBox');
    $product = new Product();
    if (is_array($select_cat)) {
        if ($product->deleteSelection($select_cat)) {
            echo '<div class="conf">删除分类成功</div>';
        }
    }
} elseif (Tools::isSubmit('subActiveON') or Tools::isSubmit('subActiveOFF')) {
    $select_cat = Tools::getRequest('productBox');
    $action = Tools::isSubmit('subActiveON') ? 1 : 0;
    $object = new Product();
    if (is_array($select_cat)) {
        if ($object->statusSelection($select_cat, $action)) {
            echo '<div class="conf">更新分类状态成功</div>';
        }
    }
}
$table = new UIAdminTable('product', 'Product', 'id_product');
$table->header = array(array('sort' => false, 'isCheckAll' => 'productBox[]'), array('name' => 'id_product', 'title' => 'ID', 'width' => '80px', 'filter' => 'string'), array('sort' => false, 'name' => 'image_small', 'isImage' => true, 'title' => '图片'), array('name' => 'name', 'title' => '名称', 'filter' => 'string'), array('name' => 'quantity', 'title' => '库存'), array('name' => 'price', 'title' => '现价', 'width' => '80px', 'filter' => 'string'), array('name' => 'old_price', 'title' => '原价', 'width' => '80px', 'filter' => 'string'), array('name' => 'active', 'title' => '状态', 'filter' => 'bool'), array('name' => 'in_stock', 'title' => '购买', 'filter' => 'bool'), array('name' => 'is_new', 'title' => '新品', 'filter' => 'bool'), array('name' => 'is_sale', 'title' => '热销', 'filter' => 'bool'), array('name' => 'is_top', 'title' => '推荐', 'filter' => 'bool'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'view', 'delete')));
$filter = $table->initFilter();
$filter['id_category'] = isset($_GET['id_category']) ? intval($_GET['id_category']) : 1;
if (isset($_GET['id_brand'])) {
    $filter['id_brand'] = intval($_GET['id_brand']);
}
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'id_product';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'desc';
$limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50';
$p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1;