Loading...

Adapt Add-on from 2.x to 3

We no longer maintain the Knowledge Base since version 4.3.x. All the latest user and developer documentation for 4.3.x and newer versions is now available at docs.cs-cart.com.

  • This article applies to CS-Cart versions:
  • 3.0.x

The following core mechanisms have been fully re-implemented in the new version:

  • Add-on scheme. Update add-on scheme to version 2.0. Use detailed descriptions for both the old and the new add-on schemes to move the data.
    Generally an add-on should be operational even with the old scheme, but only partially. Errors will occur with section title translations in settings dialog, edition-specific queries, dependencies and conflicts.
    Warning: Settings of all types require an id attribute, otherwise they will not be imported to database.
  • Hooks. There are numerous modifications in hooks, which have to be taken in account, too. Use the hook base to expore the full hook list in all CS-Cart versions and editions and compare hooks between any CS-Cart versions.
  • Skin Directory. The basic customer area skin directory has been changed in CS-Cart 3. Basically, what happened is the old folder has been simply renamed and all the respective changes have been added to the core.
    The new skin directory in CS-Cart 3 is now skins/basic/customer; instead of skins/base/customer as it was before.
    All the templates have to be moved to the new directory. Otherwise these templates will not be visible to the system at all.
    Normally template path should not be explicitly mentioned anywhere in non-core files — all the template names are defined relatively, without absolute paths. Still, if there are any such occurances, they must be handled, and the path must be modified manually.
  • Block manager. Adapt the add-on for the new block manager scheme.
    Use the detailed block scheme description in the Block manager section
  • Class auto-load. The new version introduces a class auto-load mechanism.
    Classes are loaded automatically when requested by name. It is no longer needed to connect them explicitly with require or include instructions. It is sufficient just to name class in a certain way and place it in a certain folder.
    All classes must reside in an add-on folder in the core/classes subdirectory.
    Class naming convention is as follows:
    • Slashes are substituted with underscores (foo/bar -> foo_bar)
    • CamelCase with the first capital letter is used (FooBar)

    Examples:
    • File: /addons/my_changes/core/classes/my_class.php
      Class name: class MyClass { }
    • File: /addons/my_changes/core/classes/some_package/my_class.php
      Class name: class SomePackage_MyClass { }
  • Ultimate Edition. It is necessary to plan how settings should behave. A setting can be available for the root admin only or also for every storefront and have different values for each one.
    In the first case edition_type must be specified as "ULT:ROOT", in the second as "ULT:ROOT, ULT:VENDOR".
    A setting cannot be available for a vendor only. Root admin has permission to change any setting in the system.
  • Home / Docs / Add-ons / Adapt Add-on from 2.x to 3