Customize controller
Since S-Cart version 6.9, you can optionally change the content of conntroller files to your liking.Front-end: "vendor/s-cart/core/src/Front/Controller"
Back-end: "vendor/s-cart/core/src/Admin/Controller"
Specifically:
Step 1:
Create controller files corresponding to the files in the vendor:
Attention:For example:
- "S-cart-folder/vendor/s-cart/core/src/Front/Controllers/FileNameFront.php" -> "S-cart-folder/app/Http/Controllers/FileNameFront.php"
- "S-cart-folder/vendor/s-cart/core/src/Admin/Controllers/FileNameAdmin.php" -> "S-cart-folder/app/Admin/Controllers/FileNameAdmin.php"
- The location of the controller file must be exactly like the example above
- The file name must be the same as the core file
- Must change the correct namespace, for example
You have 2 options to create a new file (*):- File core: "SCart\Core\Admin\Controllers" -> File new: "App\Admin\Controllers"
- File core: "SCart\Core\Front\Controllers" -> File new: "App\Http\Controllers"
(*) We recommend you to use method 2 (extend from old file). This will help you inherit the latest updates from s-cart/core.- Method 1: Copy the new file content like the core file, just change the namespace (You must copy the full content from the core file)
- Method 2: The new file is extended from the core. Just rewrite the necessary functions to your liking.
Step 2:
Customize it
Instructional videos:
Related topics
- Backup & Restore
- S-Cart command line
- Create custom functions
- Configure data validation
- Customize your router
- Functions helper of S-Cart
- How to customize home page
- Customize admin dashboard page
- Customize helper functions
- Disable ecommerce router
- Convert S-Cart into a news website
- Customize data fields in S-Cart
- Data relations in S-Cart
- Customize search page
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