Back to Top

Directory Structure of creating Add-on in CS-Cart (Part 1)

Updated 20 December 2022

In this blog, we will learn about the cs-cart add-on.

Here is the link to the Cs-cart Guide.

wherefore, If you want to create your CS-Cart add-ons, at that time make sure to use this blog. It will be helpful for you.

Cs-Cart Folder Structure –

Here, we are going to describe the CS-Cart Add-on folder structure and how to reside the code under this folder structure.

Start your headless eCommerce
now.
Find out More

Inside the Cs-Cart setup there 4 main folders for addon creation. These are app, design, var, and JS.

In app folder:-

we put the addon controllers, additional function file, and addon.xml file.

In design folder:-

we put the files for the backend view. It contains a frontend file for the view, while creating the addon structure we put frontend view files in the var folder as the theme repository.

In var folder:-

we put the ‘.po’ file for language and addon view files for the frontend in the theme repository.

In JS folder:-

we put JS files related to the addon if the addon needs that.

There is 3 type of folder structure:-
1. App folder structure
2. Design Folder structure
3. Var folder structure

If you need to add JS, there is a folder in the root directory with the js name. you can add your addon folder here. Create the js files in it.

Example

vishal_1
JS Folder

App folder structure

app

– addons

– addonId(means folder name and folder name should be the same as addon ID)

-controllers

-init.php

-func.php

-schemas

-addon.xml

Let’s take the example of the Buy together addon.

vishal_2-1
Addon main folder structure

You have to create a folder with the name addon_id inside ‘app/addons’. The addon_id of the addon should be unique. In the case of Buy Together, addon_id is buy_together.

vishal_4
Addon inside the folder structure

Inside the addon folder, there is a controller folder in which we put controllers separated by the backend, frontend, and common folder.

We put the controller to use in the backend in the backend folder, a frontend controller in the frontend folder, and a controller that is used at both ends in the common folder.

Schemas:-

Schemas folder is used for menu, block manager, permission, product variations, and more.

And three main files are addon.xml which is used for addon details and structure, func.php file for additional functions for the addon, and init.php file for initializing some needed functionality for an addon like hook registry for the addon.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home