Se connecter | Créer un compte | nous contacter
  • english French
    • ClicShopping
    • ClicShopping
    Auteur :
    frameworkClicShopping\OM is a framework based on OsCommerce 2.4 (in part) utilizing new features in PHP v5.6 to improve the performance, security, and modularity of the codebase. Taking advantage of namespaces and autoloading, it is now even easier to add new features and extend existing features without the need to edit core source code files.
    The base framework is located in the includes/ClicShopping directory:
    Framework Namespace Location
    Core ClicShopping\OM includes/ClicShopping/OM
    Sites ClicShopping\Sites includes/ClicShopping/Sites
    Apps ClicShopping\Apps includes/ClicShopping/Apps

    The framework is built utilizing the PSR-4 standard for autoloading classes from matching namespaces and file paths. Classes are automatically loaded on demand and don't need to be included/required manually. The base namespace the autoloader watches for is ClicShopping\ and loads the class files located in the includes/ClicShopping/ directory.


    Class File Location
    ClicShopping\OM\OSCOM includes/ClicShopping/OM/OSCOM.php
    ClicShopping\OM\Db includes/ClicShopping/OM/Db.php
    ClicShopping\OM\Registry includes/ClicShopping/OM/Registry.php
    ClicShopping\Sites\Shop\Shop includes/ClicShopping/Sites/Shop/Shop.php
    ClicShopping\Apps\VENDOR\APP\APP includes/ClicShopping/Apps/VENDOR/APP/APP.php

    Classes in the framework must declare their namespace as the first PHP code in the file.

    namespace OSC\OM;
    class NewClass {

    The full namespace to the above example would be:


    and the location of the file would be:


    For another class to be able to load ClicShopping\OM\NewClass automatically, it needs to be declared with PHP's use keyword after the namespace of the class and before any other PHP code.


    namespace ClicShopping\OM;
    use ClicShopping\OM\NewClass;
    class AnotherNewClass {
    public function __construct() {
    $NewClass = new NewClass();

    The framework autoloader (ClicShopping\OM\OSCOM::autoload()) is registered as an autoloader in includes/application_top.php and is automatically initialized in all main PHP files that include the application_top.php file.
    Template files do not need to have a namespace set, but still need to reference framework classes that it uses:

    use ClicShopping\OM\HTML;
    echo HTML::outputProtected('Hello World!');

    More information about namespaces can be found at the PHP Namespace documentation page.

    Sites are registered in the framework to initialize and apply environment parameters specific to that site.
    The available sites in the core are:
    Site Controller
    Shop (default) ClicShopping\Sites\Shop\Shop
    Admin ClicShopping\Sites\ClicShoppingAdmin\Admin

    Sites are registered and retrieved as follows:

    use ClicShopping\OM\OSCOM;
    $site = OSCOM::getSite();

    Apps are self-contained packages that add new or extend existing features through modules and hooks. Apps reside in their own directory and do not need to edit core source code files.
    Apps are located in the following directory:
    Namespace Location
    ClicShopping\Apps\VENDOR\APP includes/ClicShopping/Apps/VENDOR/APP

    Apps also have a public directory for public accessible files such as stylesheets, javascript, and images, located at:


    More information is available in the Apps chapter.

    Note : This documentation has been rewrited and is issue of Oscommerce Documentation : Licence under BSD