whats difference between root "addons" folder and skin folder's customer/addons, admin/addons

Can anyone please explain, whats difference between root “addons” folder and skin folder's customer/addons, admin/addons ?

in which folder's “my_changes” module, i should put my customization ?

'root' refers to the 'highest' possible folder in the directory tree.



For *nix systems this is typically referred to as '/'

For windows systems this is typically referred to as 'C:'



Essentially CS-Cart's parent directory is declared as 'root' as it's the parent folder of all files underneath it.

cPanel example: /home/cscart/public_html/



The following folder is the 'root' addon folder which manages php files that refer to hooks, calls, etc.

========================

/public_html/addons/my_changes

========================



The my_changes directory under the skin folder is where the php files are called FROM to display customizations.

========================

/public_html/skins/basic/customer/addons/my_changes/

========================



You'll need to place your files in a particular structure depending on the intent. eg. product modifications typically go under /public_html/skins/basic/customer/addons/my_changes/product/



Regards,

J.

so, all .tpl file related(view related) changes should be in skins/basic/customer/addons/my_changes/ and all “controllers nd Core” related changes should be in addons/my_changes ?

what if i only need to change a controller or set a hook only for one store ?

i am using cs-cart ultimate edition and i have multiple store configured in my site.

In Ultimate (currently) you can't define an addon to only be available in one store (unless you deal with it inside the addon itself). This is planned to change in 3.1, whenever that comes into being.



Right now, there are 4 Editions and two sections where settings for an addon can be applied. The 4 Editions are ULT, PRO, MVE and COM (could be wrong on COM). The two areas for settings are ROOT and VENDOR (VENDOR is a poor choice of name, should be STORE). So specifying an 'edition-type' in the addon.xml file of ULT:VENDOR would mean that you can't edit the setting(s) in the 'all stores' mode but you can at the store level. If it were ULT:ROOT then you could edit it at the “all stores” level, but not the store level.



In the future, an addon developer will be able to disable an addon for certain storefronts/admins and not others. But until then, it's all or nothing.

thanks for your reply, but what i am trying to say is,

so, all .tpl file related(view related) changes should be in skins/basic/customer/addons/my_changes/ and all “controllers nd Core” related changes should be in addons/my_changes ?

I still confused :confused: , what’s difference between this two “addons” folders ?

This is how I understand it works.



Cs-cart stores all the addons in the root addons directory. When you install a skin (or new store) it makes a copy of the addons in your new skin (or store) directory. You should only be modifying the ones in your skin (or store) directory. It is this local (copied) directory being used by your store.



Basically the root addons are a gold set of addons that re used to copy to new skin (or store) as you install them.



With that said, you can modify a root (gold) addon to ensure that new addon version is used (copied) on all new skins (or stores) you install in the future.



Hope that helps,



David

so, if i want to make change that should be applicable to only one store, i should change it in skin's customer/addons and if i want to make change that is applicable to all stores i should change in root “addon” folder , any kind of hooks or controller changes ?

Note if you make a change in the root addon folder it will not show on your site unless you reinstall your skin or store. Or you can manually move the files yourself.

Briefly…



PHP files live in addons/ directory. Inside of that are files that contain functions for operation of the addon AND 'controllers'. Every page in cs-cart is assoiciated with a controller of some type. If you want to 'hook" into existing controllers such as products or categories (like to extend a search or add data to be available in a skin) then you would use a 'pre' or 'post' controller for that specific controller. I.e. addons//controllers/customer/products.post.php. Each controller has a mode such as 'manage' or 'view' or 'update' so you sort out what mode you want to act on inside your pre/post controller. There are also PHP hooks available for specific functions in the core files that utilize the fn_set_hook() function.



When a new skin is installed (V2) from the skin selector, it copies the templates for the addon from var/skins_repository//addons/ where '' is customer, admin and mail. These are copied to skins///addons/ directory. When you uninstall an addon, it's skins directory instance is permanently deleted.



If you add a new skin (V2) after an addon is installed, then new template files (from the skins_repository) are also copied into the newly added skin. If the skin was previously installed (before the addon was) then you probably have to re-install the addon in the new skin or move the files from the skins_repository manually.



V3 works pretty much the same other than there is only one skin (basic) and if using ultimate, the skin files will be in a separate directory for each store. I.e. skins///…



'my_changes' is simply an empty addon (as distributed). It is like a place holder for someone to add small changes into their site without having to build an addon. If you are doing a real custom skin, I would suggest that you do it as an addon. If you are adding new functionality, then also add it as a new addon. But if you just want to tweak some behavior, use my_changes.



A whole seminar could be done on “how to utilize hooks and best practices in cs-cart for portability”. I've written tutorials in the developer's section which is really the better place for this topic. You might want to search for posts I've written that have the key word 'hooks' in them. You will find a plethora of information there.