This commit is contained in:
2026-03-07 10:26:20 +07:00
commit aa223ce3bb
1128 changed files with 118856 additions and 0 deletions

1
data/product/addon.php Normal file
View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

1
data/product/brand.php Normal file
View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

108
data/product/category.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
use Hura8\Components\Product\AdminController\AProductCategoryController;
$objAProductCategoryController = new AProductCategoryController();
$category_collection = $objAProductCategoryController->getAllParent();
return [
'category_list' => get_category_list(0, getRequest("id"), $level=1, $prefix="", $category_collection )
];
function get_category_list($parentId=0, $currentCat="",$level=1, $prefix="", $category_collection = array()){
$categoryTree = "";
$extra_space = "";
for($i = 1; $i < $level; $i++){
$extra_space .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
}
$stt = 0;
if(isset($category_collection[$parentId])) {
foreach($category_collection[$parentId] as $index => $cat_info){
$cat_id = $cat_info['id'];
$stt ++;
$imgUrl = (strlen($cat_info["thumbnail"]) > 2) ? " <img src=\"".$cat_info["thumbnail"]."\" style=\"max-width:30px; max-height:30px;\" />" : "";
if($cat_info["status"]) $status = "<a href=\"javascript:update_status(".$cat_id.",'off')\" class='btn btn-soft btn-xs btn-outline btn-square'><i data-lucide='eye-off' class='size-3'></i></a>";
else $status = "<a href=\"javascript:update_status(".$cat_id.",'on')\" class='btn btn-soft btn-xs btn-outline btn-square'><i data-lucide='eye' class='size-3'></i></a>";
$edit_link ="/admin/product/category-form?id=".$cat_id;
$hide_this = ($parentId > 0) ? "style='display: none;'" : '';
$show_category_name = $cat_info["title"];
if(!IS_DEFAULT_LANGUAGE && isset($cat_info["not_translated"]) && $cat_info["not_translated"]) {
$show_category_name = "<span style='color: red'>[Chưa dịch]</span> ".$cat_info["title"];
}
if($cat_info['is_parent']) {
$show_category_name = "<a href=\"javascript:;\" class='link-active' onclick=\"RowExpand.open_child('parent_".$cat_id."')\">".$show_category_name."</a>";
}
$categoryTree .= "
<tr id='row_".$cat_id."' class='parent_".$parentId." row' ". $hide_this ."
onmouseover=\"this.className='row-hover parent_".$parentId."'\" onmouseout=\"this.className='parent_".$parentId."'\">
<td>
<a class='link-active' name='cat_".$cat_id."'></a>
". $extra_space . $prefix . $stt.". ". $show_category_name . $imgUrl."
</td>
<td>
<a href='".$cat_info['request_path']."' class='link-active' title='Mở tại website' target='_blank'>Xem trang</a>
</td>
<td>".$cat_id."</td>
<td class='whitespace-nowrap'>413787</td>
<td><a class='link-active' href='/admin/product?category=".$cat_id."'>1292</a></td>
<td>
<input class='input' type=text id=order_".$cat_id." value='".$cat_info["ordering"]."' size=2 onchange=\"update_order(".$cat_id.",this.value)\" />
<span class='status-ordering-".$cat_id."'></span>
</td>
<td class='whitespace-nowrap'>
SP + Danh mục con
</td>
";
if(IS_DEFAULT_LANGUAGE) {
$categoryTree .= "
<td>
<a href='/admin/product/category-attribute?id=".$cat_id."&popup=1' class='pop-up'>Tổng</a> (".$cat_info['attribute_count'].")
</td>
<td>
<div class='list-btn flex items-center gap-3'>
<a href=\"".$edit_link."\" class='btn btn-soft btn-xs btn-square btn-outline btn-view'><i data-lucide='pencil' class='size-3'></i></a>
<a class='btn btn-soft btn-xs btn-square btn-outline btn-view' href='javascript:set_category_feature(.$cat_id.,'off')'><i data-lucide='crown' class='size-3'></i></a>
<span id=status-".$cat_id.">".$status."</span>
<span class='status-delete-".$cat_id."'><a href=\"javascript:deleteThis(".$cat_id.")\" class='btn btn-soft btn-xs btn-square btn-error btn-outline '><i data-lucide='trash-2' class='size-3'></i></a></span>
</div>
</td>
";
}else{
$categoryTree .= "
<td>
<a href=\"".$edit_link."\"><i data-lucide='pencil' class='size-3'></i></a>
</td>
";
}
$categoryTree .= "
</tr>
";
if($cat_info["is_parent"]) $categoryTree .= get_category_list($cat_id, $currentCat, $level + 1, $prefix . $stt.".", $category_collection);
}
}
return $categoryTree;
}

View File

@@ -0,0 +1,18 @@
<?php
use Hura8\Components\Product\AdminController\AProductCategoryController;
$objAProductCategoryController = new AProductCategoryController();
$id = (int) getRequest("id");
$item_info = ($id > 0) ? $objAProductCategoryController->getFullInfo($id) : null;
if(!$item_info) $item_info = $objAProductCategoryController->getEmptyInfo([]);
return [
'item_info' => $item_info,
'categoryDropBox' => $objAProductCategoryController->getDropBox( $item_info['parent_id'], 0, 1),
'update_status' => getRequest("us"),
];

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

174
data/product/form.php Normal file
View File

@@ -0,0 +1,174 @@
<?php
use Hura8\Components\Product\AdminController\AProductController;
$objAProductController = new AProductController();
$product_id = getRequestInt('id', 0);
$product_info = $objAProductController->getFullInfo($product_id);
$view_part = getRequest("part", "basic");
$view_part_file = str_replace("-", "_", $view_part);
$part_file = __DIR__."/form_components/". $view_part_file .".php";
if(@file_exists($part_file)) {
include $part_file;
}else{
die("File: /form_components/". $view_part_file .".php does not exist!");
}
return [
"product_info" => $product_info,
"product_menu" => _get_product_menu(),
"view_part" => $view_part,
];
// helpers
function _get_product_menu() {
$current_selected = getRequest('part', 'basic');
$product_menu = array(
array(
'id' => 'basic',
"name" => "Cơ bản",
),
array(
'id' => 'store',
"name" => "Cửa hàng",
),
array(
'id' => 'category',
"name" => "Danh mục",
),
array(
'id' => 'seo',
"name" => "SEO",
),
array(
'id' => 'description',
"name" => "Mô tả",
),
array(
'id' => 'spec-group',
"name" => "Thông số kỹ thuật",//"Thông số",
),
/*"spec" => array(
"name" => "Thông số kỹ thuật nhập text", //"Bộ lọc thuộc tính", //"Thông số",
"must_have_id" => true,
"change_language" => true,
),*/
/*"image-spec" => array(
"name" => "Ảnh thông số",
"must_have_id" => true,
"change_language" => true,
),*/
array(
'id' => 'instruction',
"name" => "Hướng dẫn sử dụng",
),
array(
'id' => 'image',
"name" => "Ảnh",
),
array(
'id' => 'variant',
"name" => "Cấu hình",
),
array(
'id' => 'accessory',
"name" => "Phụ kiện",
),
array(
'id' => 'addon',
"name" => "Dịch vụ/SP đi kèm",
),
array(
'id' => 'video',
"name" => "Youtube",
),
/* "video-list" => array(
"name" => "Thư viện Youtube",
"must_have_id" => true,
"change_language" => false,
),*/
/*"relate-article" => array(
"name" => "Nội dung liên quan",
"must_have_id" => true,
"change_language" => false,
),*/
/*"web-link" => array(
"name" => "So sánh giá",
"must_have_id" => true,
"change_language" => false,
),*/
array(
'id' => 'tag',
"name" => "Tags",
),
array(
'id' => 'relation',
"name" => "Nội dung liên quan",
),
array(
'id' => 'customer-group',
"name" => "Giá theo nhóm khách hàng",
),
array(
'id' => 'component',
"name" => "Thành phần",
),
array(
'id' => 'configurable',
"name" => "Tùy chọn thành phần",
),
array(
'id' => 'compatible',
"name" => "Sp tương thích",
),
array(
'id' => 'similar',
"name" => "Sp tương tự",
),
array(
'id' => 'combo-set',
"name" => "Combo Set",
),
);
return array_map(function ($item) use ($current_selected){
$copy = $item;
$copy['is_current'] = $item['id'] == $current_selected ? 1 : 0;
return $copy;
}, $product_menu);
}

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

228
data/product/home.php Normal file
View File

@@ -0,0 +1,228 @@
<?php
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,
],
"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,
],
]
]
];

View File

@@ -0,0 +1 @@
<?php

1
data/product/set.php Normal file
View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1 @@
<?php