How to create a new template
1. Automated generation by command line
2. Manual creation
1. Automatic
Use S-Cart's built-in command line to create new templates
After successful creation, you will get 2 new folders containing template files:php artisan sc:make template --name=your-new-template
andapp/public/templates/your-new-template
Access to Admin/Extensions/Template,you will see this template in the "Saved local" Tabresources/views/templates/your-new-template
2. Manual
Step 1: Create a new template folder
Copy and rename the folders public/templates/s-cart-light and resources/templates/s-cart-light to the name of the new template.
Note:
These 2 folder names must be the same

Step 2: Configure the new template information
- Change the file content resources/templates/new-template/config.json
Note:
Value of configKey must match the folder name of the new template

Step 3: Set up installation information
Since S-Cart 6.6, we support setting the information when entering the system when the template is installed or removed.
The functions are defined in the file "Provider.php"

This function installs information for the whole system. This function is only called the first time the template is installed.
function sc_template_install_default() {}
This function contains the settings information for each store using the template. It is called when:
+ The main store installs the template for the first time in the system. The parameters are set for the main store.
+ When a new store is created, the parameters of the selected template will be set for this store.
+ When the store changes the new template, the parameters of this template will be set for the store
-> Therefore, the default data for the whole system, only setting 1 should not be placed here. Let's put them in sc_template_install_default()
This function removes the default informationfunction sc_template_install_store($storeId = null) {}
This function removes the installation information for the storefunction sc_template_uninstall_default() {}
This function is called when the template is installedfunction sc_template_uninstall_store($storeId = null) {}
This function is called when the template is removed from the systemfunction sc_template_install($data = []) {
$storeId = $data['store_id'] ?? null;
sc_template_install_default();
sc_template_install_store($storeId);
}
function sc_template_uninstall($data = []) {
$storeId = $data['store_id'] ?? null;
sc_template_uninstall_default();
sc_template_uninstall_store($storeId);
}
Step 4: Check the information
Access to admin/Extension/Template/Template manager to check new template information

Step 5: Activate the new template
Access to admin/Shop setting/Store infomation ->Template, choose the template you want to use

Related topics
Latest Document
- Upgrade guide 2024-03-24
- Customize search page 2023-08-02
- Discount code (coupon) 2023-05-14
- Upgrade guide 2023-11-23
- Data relations in S-Cart 2023-02-05