2024-01-18 23:13:02 +07:00
|
|
|
<?php
|
2024-01-29 10:39:53 +07:00
|
|
|
|
|
|
|
|
use Hura8\Components\Product\AdminController\AProductController;
|
|
|
|
|
use Hura8\System\Paging;
|
|
|
|
|
|
|
|
|
|
$objAProductController = new AProductController();
|
|
|
|
|
|
|
|
|
|
//Paging setting
|
|
|
|
|
$numPerPage = getPageSize(15);
|
|
|
|
|
$conditions = [
|
|
|
|
|
"category" => explode("-", getRequest("category", '')),
|
|
|
|
|
"brand" => explode("-", getRequest("brand", '')),
|
|
|
|
|
"hotType" => explode("-", getRequest("hotType", '')),
|
|
|
|
|
"other_filter" => [getRequest("other_filter", '')],
|
|
|
|
|
"q" => getRequest("q", ''),
|
|
|
|
|
'numPerPage' => $numPerPage,
|
|
|
|
|
'page' => getPageId(),
|
|
|
|
|
'translated' => getRequestInt('translated', 0),
|
|
|
|
|
//... more extended filters
|
|
|
|
|
];
|
|
|
|
|
//debug_var($objAProductController->getFilterConditions());
|
|
|
|
|
|
|
|
|
|
$totalResults = $objAProductController->getTotal($conditions);
|
|
|
|
|
$item_list = $objAProductController->getList($conditions);
|
|
|
|
|
|
|
|
|
|
list($page_collection, $tb_page, $total_pages) = Paging::paging_template($totalResults, $numPerPage);
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
"total" => $totalResults,
|
|
|
|
|
"item_list" => $item_list,
|
|
|
|
|
"pagination" => [
|
|
|
|
|
'collection' => $page_collection,
|
|
|
|
|
'html' => $tb_page,
|
|
|
|
|
'total_pages' => $total_pages,
|
|
|
|
|
],
|
2024-01-30 15:53:37 +07:00
|
|
|
|
|
|
|
|
"list_category" => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 1,
|
|
|
|
|
'title' => 'Màn hình máy tính',
|
|
|
|
|
'url' => '/admin/product?category=9',
|
|
|
|
|
'parentId' => 0,
|
|
|
|
|
'isParent' => 1,
|
|
|
|
|
'children' => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 10,
|
|
|
|
|
'title' => 'Màn hình theo khoảng giá',
|
|
|
|
|
'url' => '/admin/product?category=148',
|
|
|
|
|
'parentId' => 1,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 0,
|
|
|
|
|
'children' => [
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 11,
|
|
|
|
|
'title' => 'Màn Hình Theo Kích Thước',
|
|
|
|
|
'url' => '/admin/product?category=54',
|
|
|
|
|
'parentId' => 1,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 0,
|
|
|
|
|
'children' => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 148,
|
|
|
|
|
'title' => '17 inch - 21.5 inch',
|
|
|
|
|
'url' => '/admin/product?category=148',
|
|
|
|
|
'parentId' => 11,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 5,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 66,
|
|
|
|
|
'title' => '22 inch - 24 inch',
|
|
|
|
|
'url' => '/admin/product?category=66',
|
|
|
|
|
'parentId' => 11,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 41,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 67,
|
|
|
|
|
'title' => '25 inch - 27 inch',
|
|
|
|
|
'url' => '/admin/product?category=67',
|
|
|
|
|
'parentId' => 11,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 42,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 68,
|
|
|
|
|
'title' => '28 inch - 32 inch',
|
|
|
|
|
'url' => '/admin/product?category=68',
|
|
|
|
|
'parentId' => 11,
|
|
|
|
|
'isParent' => 0,
|
|
|
|
|
'totalProduct' => 11,
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 65,
|
|
|
|
|
'title' => 'PC, Workstation',
|
|
|
|
|
'url' => '/admin/product?category=65',
|
|
|
|
|
'parentId' => 0,
|
|
|
|
|
'isParent' => 1,
|
|
|
|
|
'children' => []
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'title' => 'Gaming Gear',
|
|
|
|
|
'url' => '/admin/product?category=3',
|
|
|
|
|
'parentId' => 0,
|
|
|
|
|
'isParent' => 1,
|
|
|
|
|
'children' => []
|
|
|
|
|
],[
|
|
|
|
|
'id' => 4,
|
|
|
|
|
'title' => 'CPU - Bộ Vi Xử Lý',
|
|
|
|
|
'url' => '/admin/product?category=4',
|
|
|
|
|
'parentId' => 0,
|
|
|
|
|
'isParent' => 1,
|
|
|
|
|
'children' => []
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
"brand_letters" => [
|
|
|
|
|
[
|
|
|
|
|
'key' => 'A',
|
|
|
|
|
'url' => '/ajax/brand.php?action=show-brand-list&letter=A&popup=1',
|
|
|
|
|
'total' => 13,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'key' => 'B',
|
|
|
|
|
'url' => '/ajax/brand.php?action=show-brand-list&letter=B&popup=1',
|
|
|
|
|
'total' => 2,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'key' => 'C',
|
|
|
|
|
'url' => '/ajax/brand.php?action=show-brand-list&letter=C&popup=1',
|
|
|
|
|
'total' => 5,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
"list_brands" => [
|
|
|
|
|
|
|
|
|
|
'A' => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 1,
|
|
|
|
|
'name' => 'ABS',
|
|
|
|
|
'letter' => 'A',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 1,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 2,
|
|
|
|
|
'name' => 'ACE GAMING',
|
|
|
|
|
'letter' => 'A',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'ADATA',
|
|
|
|
|
'letter' => 'A',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 15,
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
'B' => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'BE QUIET ',
|
|
|
|
|
'letter' => 'B',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 2,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'BENQ',
|
|
|
|
|
'letter' => 'B',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
'C' => [
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'CISCO',
|
|
|
|
|
'letter' => 'C',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 2,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'Colorful',
|
|
|
|
|
'letter' => 'C',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'COOLER MASTER',
|
|
|
|
|
'letter' => 'C',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'COOLMOON',
|
|
|
|
|
'letter' => 'C',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'id' => 3,
|
|
|
|
|
'name' => 'CORSAIR',
|
|
|
|
|
'letter' => 'C',
|
|
|
|
|
'url' => '/admin/?brand=83&opt=product',
|
|
|
|
|
'product' => 6,
|
|
|
|
|
],
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
];
|