Adapt Your Add-Ons To CS-Cart 4.2.1

Familiarize yourself with the list of changes that can affect your add-ons operation when updating from 4.1.5 to 4.2.1 version.

They are not so numerous, but some of them affected CS-Cart functionality rather heavily.

Here is the list of main changes

New Responsive theme was added. You should check your add-ons design with the new theme and adapt it if needed.


Because of the fact that the SEO add-on was highly modified (see the list of changes in our blog), PHP functions were changed too. If your add-on works with the SEO functionality, check it.

As for hooks, here is the list of added, removed, and modified hooks:


  • seo_static_cache
  • seo_empty_object_name


  • get_seo_vars
  • get_rewrite_rules
  • seo_is_indexed_page
  • seo_url

For more information open:

Choose “Compare with”: “CS-Cart Lifetime License” “4.1.5” and click Search.


PO files format was changed.


#. Editing product
msgctxt "Languages"
msgid "editing_product"
msgstr "Редактирование товара”


msgctxt "Languages:tools_addons_restore_defaults"
msgid "Restore defaults"
msgstr "Восстановить стандартные настройки”

According to this, all PO files related functions were changed too.


The following settings:

  • Enable secure connection at checkout
  • Enable secure connection in the administration panel
  • Enable secure connection for authentication, profile and orders pages
  • Keep HTTPS connection once a secure page is visited

were moved from the General section of the administration panel to Security.

settings.General.secure_checkout -> settings.Security.secure_checkout
settings.General.keep_http -> settings.Security.keep_https
settings.General.secure_admin -> settings.Security.secure_admin
settings.General.secure_auth -> settings.Security.secure_auth
- Registry::get('settings.General.secure_checkout');
+ Registry::get('settings.Security.secure_checkout');


$secure_admin_value = Registry::get('settings.Security.secure_admin');

Also the following settings changed their names:

save_selected_layout -> save_selected_view
default_products_layout -> default_products_view
default_products_layout_templates -> default_products_view_templates
default_product_details_layout -> default_product_details_view
- Registry::get('settings.Appearance.save_selected_layout');
+ Registry::get('settings.Appearance.save_selected_view');

We have completely switched to HTML5. There is no more need in the following structure in JavaScript code:


All the config variables with the resources paths were moved to $config['resources’].

$config['resources'] = array(
'knowledge_base' => '',
'updates_server' => '',
'twitter' => 'cscart',
'feedback_api' => '',
'product_url' => '',
'helpdesk_url' => '',
'license_url' => '',
'marketplace_url' => '',
'admin_protection_url' => '',
//'demo_store_url' => '' . strtolower(PRODUCT_EDITION) . '/'

$config['updates_server'] = ''; //was left for now for the backward compatibility, but will be removed soon.
bad: Registry::get('config.updates_server’)
good: Registry::get('config.resources.updates_server')


The ability to import Order items for a non-existing order was removed.


The ability to import language variables for a non-existing language was removed.

Layouts: Blocks

The disable_cache flag for fillings was returned. Now it is possible to disable cache for certain fillings values (when creating the Random products block, for example).

'products' => array (
'content' => array (
'items' => array (

'fillings' => array (
'random_products' => array (
'params' => array (
'sort_by' => 'popularity',
'sort_order' => 'desc',
'disable_cache' => true,


Smarty was updated to the latest version (3.1.15 -> 3.1.18).

The new helpful function was added:

+ /**
+  * Gets company storefront URLs
+  * @param integer $company_id company ID
+  * @param array $company_data company data (if passed, company_id won't be used)
+  * @return array storefront URLs
+  */
+ function fn_get_storefront_urls($company_id, $company_data = array())

The is_permanent flag was added to the fn_redirect function. Now it is possible to create 301 redirects.

- function fn_redirect($location, $allow_external_redirect = false)
+ function fn_redirect($location, $allow_external_redirect = false, $is_permanent = false)

The PRODUCT_NAME constant was added.


The ability to create a common shipping method for all suppliers was added. The corresponding code was changed.

If it is necessary to extend one add-on with another, now it is possible to select all hook functionality inside the add-on. For example, news_and_emails uses seo. Not to spread the seo functionality across all the news_and_emails functionality, it can be passed to a hook:


The principles of working are the same as for the other hooks. One exception is that hooks from the addons catalog inside the news_and_emails add-on will be included only when the appropriate add-on is enabled (the SEO add-on in this example).

The 3rd parameter was added for registering the php hooks:

fn_register_hooks( array('get_news_data', '', 'seo') )

The name of a function processing a hook is fn_seo_get_news_data. It is called out when the SEO add-on is enabled.


All the described actions take place in the News and emails add-on.


Now demo banners are always installed.

The web configuration file for ISS servers was added (for htaccess). Check the var/conf/ directory.

The instance method of the Settings class now allows to get settings of the defined company:

- public static function instance()
+ public static function instance($company_id = null)

htaccess now allows to download the .yml and .xml files from the var/ directory.


- fn_set_hook('update_shipping_post', $shipping_data, $shipping_id, $lang_code);
+fn_set_hook('update_shipping_post', $shipping_data, $shipping_id, $lang_code, $action);

We have added a new version of the addon.xml file:

<addon scheme="3.0">

So, all the add-ons which have XML v3, support PO-files with translations.