This article describes what happens when an add-on is installed, uninstalled, activated or deactivated.
The list of add-ons is available in the CS-Cart & Multi-Vendor Administration panel under Add-ons → Manage add-ons. This is how this list is built:
The preliminary list of add-ons is generated. Every sub-folder of app/addons is considered an add-on at this point.
An attempt is made to load app/addons/[addon]/addon.xml from every folder.
The add-on is ignored if addon.xml couldn’t be loaded or parsed. XML parsing errors for addon.xml will appear in error notification.
The names for the remaining add-ons are retrieved. If your addon.xml uses scheme 3.0, the name of the add-on will be taken from var/langs/[lang_code]/addons/[addon].po.
The data of the installed add-ons retrieved from the database and added to the list. So, if an add-on is already installed, its name and description won’t change.
The ?:addons
table is checked to make sure there is no entry for the add-on.
The add-on scheme is loaded from addon.xml.
If the add-on is marked as unmanaged
, it won’t appear on the add-on list in the Administration panel. It can only be the installed can via console.
To enable the automatic loading of the add-on’s classes, the folder of the add-on is added to Tygh::$app['class_loader']
.
Compatibility is checked.
Note
If the add-on is incompatible with the server environment or your version of CS-Cart/Multi-Vendor, an error is displayed and the installation is aborted.
Dependencies on other add-ons are checked.
Note
Conflicting add-ons aren’t checked at this point. They will be checked during add-on activation.
The functions from the <functions>
section of addon.xml with the for="before_install"
condition are executed.
Note
If executing a function results in a database error, the add-on installation in aborted, and the add-on is uninstalled.
An entry is created in Registry::set('addons.' . $addon)
. Only the disabled
status and add-on’s priority are recorded there.
The queries from the <queries>
section of addon.xml with the for="install"
condition are executed.
Note
If a database error occurs, the add-on installation in aborted, and the add-on is uninstalled.
The settings of the add-on specified in the <settings>
section of addon.xml are created in the database.
Note
If a database error occurs, the add-on installation in aborted, and the add-on is uninstalled.
Entries in the ?:addons
and ?:addon_descriptions
tables are created. The add-on has the Disabled status for the time being.
The language variables are installed from the PO file.
The templates are copied from var/themes_repository to design/themes.
The values of the add-on’s settings are recorded in Registry::set('addons.' . $addon)
and in Registry::set('settings.' . $addon, $settings)
.
The values of the language variables for the English language are saved to the ?:original_values
table.
The product tabs are installed from [theme]/templates/addons/[addon]/blocks/product_tabs.
The functions from the <functions>
section of addon.xml with the for="install"
condition are executed.
Note
If a database error occurs, the add-on installation in aborted, and the add-on is uninstalled.
If the addon.xml has the add-on status as Active, the add-on is activated.
Note
Even if the add-on activation is aborted, the installation will continue. However, the addon will remain disabled by default in that case.
Layout is imported: app/addons/[addon]/layouts.xml.
The cache is cleared.
The demo data is installed. This happens only if the add-on is installed along with CS-Cart/Multi-Vendor, and the Install demo data checkbox was ticked.
Note
If a database error occurs at this step, the add-on installation in aborted, and the add-on is uninstalled.
If the add-on is marked as unmanaged
, it won’t appear on the add-on list in the Administration panel. It can only be the uninstalled can via console.
A check is performed to find add-ons that depend on this add-on. If such add-ons are found, the uninstalling procedure will be aborted, and a message will appear:
Important
Warning: The add-on cannot be uninstalled because the following add-ons depend on it: [addons].
The functions from the <functions>
section of addon.xml with the for="uninstall"
condition are executed.
The entries are removed from the ?:addons
and ?:addon_descriptions
tables.
The add-on’s settings are removed.
The add-on’s language variables are removed.
The queries from the <queries>
section of addon.xml with the for="uninstall"
condition are executed.
The add-on’s product tabs are removed.
The add-on’s templates are removed from design/themes.
The add-on’s layouts are reverted.
The Registry::get('addons.' . $addon_name)
is cleared.
The add-on’s hooks are removed from the registered hook list Registry::get('hooks')
.
The cache is cleared.
The scheme of the add-on is loaded from addon.xml.
If the add-on is marked as unmanaged
, it won’t appear on the add-on list in the Administration panel. It can only be the activated can via console.
The following hook is executed:
fn_set_hook('update_addon_status_pre', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme);
All the active add-ons are checked to find out if the add-on is marked as a conflict for any of them.
Note
If a conflicting add-on is found, a warning will appear and the activation will be aborted.
A check is performed to find out if the following function exists:
fn_settings_actions_addons_[addon]()
If the function exists, it is summoned with the following arguments: ($new_status, $old_status, $on_install)
.
All the add-ons marked as conflicts for this add-on are checked to find out if they are disabled.
Note
If any conflicting add-on is active, a warning will appear and the activation will be aborted.
The value of the status field in the ?:addons
table is changed to A for this add-on.
A check is performed to find out if the following function exists:
fn_settings_actions_addons_post_[addon]()
If the function exists, it is summoned with the following arguments: ($new_status)
.
The statuses of the product tabs are updated: the product_tabs
of the add-on are enabled.
The A status is recorded to Registry::set('addons.[addon].status')
.
The scheme of the add-on is loaded from addon.xml.
If the add-on is marked as unmanaged
, it won’t appear on the add-on list in the Administration panel. It can only be the deactivated can via console.
The following hook is executed:
fn_set_hook('update_addon_status_pre', $addon, $status, $show_notification, $on_install, $allow_unmanaged, $old_status, $scheme);
A check is performed to find out if the following function exists:
fn_settings_actions_addons_[addon]()
If the function exists, it is summoned with the following arguments: ($new_status, $old_status, $on_install)
.
The value of the status field in the ?:addons
table is changed to D for this add-on.
A check is performed to find out if the following function exists:
fn_settings_actions_addons_post_[addon]()
If the function exists, it is summoned with the following arguments: ($new_status)
.
The statuses of the product tabs are updated: the product_tabs
of the add-on are disabled.
The D status is recorded to Registry::set('addons.[addon].status')
.
Questions & Feedback
Have any questions that weren't answered here? Need help with solving a problem in your online store? Want to report a bug in our software? Find out how to contact us.