Jump to content

Search the Community

Showing results for tags 'documentation'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Annoucement
    • Latest news for community
  • ClicShoppingV3
    • Documentation
    • Installation & Configuration & Operation
    • Adds On / Modules / Hooks /Apps
    • Community Developement
    • Best pratices / tip / trips and training
  • General
    • Optimization / Marketing
    • Laws on E-commerce
    • General discussions
    • Archives

Blogs

  • E-commerce General
  • ClicShopping

Categories

  • Apps
    • Apps Payment
    • Apps Configuration
    • Apps Shipping
    • Apps Catalog
    • Apps Communication
    • Apps Customers
    • Apps Marketing
    • Apps Orders
    • Apps Order Total
    • Apps Products Listing
    • Apps Report
    • Apps Social Network
    • Apps Tools
    • Apps Web Service
  • Template
    • modules_boxes
    • modules_products_info
    • modules_front_page
    • modules_footer
    • modules_header
    • modules_index_categories
    • modules_account_customers
    • Design template
    • modules_products_featured
    • modules_products_heart (favorites)
    • modules_blog
    • modules_blog_content
    • modules_checkout_confirmation
    • modules_checkout_payment
    • modules_checkout_shipping
    • modules_checkout_success
    • modules_tell_a_friend
    • modules_contact_us
    • modules_create_account
    • modules_create_account_pro
    • modules_advanced_search
    • modules_login
    • modules_products_listing
    • modules_products_new
    • modules_products_reviews
    • modules_products_search
    • modules_products_special
    • modules_shopping_cart
    • modules_sitemap
    • Autres modules
  • Hooks
    • Modules Hooks ClicShoppingAdmin - Orders
    • Modules Hooks Shop - AllShop
    • Modules Hooks Shop - Session
    • Modules Hooks Shop - Checkout
    • Modules Hooks Shop - Info
    • Modules Hooks Shop - Others
    • Modules Hooks ClicShoppingAdmin - Dashboard
    • Modules Hooks ClicShoppingAdmin - Import Databse
    • Modules Hooks ClicShoppingAdmin - Others
  • Modules
    • Modules Export
    • Modules Imports
    • Modules Others
    • Modules Dashbioard
  • modules
    • modules Action Recorder
    • modules Header tags
    • modules Social bookmarks
    • modules Others

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 6 results

  1. ClicShopping 3.X allow you to use use hooks inside your App to increase the functionalities in others App. To use this element you can have different choice depends with the app than you want to use Use the Hooks In hooks you have 2 choices : output to display an information call to use a function. $CLICSHOPPING_Hooks->call('Orders','Update'); $CLICSHOPPING_Hooks->ouput('Orders','ContentTracking', null 'display); To use the hook with call you can have different choices depending of the Hooks : The best is to look this directory inside the original hook where you want to include anew functionalities : ClicShopping/Apps/Products/ExtraFields/Modules/Hooks/ClicShoppingAdmin/ExtraFields $CLICSHOPPING_Hooks->call('Products','Insert'); $CLICSHOPPING_Hooks->call('Products','Update'); $CLICSHOPPING_Hooks->call('Products','Delete'); $CLICSHOPPING_Hooks->call('Products','Save'); At end, don't forget to insert in the clicshopping.json the new hook Display a Hooks About to display a hooks inside the page you can you something like that <div id="ContentTabQuantityDiscount"> in the original files you want to modify inside the hooks you can use this element to display the information. it could a new tab or inside a tab a content. For a Tab $dejardins_button = HTML::button('button_name'); $content = '<div> Desjardi</div>; $output = <<<EOD <div class="tab-pane" id="section_CMCICApp_content"> <div class="mainTitle"></div> <div class="adminformTitle"> <div class="separator"></div> {$dejardins_button} {$content} </div> </div> <script> $('#section_CMCICApp_content').appendTo('#orderTabs .tab-content'); $('#orderTabs .nav-tabs').append(' <li class="nav-item"><a data-target="#section_CMCICApp_content" role="tab" data-toggle="tab" class="nav-link">{$tab_title}</a></li>'); </script> EOD; For a content you can use append or prepend $content = '<div>mycontent</div>'; $output = <<<EOD <!-- ######################## --> <!-- Start SpecialsApp --> <!-- ######################## --> <script> $('#tab9Content').prepend( '{$content}' ); </script> <!-- ######################## --> <!-- End SpecialsApp --> <!-- ######################## --> EOD; For more informations, see the Hooks documentation
  2. The default template doesn't contain all informations that you can display in the template. If you need more informations, you must create a new template and use this syntax. Of course, if you want more options to display or not, you can create a new module and insert new option than you can manage in the back office. There the main information you can use. $products_name : Display the product name $products_stock : Display the product stock (image or text) $products_short_description : Display a short product description $products_flash_discount : Display the flash discount about a product $min_order_quantity_products_display : Display the min order than you accept for one order $product_price : display the product price $submit_button_view : display a message in function the customers group $submit_button : add button to take an order $products_quantity_unit : display the quantity of the unit to take an order $products_weight : display the product weight $button_small_view_details : Display the button to go in the product description $products_image : display the product image $ticker : display the ticker $products_model : display the product model $products_manufacturers : display the manufacturer of the product $products_date_available : display the availabity of the product $products_only_shop : display if the product is only available on the shop $products_only_web : display if the product is only available on the web $products_packaging : display the product packaging $products_shipping_delay : display the shipping delay $products_tag : display the tag of product $products_volume : display the volume of the product
  3. ClicShopping

    Hooks

    Hooks ClicShopping\OM\Hooks Introduction Hooks allow action callouts to be thrown during an event to execute additional functionality. Hooks are not modules in the traditional sense of being able to be installed and configured; they are simply modular functions waiting to be executed on demand with no configuration or administration whatsoever. For security reasons, hooks must be defined in their Apps metadata file otherwise they will not be made available for the framework to use. Hooks are initialized by creating an instance of ClicShopping\OM\Hooks and specifying the Site to call the hook action from. If no Site is passed, the Site that initialized the framework is used as default. use ClicShopping\OM\Hooks; $CLICSHOPPING_Hooks = new Hooks(); Hooks() is automatically initialized on each page request and is available in the Registry as Hooks. Action Callout Throwing out an action callout is performed by specifying the group the action belongs to, the actual action name, and optionally a specific function to execute. There are two types of callouts that can be peformed: Type Description call() Executes the hooks and can return an array of results depending on the action. output() Executes the hooks and returns the output as a string. Hooks::call() // no output expected $CLICSHOPPING_Hooks->call('Account', 'Logout'); Parameters Hooks::call($group, $hook, $parameters, $action) Parameter Value $group The group the action call belongs to. $hook The name of the action to call. $parameters Any parameters to pass to the hooks. $action The name of the hook function to execute. Default: execute Hooks::output() // concatenated string output of all hooks executed echo $CLICSHOPPING_Hooks->output('Orders', 'Page', null, 'display') Parameters Hooks::output($group, $hook, $parameters, $action) The output() method shares the same function parameters as the call() class method. A list of hook action callouts is available on the List of Hook Callouts page. Runtime Watches Runtime watches can be defined that execute when the hook is called. This differs from hooks defined in App metadata files as they are defined in-line and execute either an existing function or are defined with an anonymous function to execute: use ClicShopping\OM\Registry; $CLICSHOPPING_Hooks = Registry::get('Hooks'); $CLICSHOPPING_Hooks->watch('Session', 'Recreated', 'execute', function($parameters) { .... }); Note : This documentation has been rewritted and is issue of Oscommerce Documentation : Licence under BSD
  4. Database ClicShopping\OM\Db Introduction The Db class manages the connection to the database server and executes sql queries. It extends the native PHP PDO class with custom functionality optimized to the framework. The class executes sql queries safely and securely by binding parameter values to the query via placeholders rather then having the values being injected into the sql query itself. Connections Db::initialize() opens a new connection to the database server. All parameters of the function are optional where the installation configuration values are used as default values. use ClicShopping\OM\Db; $CLICSHOPPING_Db = Db::initialize(); Parameters Db::initialize($server, $username, $password, $database, $port, array $driver_options) Parameter Value $server The address of the database server. Default: db_server $username The username to connect to the database server with. Default: db_server_username $password The password of the user account. Default: db_server_password $database The name of the database. Default: db_database $port The port number of the database server. Default: null $driver_options Additional driver options to use for the database connection. Defaults: PDO::ATTR_ERRMODE PDO::ERRMODE_WARNING PDO::ATTR_DEFAULT_FETCH_MODE PDO::FETCH_ASSOC PDO::ATTR_STATEMENT_CLASS ClicShopping\OM\DbStatement PDO::MYSQL_ATTR_INIT_COMMAND set session sql_mode="STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION" A database connection is created on each page request and is available in the Registry as Db. Queries Prepared Statements Queries are performed with Db::prepare() which securely binds values to the query using placeholders. $seach = 'chocolate'; $category_id = 1; $price = '4.99'; $Qproducts = $CLICSHOPPING_Db->prepare('select title from :table_products where description like :description and category_id = :category_id and status = :status and price < :price order by title'); $Qproducts->bindValue(':description', '%' . $chocolate . '%'); $Qproducts->bindInt(':category_id', $category_id); $Qproducts->bindBool(':status', true); $Qproducts->bindDecimal(':price', $price); $Qproducts->execute(); while ($Qproducts->fetch()) { echo $Qproducts->value('title'); } Binding Parameters Parameters can be binded to the query using the following functions: Value Type Function String bindValue Integer bindInt Boolean bindBool Decimal bindDecimal Null bindNull [code] Table names prefixed with [b]:table_[/b] are binded and prefixed automatically with db_table_prefix. [b]Single Function Calls[/b] [b]Select Queries[/b] Simple select queries that do not need parameters to be binded can be executed with Db::query(). This functions returns a normal result set. [code] $Qstates = $CLICSHOPPING_Db->query('select id, title from :table_states where country_id = 1 order by title'); while ($Qstates->fetch()) { echo $Qstates->value('title'); } Update/Delete Queries Simple update/delete queries that do not need parameters to be binded can be executed with Db::exec(). This functions returns the number of rows affected. $result = $CLICSHOPPING_Db->exec('delete from :table_states where country_id = 1'); echo 'Affected rows: ' . $result; [code] [b]Results[/b] Results can be returned as a single result set, a multiple result set, and as an array containing all rows or columns. Fetching [b]Single Result Set[/b] Returning a single result set is performed as: [code] $Qstate = $CLICSHOPPING_Db->prepare('select title from :table_states where id = :id'); $Qstate->bindInt(':id', 1); $Qstate->execute(); if ($Qstate->fetch() !== false) { echo 'State: ' . $Qstate->value('title'); } Multiple Result Set Returning a multiple result set is performed as: $Qstates = $CLICSHOPPING_Db->prepare('select id, title from :table_states where country_id = :country_id'); $Qstates->bindInt(':country_id', 1); $Qstates->execute(); while ($Qstates->fetch()) { echo 'State: ' . $Qstates->value('title'); } Array Result Set An array can be retrieved containing either all rows of the result set or all columns of the current row: $Qstates = $CLICSHOPPING_Db->prepare('select id, title from :table_states where country_id = :country_id'); $Qstates->bindInt(':country_id', 1); $Qstates->execute(); $states_all = $Qstates->fetchAll(); $current_state = $Qstates->toArray(); Result Exists Checking to see if a result exists is performed as: $Qstates = $CLICSHOPPING_Db->prepare('select id, title from :table_states where country_id = :country_id'); $Qstates->bindInt(':country_id', 1); $Qstates->execute(); if ($Qstates->fetch() !== false) { echo 'States:'; do { echo $Qstates->value('title'); } while ($Qstates->fetch()); } else { echo 'No states exist.'; } Please note that the following will not work: $Qstates = $CLICSHOPPING_Db->prepare('select id, title from :table_states where country_id = :country_id'); $Qstates->bindInt(':country_id', 1); $Qstates->execute(); if ($Qstates->fetch() !== false) { echo 'States:'; while ($Qstates->fetch()) { echo $Qstates->value('title'); } } as calling fetch() in the if statement to check if a row exists and looping through the results again in the while statement will skip the first row of the result set due to the first call to fetch(). The do { .. } while ( .. ) method shown above is the correct way. Type Hinting Columns can be returned as a specific variable type using the following functions: Value Type Function String value HTML Safe String valueProtected Integer valueInt Decimal valueDecimal $Qproducts = $CLICSHOPPING_Db->prepare('select id, title, code, price from :table_products where description like :description order by title'); $Qproducts->bindValue(':description', '%chocolate%'); $Qproducts->execute(); if ($Qproducts->fetch() !== false) { do { echo $Qproducts->valueInt('id') . ': ' . $Qproducts->valueProtected('title') . ' (' . $Qproducts->value('code') . ') = ' . $Qproducts->valueDecimal('price'); } while ($Qproducts->fetch()); } [code] [b]Affected Rows[/b] The number of rows affected by an insert, update, or delete query can be returned as: [code] $Qupdate = $CLICSHOPPING_Db->prepare('update :table_states set title = :title where id = :id'); $Qupdate->bindValue(':title', 'Beverly Hills'); $Qupdate->bindInt(':id', 1); $Qupdate->execute; echo 'Affected rows: ' . $Qupdate->rowCount(); Please do not use rowCount() for select queries as this is not supported by PDO. Total Rows Retrieving the total rows of a query can be performed as: $Qtotal = $CLICSHOPPING_Db->prepare('select SQL_CALC_FOUND_ROWS id from :table_orders where status = :status'); $Qtotal->bindBool(':status', true); $Qtotal->execute(); echo 'Total rows: ' . $Qtotal->getPageSetTotalRows(); getPageSetTotalRows() requires SQL_CALC_FOUND_ROWS to exist in the query and automatically retrieves the total rows using select found_rows() after the query has been executed. It is also possible to use fetchAll() however this method uses more server resources and is not recommended: $Qorders = $CLICSHOPPING_Db->prepare('select id from :table_orders where status = :status'); $Qorders->bindBool(':status', true); $Qorders->execute(); echo 'Total rows: ' . count($Qtotal->fetchAll()); Page Sets Returning a page set result is performed as: $Qorders = $CLICSHOPPING_Db->prepare('select SQL_CALC_FOUND_ROWS order_number, total_price From :table_orders where customer_id = :customer_id and status = :status order by id desc limit :page_set_offset, :page_set_max_results'); $Qorders->bindInt(':customer_id', 1); $Qorders->bindBool(':status', true); $Qorders->setPageSet(15); $Qorders->execute(); if ($Qorders->getPageSetTotalRows() > 0) { echo 'Orders'; while ($Qorders->fetch()) { echo 'Order #' . $Qorders->valueInt('order_number') . ': ' . $Qorders->valueDecimal('total_price'); } echo $Qorders->getPageSetLabel('Displaying <strong>{{listing_from}}</strong> to <strong>{{listing_to}}</strong> (of <strong>{{listing_total}}</strong> orders)'); echo $Qorders->getPageSetLinks(); } Parameters setPageSet($max_results, $page_set_keyword, $placeholder_offset, $placeholder_max_results) Parameter Value $max_results The number of results to show per page. $page_set_keyword The name of the parameter holding the current page value. Default: page $placeholder_offset The name of the binding placeholder used as the limit offset in the sql query. Default: page_set_offset $placeholder_max_results The name of the binding placeholder used as the limit row number in the sql query. Default: page_set_max_results The parameter name of the current page value is passed as the second parameter. The default value is page and the value is retrieved from $_GET['page'] if it exists. Caching Caching of select query result sets improves performance by storing the result of the query in a cache file and subsequently reading the cached data until the cache expiration time is reached. As soon as the cache expiration time is reached, the database is queried again and the cached information is refreshed with the new result set. $Qcfg = $CLICSHOPPING_Db->prepare('select key, value from :configuration'); $Qcfg->setCache('configuration'); $Qcfg->execute(); while ($Qcfg->fetch()) { echo $Qcfg->value('key') . ': ' . $Qcfg->value('value'); } Parameters setCache($key, $expire, $cache_empty_results) Parameter Value $key The name of the cache block to retrieve or save. $expire The time in minutes the cached data should be saved for. A value of 0 keeps the cached data indefinitly until it has been manually cleared. Default: 0 $cache_empty_results A boolean value to cache or not cache empty result sets. Default: false Shortcuts Shortcut functions wrap Db::prepare() into a simpler interface to help write code faster for simpler queries. Db::get() Db::get() can be used to retrieve rows from a simple query. $Qstates = $CLICSHOPPING_Db->get('states', [ 'id', 'title' ], [ 'country_id' => 1 ], 'title' ); while ($Qstates->fetch()) { echo $Qstates->value('title'); } Parameters Db::get($table, $fields, array $where, $order, $limit, $cache, array $options) Parameter Value $table One (string) or more tables (array) to retrieve the rows from. Aliases may be used as: ['countries as c', 'states as s'] Table names are automatically prefixed unless the prefix_tables option is set as false (see the $options parameter). $fields One (string) or more fields (array) to retrieve. Aliases may be used as: ['c.countries_id as id', 'c.countries_title as title'] $where Array containing keys and values matching the column name to the condition: ['id' => 1] $order One (string) or more fields (array) to sort by: ['title', 'c.date_added'] $limit An integer value to limit the number of rows to, or an array containing two integer values to limit the number of rows (second value) with an offset (first value): [1, 15] $cache An array consisting of the parameters (in order) sent to setCache(). $options An array containing the following options: ['prefix_tables' => true] A more complex multi-relationship query example can be performed as: $Qproducts = $CLICSHOPPING_Db->get([ 'products p', 'products_to_categories p2c' ], [ 'count(*) as total' ], [ 'p.products_id' => [ 'rel' => 'p2c.products_id' ], 'p.products_status' => '1', 'p2c.categories_id' => '1' ] ); $products_count = $Qproducts->valueInt('total'); Db::save() Db::save() can be used to insert or update data in a table. $result = $CLICSHOPPING_Db->save('states', [ 'title' => 'California' ], [ 'id' => 1 ] ); echo 'Affected rows: ' . $result; Parameters Db::save($table, array $data, array $where_condition, array $options) Parameter Value $table The table to save the data to. $data An associative key=>value array containing the data to save in the table. The array keys must match the table field names the array value should be saved in. $where_condition If no condition is passed, the data is inserted into the table as a new record. If an associative $key=>$value array is passed, it is used as the where condition of the query to update the data of an existing record. $options An array containing the following options: ['prefix_tables' => true] Db::delete() Db::delete() can be used to delete a single, multiple, or all records from a table. $result = $CLICSHOPPING_Db->delete('states', ['id' => 1 ]); echo 'Affected rows: ' . $result; Parameters Db::delete($table, array $where_condition, array $options) Parameter Value $table The table to delete the records from. $where_condition If no condition is passed, all records in the table are deleted. If an associative $key=>$value array is passed, it is used as the where condition of the query to delete the matching records. The array keys must match the table field names the array value is matched against. $options An array containing the following options: ['prefix_tables' => true] use Cache $Qcfg = $CLICSHOPPING_Db->prepare('select key, value from :configuration'); $Qcfg->setCache('configuration'); $Qcfg->execute(); while ($Qcfg->fetch()) { echo $Qcfg->value('key') . ': ' . $Qcfg->value('value'); } get information from Db $Qstates = $CLICSHOPPING_Db->get('states', [ 'id', 'title' ], [ 'country_id' => 1 ], 'title' ); while ($Qstates->fetch()) { echo $Qstates->value('title'); } $Qcfg = $CLICSHOPPING_Db->prepare('select key, value from :configuration'); $Qcfg->setCache('configuration'); $Qcfg->execute(); while ($Qcfg->fetch()) { echo $Qcfg->value('key') . ': ' . $Qcfg->value('value'); }
  5. Configuration Introduction The main installation configuration parameters are stored in the following locations: Type Location Global includes/ClicShopping/Conf/global.php Shop includes/ClicShopping/Sites/Shop/site_conf.php Shop includes/ClicShopping/Sites/ClicShoppingAdmin/site_conf.php The global configuration file and all site configuration files are automatically loaded into their own groups when the framework is initialized. The global configuration file is loaded into a 'global' group, and the site configuration files are loaded into their own Site group (eg, 'ClicShoppingAdmin', and 'Shop'). Reading a configuration value is first attempted at the Site level, and if the configuration key does not exist, the global value is returned. A Site level configuration parameter has priority over a global level parameter if a global level configuration parameter is also defined. Custom Configuration Files It's possible to create custom configuration files that have priority over the values from the core configuration files. Custom configuration files can be stored in the following locations: Type Location Global includes/ClicShopping/Custom/Conf/global.php Per-Site includes/ClicShopping/Custom/Sites/SITE/site_conf.php Configuration File Format The format of the configuration parameters are stored in a "ini" style format in a PHP file that is assigned to a $ini PHP variable. This style of configuration was chosen over a plain text .ini file to prevent configuration parameters being read in cases of the configuration files being publicly accessible through the web server. An example format for the global configuration file is: <?php $ini = <<<EOD db_server = "localhost" db_server_username = "dbuser" db_server_password = "dbpass" db_database = "my_db_name" db_table_prefix = "clic_" store_sessions = "MySQL" time_zone = "Europe/Berlin" EOD; An example of a Site configuration file is: <?php $ini = <<<EOD dir_root = "/www/html/" http_server = "https://demo.shop" http_path = "/" http_images_path = "images/" http_cookie_domain = ".clicshopping.shop" http_cookie_path = "/" EOD; External Configuration Files External configuration files can be loaded using the following code: use ClicShopping\OM\CLICSHOPPING; CLICSHOPPING::loadConfigFile($path_of_file, 'ext_group'); This would load the configuration parameters of $path_of_file to the 'ext_group' configuration group. It is important that the ini format is stored as a string to the $ini PHP variable otherwise the configuration parameters can not be parsed. Retrieving Configuration Parameters Configuration parameters can be retrieved using CLICSHOPPING::getConfig(): use ClicShopping\OM\CLICSHOPPING; $value = CLICSHOPPING::getConfig('cfg_name'); In this example, the cfg_name configuration parameter from the current Site group is returned. If the current Site group does not contain the configuration parameter, the global group value is returned. It's possible to define which group the configuration parameter should be loaded from by defining the group name: use ClicShopping\OM\CLICSHOPPING; $value = CLICSHOPPING::getConfig('cfg_name', 'ext_group'); This would load the cfg_name configuration parameter from the ext_group group. The following can be used to first see if a configuration parameter exists: use ClicShopping\OM\CLICSHOPPING; if (CLICSHOPPING::configExists('cfg_name')) { .... } This will check if cfg_name exists in the current Site group or the global group. Checking to see if a configuration parameter exists in a specific group is performed as follows: use ClicShopping\OM\CLICSHOPPING; if (CLICSHOPPING::configExists('cfg_name', 'ext_group')) { .... } Please note that if the configuration parameter does not exist in the specified group, a check is also performed in the global group. Setting Configuration Parameters Runtime configuration parameters can be set as follows: use ClicShopping\OM\CLICSHOPPING; $value = true; CLICSHOPPING::setConfig('is_true', $value, 'ext_group'); If no group is specified in the third parameter, the configuration parameter would be set in the global group. This function does not save the configuration parameter to the configuration file - it only sets a runtime configuration parameter value. Note : This documentation has been rewrited and is issue of Oscommerce Documentation : Licence under BSD
  6. ClicShopping\OM is a framework based on OsCommerce 2.4 (rewrited and completed) 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 Custom ClicShopping\Custom includes/ClicShopping/Custom Namespaces/Autoloader 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. Examples Class File Location ClicShopping\OM\CLICSHOPPING includes/ClicShopping/OM/CLICSHOPPING.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. Examples namespace CLICSHOPPING\OM; class NewClass { .... } The full namespace to the above example would be: ClicShopping\OM\NewClass and the location of the file would be: includes/ClicShopping/OM/NewClass.php 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. Examples namespace ClicShopping\OM; use ClicShopping\OM\NewClass; class AnotherNewClass { public function __construct() { $NewClass = new NewClass(); } } The framework autoloader (ClicShopping\OM\CLICSHOPPING::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: Examples use ClicShopping\OM\HTML; echo HTML::outputProtected('Hello World!'); More information about namespaces can be found at the PHP Namespace documentation page. Sites 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\CLICSHOPPING; CLICSHOPPING::initialize(); CLICSHOPPING::loadSite('Shop'); $site = CLICSHOPPING::getSite(); Custom Directory To customize a core source file, copy it to this directory matching the directory structure of the original file. For example, - to make custom changes to ClicShopping/OM/Session/File.php - copy the complete file to ClicShopping/Custom/Session/File.php and perform your changes to this new file. Notes Although the custom class is copied to a Custom directory, it must retain the original Core namespace. Due to this, copied classes cannot extend the original class in the Core namespace. ClicShopping\Custom\Conf Configuration setting ClicShopping\Custom\Sites\Shop (default) Shop classes ClicShopping\Custom\OM OM classes ClicShopping\Custom\Schema Database file installation Apps 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: public/Apps/VENDOR/APP More information is available in the Apps chapter. Service Services are portions of the online store that do not directly relate to the customer purchasing a product, but can be helpful in setting up the store. Services are available in Shop and ClicShoppingAdmin. it can use everywhere inside the site. Example Service for the mail namespace ClicShopping\Service\Shop; use ClicShopping\OM\Registry; use ClicShopping\OM\Mail as MailClass; class Mail implements \ClicShopping\OM\ServiceInterface { public static function start() { if (is_file(CLICSHOPPING_BASE_DIR . 'OM/Mail.php')) { Registry::set('Mail', new MailClass()); return true; } else { return false; } } public static function stop() { return true; } } How to call inside a file : $CLICSHOPPING_Mail = Registry::get('Mail'); Note : This documentation has been rewrited and is issue of Oscommerce Documentation : Licence under BSD
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use