How to create a new template



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

Create new template

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


Create 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 contains the settings information for each store using the template

function sc_template_install_store($storeId = null) {}

This function installs information for the whole system

function sc_template_install_default() {}

This function removes the default information

function sc_template_uninstall_default() {}

This function removes the installation information for the store

function sc_template_uninstall_store($storeId = null) {}

This function is called when the template is installed

function sc_template_install($data = []) {
    $storeId = $data['store_id'] ?? null;
    sc_template_install_default();
    sc_template_install_store($storeId);
}

This function is called when the template is removed from the system

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


Create new template

Step 5: Activate the new template

Access to admin/Shop setting/Store infomation ->Template, choose the template you want to use

Create new template
 

Related topics

Latest Document