Cài đặt website
Lấy cài đặt website
API lấy toàn bộ cấu hình website/storefront của công ty hiện tại. Dùng khi khởi tạo giao diện frontend.
Endpoint
GET /site/settings/setting
Headers
| Key | Value | Bắt buộc | Mô tả |
|---|---|---|---|
SiteTenantId | {tenant_id} | Có | ID của công ty/tenant. |
Workflow & Logic
API này trả về toàn bộ cấu hình website của một tenant, được sử dụng khi khởi tạo giao diện storefront (web/app). Dữ liệu cài đặt bao gồm: giao diện chung, trang chủ, danh sách sản phẩm, chi tiết sản phẩm, giỏ hàng, thanh toán, cổng thanh toán, vận chuyển, khách hàng, và affiliate.
Quy trình xử lý
- Xác thực Tenant: Kiểm tra
SiteTenantIdvà xác địnhcompany_idtừ session (initSite). Không yêu cầu đăng nhập khách hàng. - Tải toàn bộ Setting: Gọi
Setting::getAllCompanySettings(company_id)để lấy tất cả bản ghi cài đặt của công ty. - Trích xuất & Định dạng: Duyệt qua danh sách setting, trích xuất giá trị (
valuehoặcvalueextratùy theo key) và ép kiểu dữ liệu phù hợp (string,int,float). - Trả kết quả: Trả về JSON object phẳng (flat) chứa tất cả các key-value cài đặt.
Query Parameters
API này không nhận query parameter nào. Toàn bộ cài đặt của tenant sẽ được trả về.
Response Schema
HTTP 200 - JSON Object
{
"company_id": 123,
"id": 123,
"website_domain": "https://myshop.example.com",
"website_logo_file": "logo.png",
"website_logo_file_darkmode": "logo-dark.png",
"website_favicon_file": "favicon.ico",
"website_on_maintain": 0,
"website_custom_css": "",
"website_custom_js": "",
"website_custom_html_head": "",
"website_custom_html_body": "",
"website_desktop_container_full": 0,
"website_mobile_page_footer_navigation": 1,
"website_using_page_id_index": 0,
"website_homepage_recently_viewed_layout": "slider",
"point_allow_redeem": 1,
"website_inventory_from_warehouse": 0,
"website_product_limit": 20,
"website_product_photo_ratio": "1:1",
"website_order_default_store": 0,
"website_product_list_layout": "grid",
"website_product_quick_view": 1,
"website_product_quick_view_style": "modal",
"website_product_quick_add_to_cart": 1,
"website_product_quick_add_to_cart_style": "icon",
"website_product_card_wishlist": 1,
"website_product_card_hover_effect": "zoom",
"website_product_card_col_desktop": 4,
"website_product_card_col_mobile": 2,
"website_allow_cart_buy_now": 1,
"website_product_detail_main_layout": "default",
"website_product_detail_main_ratio": "1:1",
"website_product_detail_gallery_layout": "slider",
"website_product_detail_thumbnail_position": "bottom",
"website_product_detail_thumbnail_count": 5,
"website_product_detail_description_position": "below",
"website_product_detail_attribute_position": "tab",
"website_product_detail_rating_summary_position": "below_price",
"website_product_detail_review_position": "tab",
"website_product_detail_wishlist_position": "beside_cart",
"website_product_detail_price_position": "default",
"website_product_detail_promotion_position": "below_price",
"website_product_detail_combo_column": "2",
"website_product_detail_combo_layout": "grid",
"website_product_detail_custom_css": "",
"website_product_detail_custom_js": "",
"website_product_suggestion_column_desktop": 4,
"website_product_suggestion_column_mobile": 2,
"website_product_suggestion_swiper_gap_desktop": 16,
"website_product_suggestion_swiper_gap_mobile": 8,
"website_product_suggestion_default_title": "Sản phẩm gợi ý",
"website_product_suggestion_type": "related",
"website_cart_layout": "default",
"website_cart_require_login": 0,
"website_checkout_require_login": 0,
"website_checkout_layout_ratio": "6:4",
"website_checkout_coupon_position": "sidebar",
"website_checkout_block_detail_position": "1",
"website_checkout_block_detail_layout": "compact",
"website_checkout_block_billing_info_position": "2",
"website_checkout_block_billing_info_mode": "form",
"website_checkout_block_shipping_info_position": "3",
"website_checkout_block_shipping_info_mode": "form",
"website_checkout_block_shipping_service_mode": "list",
"website_checkout_block_payment_position": "4",
"website_checkout_block_tax_position": "5",
"website_checkout_block_tax_mode": "auto",
"website_checkout_block_summary_position": "6",
"website_checkout_allow_pickup_at_store": 0,
"website_checkout_login_only": 0,
"website_payment_cod_enable": 1,
"website_payment_cod_amount_from": 0,
"website_payment_cod_amount_to": 0,
"website_payment_momo_enable": 0,
"website_payment_momo_amount_from": 0,
"website_payment_momo_amount_to": 0,
"website_payment_momo_endpoint_url": "",
"website_payment_momo_partner_code": "",
"website_payment_vnpay_enable": 0,
"website_payment_vnpay_amount_from": 0,
"website_payment_vnpay_amount_to": 0,
"website_payment_vnpay_endpoint_url": "",
"website_payment_vnpay_tmn_code": "",
"website_payment_vnpay_return_url": "",
"website_payment_vnpayqr_enable": 0,
"website_payment_vnpayqr_amount_from": 0,
"website_payment_vnpayqr_amount_to": 0,
"website_payment_vnpayqr_app_id": "",
"website_payment_vnpayqr_merchant_name": "",
"website_payment_vnpayqr_merchant_code": "",
"website_payment_vnpayqr_terminal_id": "",
"website_payment_vnpayqr_secret_key": "",
"website_payment_vnpayqr_master_mer_code": "",
"website_payment_vnpayqr_merchant_type": "",
"website_payment_vnpayqr_gen_qr_url": "",
"website_payment_vnpayqr_check_trans_url": "",
"website_payment_vnpayqr_secret_key_check_trans": "",
"website_payment_sepay_enable": 0,
"website_payment_sepay_amount_from": 0,
"website_payment_sepay_amount_to": 0,
"website_payment_sepay_account_bank": "",
"website_payment_sepay_name_bank": "",
"website_payment_sepay_qr_code_url": "",
"website_payment_zalopay_enable": 0,
"website_payment_zalopay_amount_from": 0,
"website_payment_zalopay_amount_to": 0,
"website_payment_banktransfer_enable": 0,
"website_payment_banktransfer_amount_from": 0,
"website_payment_banktransfer_amount_to": 0,
"website_payment_banktransfer_detail": "",
"website_price_policy_id": 0,
"website_filter_pricing_range": "",
"website_order_default_customer_id": 0,
"website_checkout_create_new_customer": 1,
"website_customer_attribute_category_id": 0,
"default_product_tax_ratio": 0.0,
"product_price_including_tax": 1,
"product_allow_multiple_avatar": 0,
"product_weighted_uom_id_of_gram": 0,
"product_weight_preset": "",
"shipping_using_new_region": 1,
"shipping_show_district_ward_legacy": 0,
"affiliate_store_front_enable": 0,
"affiliate_store_front_show_link": 0,
"affiliate_register_enable": 0,
"affiliate_register_auto_approve": 0,
"affiliate_register_auto_approve_code_list": "",
"affiliate_default_group_id": 0,
"affiliate_tracking_lifetime_day": 30,
"affiliate_commission_window_day": 30,
"affiliate_payout_min_amount": 0,
"affiliate_payout_lock_mday": 0
}Chi tiết các nhóm cài đặt
Cài đặt chung (General)
| Trường | Kiểu | Mô tả |
|---|---|---|
company_id | integer | ID công ty/tenant. |
id | integer | Alias của company_id. |
website_domain | string | Tên miền website storefront. |
website_logo_file | string | Đường dẫn file logo (sáng). |
website_logo_file_darkmode | string | Đường dẫn file logo (tối). |
website_favicon_file | string | Đường dẫn file favicon. |
website_on_maintain | integer | Chế độ bảo trì (1: Bật, 0: Tắt). |
website_custom_css | string | CSS tùy chỉnh thêm vào website. |
website_custom_js | string | JavaScript tùy chỉnh thêm vào website. |
website_custom_html_head | string | HTML tùy chỉnh chèn vào thẻ <head>. |
website_custom_html_body | string | HTML tùy chỉnh chèn vào thẻ <body>. |
website_desktop_container_full | integer | Bật/tắt container full-width trên desktop (1: Full, 0: Boxed). |
website_mobile_page_footer_navigation | integer | Hiển thị thanh điều hướng dưới cùng trên mobile (1: Có, 0: Không). |
Trang chủ (Homepage)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_using_page_id_index | integer | ID trang CMS dùng làm trang chủ (0: Mặc định hệ thống). |
website_homepage_recently_viewed_layout | string | Layout hiển thị sản phẩm đã xem gần đây trên trang chủ. |
point_allow_redeem | integer | Cho phép khách hàng sử dụng điểm tích lũy (1: Có, 0: Không). |
Danh sách sản phẩm (Product Listing)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_inventory_from_warehouse | integer | ID kho hàng dùng để hiển thị tồn kho (0: Tất cả kho). |
website_product_limit | integer | Số sản phẩm tối đa mỗi trang listing. |
website_product_photo_ratio | string | Tỷ lệ ảnh sản phẩm (VD: 1:1, 3:4). |
website_order_default_store | integer | ID chi nhánh/cửa hàng mặc định khi đặt hàng online. |
website_product_list_layout | string | Layout danh sách sản phẩm (VD: grid, list). |
website_product_quick_view | integer | Bật/tắt Quick View trên card sản phẩm (1: Bật, 0: Tắt). |
website_product_quick_view_style | string | Kiểu hiển thị Quick View (VD: modal, drawer). |
website_product_quick_add_to_cart | integer | Bật/tắt nút thêm nhanh vào giỏ hàng (1: Bật, 0: Tắt). |
website_product_quick_add_to_cart_style | string | Kiểu hiển thị nút thêm nhanh (VD: icon, button). |
website_product_card_wishlist | integer | Hiển thị nút yêu thích trên card (1: Có, 0: Không). |
website_product_card_hover_effect | string | Hiệu ứng hover trên card sản phẩm (VD: zoom, fade, none). |
website_product_card_col_desktop | integer | Số cột hiển thị sản phẩm trên desktop. |
website_product_card_col_mobile | integer | Số cột hiển thị sản phẩm trên mobile. |
website_allow_cart_buy_now | integer | Bật/tắt nút "Mua ngay" (1: Bật, 0: Tắt). |
Chi tiết sản phẩm (Product Detail)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_product_detail_main_layout | string | Layout chính trang chi tiết sản phẩm. |
website_product_detail_main_ratio | string | Tỷ lệ ảnh chính (VD: 1:1, 3:4). |
website_product_detail_gallery_layout | string | Layout gallery ảnh sản phẩm (VD: slider, grid). |
website_product_detail_thumbnail_position | string | Vị trí thumbnail (VD: bottom, left). |
website_product_detail_thumbnail_count | integer | Số lượng thumbnail hiển thị. |
website_product_detail_description_position | string | Vị trí block mô tả sản phẩm. |
website_product_detail_attribute_position | string | Vị trí block thuộc tính (VD: tab, below). |
website_product_detail_rating_summary_position | string | Vị trí tóm tắt đánh giá. |
website_product_detail_review_position | string | Vị trí block đánh giá chi tiết. |
website_product_detail_wishlist_position | string | Vị trí nút yêu thích. |
website_product_detail_price_position | string | Vị trí hiển thị giá. |
website_product_detail_promotion_position | string | Vị trí hiển thị khuyến mãi. |
website_product_detail_combo_column | string | Số cột hiển thị combo. |
website_product_detail_combo_layout | string | Layout hiển thị combo (VD: grid, list). |
website_product_detail_custom_css | string | CSS tùy chỉnh riêng cho trang chi tiết SP. |
website_product_detail_custom_js | string | JavaScript tùy chỉnh riêng cho trang chi tiết SP. |
website_product_suggestion_column_desktop | integer | Số cột gợi ý sản phẩm trên desktop. |
website_product_suggestion_column_mobile | integer | Số cột gợi ý sản phẩm trên mobile. |
website_product_suggestion_swiper_gap_desktop | integer | Khoảng cách giữa các card gợi ý trên desktop (px). |
website_product_suggestion_swiper_gap_mobile | integer | Khoảng cách giữa các card gợi ý trên mobile (px). |
website_product_suggestion_default_title | string | Tiêu đề mặc định cho block gợi ý SP. |
website_product_suggestion_type | string | Loại gợi ý sản phẩm (VD: related, upsell, crosssell). |
Giỏ hàng (Cart)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_cart_layout | string | Layout trang giỏ hàng. |
website_cart_require_login | integer | Yêu cầu đăng nhập để xem giỏ hàng (1: Có, 0: Không). |
Thanh toán (Checkout)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_checkout_require_login | integer | Yêu cầu đăng nhập để thanh toán (1: Có, 0: Không). |
website_checkout_layout_ratio | string | Tỷ lệ layout trang checkout (VD: 6:4, 7:3). |
website_checkout_coupon_position | string | Vị trí ô nhập mã giảm giá. |
website_checkout_block_detail_position | string | Vị trí block chi tiết đơn hàng. |
website_checkout_block_detail_layout | string | Layout block chi tiết. |
website_checkout_block_billing_info_position | string | Vị trí block thông tin thanh toán. |
website_checkout_block_billing_info_mode | string | Chế độ hiển thị thông tin thanh toán. |
website_checkout_block_shipping_info_position | string | Vị trí block thông tin giao hàng. |
website_checkout_block_shipping_info_mode | string | Chế độ hiển thị thông tin giao hàng. |
website_checkout_block_shipping_service_mode | string | Chế độ chọn dịch vụ vận chuyển. |
website_checkout_block_payment_position | string | Vị trí block phương thức thanh toán. |
website_checkout_block_tax_position | string | Vị trí block thuế. |
website_checkout_block_tax_mode | string | Chế độ hiển thị thuế. |
website_checkout_block_summary_position | string | Vị trí block tổng kết đơn hàng. |
website_checkout_allow_pickup_at_store | integer | Cho phép nhận hàng tại cửa hàng (1: Có, 0: Không). |
website_checkout_login_only | integer | Chỉ cho phép checkout khi đã đăng nhập (1: Có, 0: Không). |
Cổng thanh toán (Payment Gateways)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_payment_cod_enable | integer | Bật/tắt thanh toán COD. |
website_payment_cod_amount_from | integer | Giá trị đơn tối thiểu cho COD (0: Không giới hạn). |
website_payment_cod_amount_to | integer | Giá trị đơn tối đa cho COD (0: Không giới hạn). |
website_payment_momo_enable | integer | Bật/tắt thanh toán MoMo. |
website_payment_momo_amount_from | integer | Giá trị đơn tối thiểu cho MoMo. |
website_payment_momo_amount_to | integer | Giá trị đơn tối đa cho MoMo. |
website_payment_momo_endpoint_url | string | URL endpoint API MoMo. |
website_payment_momo_partner_code | string | Mã đối tác MoMo. |
website_payment_vnpay_enable | integer | Bật/tắt thanh toán VNPay. |
website_payment_vnpay_amount_from | integer | Giá trị đơn tối thiểu cho VNPay. |
website_payment_vnpay_amount_to | integer | Giá trị đơn tối đa cho VNPay. |
website_payment_vnpay_endpoint_url | string | URL endpoint API VNPay. |
website_payment_vnpay_tmn_code | string | Terminal code VNPay. |
website_payment_vnpay_return_url | string | URL callback sau khi thanh toán VNPay. |
website_payment_vnpayqr_enable | integer | Bật/tắt thanh toán VNPay QR. |
website_payment_vnpayqr_amount_from | integer | Giá trị đơn tối thiểu cho VNPay QR. |
website_payment_vnpayqr_amount_to | integer | Giá trị đơn tối đa cho VNPay QR. |
website_payment_vnpayqr_app_id | string | App ID VNPay QR. |
website_payment_vnpayqr_merchant_name | string | Tên merchant VNPay QR. |
website_payment_vnpayqr_merchant_code | string | Mã merchant VNPay QR. |
website_payment_vnpayqr_terminal_id | string | Terminal ID VNPay QR. |
website_payment_vnpayqr_secret_key | string | Secret key VNPay QR. |
website_payment_vnpayqr_master_mer_code | string | Master merchant code VNPay QR. |
website_payment_vnpayqr_merchant_type | string | Loại merchant VNPay QR. |
website_payment_vnpayqr_gen_qr_url | string | URL tạo mã QR VNPay. |
website_payment_vnpayqr_check_trans_url | string | URL kiểm tra trạng thái giao dịch VNPay QR. |
website_payment_vnpayqr_secret_key_check_trans | string | Secret key kiểm tra giao dịch VNPay QR. |
website_payment_sepay_enable | integer | Bật/tắt thanh toán SePay. |
website_payment_sepay_amount_from | integer | Giá trị đơn tối thiểu cho SePay. |
website_payment_sepay_amount_to | integer | Giá trị đơn tối đa cho SePay. |
website_payment_sepay_account_bank | string | Số tài khoản ngân hàng SePay. |
website_payment_sepay_name_bank | string | Tên ngân hàng SePay. |
website_payment_sepay_qr_code_url | string | URL mã QR thanh toán SePay. |
website_payment_zalopay_enable | integer | Bật/tắt thanh toán ZaloPay. |
website_payment_zalopay_amount_from | integer | Giá trị đơn tối thiểu cho ZaloPay. |
website_payment_zalopay_amount_to | integer | Giá trị đơn tối đa cho ZaloPay. |
website_payment_banktransfer_enable | integer | Bật/tắt thanh toán chuyển khoản ngân hàng. |
website_payment_banktransfer_amount_from | integer | Giá trị đơn tối thiểu cho chuyển khoản. |
website_payment_banktransfer_amount_to | integer | Giá trị đơn tối đa cho chuyển khoản. |
website_payment_banktransfer_detail | string | Thông tin chi tiết chuyển khoản (STK, tên, nội dung). |
website_price_policy_id | integer | ID chính sách giá áp dụng cho website (0: Giá mặc định). |
website_filter_pricing_range | string | Khoảng giá cho bộ lọc (VD: 0-100000.100000-500000). |
Khách hàng (Customer)
| Trường | Kiểu | Mô tả |
|---|---|---|
website_order_default_customer_id | integer | ID khách hàng mặc định cho đơn hàng online (0: Không có). |
website_checkout_create_new_customer | integer | Tự động tạo khách hàng mới khi checkout (1: Có, 0: Không). |
website_customer_attribute_category_id | integer | ID nhóm thuộc tính mở rộng áp dụng cho khách hàng website. |
Bán hàng & Thuế (Sale & Tax)
| Trường | Kiểu | Mô tả |
|---|---|---|
default_product_tax_ratio | float | Tỷ lệ thuế mặc định cho sản phẩm (VD: 0.1 = 10%). |
product_price_including_tax | integer | Giá sản phẩm đã bao gồm thuế (luôn là 1). |
Cân nặng & Đơn vị (Weight & UOM)
| Trường | Kiểu | Mô tả |
|---|---|---|
product_allow_multiple_avatar | integer | Hỗ trợ nhiều hình đại diện (1: Bật). Khi bật, hiệu ứng hover change_image dùng ảnh đại diện thứ 2 (thumbnails[1]). |
product_weighted_uom_id_of_gram | integer | ID đơn vị tính cân nặng (gram). |
product_weight_preset | string | Preset cân nặng mặc định. |
Vận chuyển (Shipping)
| Trường | Kiểu | Mô tả |
|---|---|---|
shipping_using_new_region | integer | Sử dụng hệ thống vùng miền mới (1: Có, 0: Không). |
shipping_show_district_ward_legacy | integer | Hiển thị quận/huyện/phường kiểu cũ (1: Có, 0: Không). |
Tiếp thị liên kết (Affiliate)
| Trường | Kiểu | Mô tả |
|---|---|---|
affiliate_store_front_enable | integer | Bật/tắt affiliate trên storefront (1: Bật, 0: Tắt). |
affiliate_store_front_show_link | integer | Hiển thị link affiliate trên storefront (1: Có, 0: Không). |
affiliate_register_enable | integer | Cho phép đăng ký affiliate (1: Có, 0: Không). |
affiliate_register_auto_approve | integer | Tự động duyệt đăng ký affiliate (1: Có, 0: Không). |
affiliate_register_auto_approve_code_list | string | Danh sách mã tự động duyệt (cách nhau dấu phẩy). |
affiliate_default_group_id | integer | ID nhóm affiliate mặc định. |
affiliate_tracking_lifetime_day | integer | Số ngày cookie tracking affiliate có hiệu lực. |
affiliate_commission_window_day | integer | Số ngày tính hoa hồng sau khi click. |
affiliate_payout_min_amount | integer | Số tiền tối thiểu để yêu cầu rút hoa hồng. |
affiliate_payout_lock_mday | integer | Ngày khóa thanh toán hoa hồng trong tháng. |