Adapt Your Add-ons and Themes to CS-Cart 4.12.1

Common Changes

  • HTMLPurifier library was updated to version 4.13.0.

Linking of Languages And Currencies to Storefronts

CS-Cart no longer uses the sharing mechanism to link languages and currencies to storefronts.

Linking of Settings to Storefronts

The ability to specify different settings for different storefronts was added to Multi-Vendor (in a manner similar to CS-Cart).

If you want to use this new functionality, you’ll have to adapt your add-ons:

  1. Change the edition_type for settings and sections from ROOT,VENDOR or ROOT,ULT:VENDOR to ROOT,STOREFRONT.

  2. Wherever you get or update setting values programmatically, explicitly specify storefront_id. It is best to specify it when fetching an instance of the settings service:

    $settings_manager = Settings::instance(['storefront_id' => 1]);

Security Changes

Creating a password hash with md5 was replaced with hashing based on the password_hash function. The fn_user_password_verify function is now used for password verification.

Structure Changes

The single file app/functions/fn.catalog.php was split into separate files, depending on the functions’ purpose:

  • fn.categories.php
  • fn.features.php
  • fn.filters.php
  • fn.options.php
  • fn.product_files.php
  • fn.products.php

Notification Changes

We added the ability to set receivers of notifications: specific user groups, users, and email addresses.

If you have already developed your own notification transport or extended the event schemas, you’ll need to adapt them:

  1. Change the \Tygh\Notifications\Transports\ITransport::process() method in the transport class. The receiver search conditions for the event are now passed to it.

  2. Implement a search for receivers of a notification. In standard classes, this mechanism is implemented using specific finder classes:


    and the finder factories that create these classes:

  3. If you added a group of notification events, configure the displaying of the receiver editor via the notifications/groups scheme.

To avoid confusion, the vendor who is to receive internal notifications should be specified via the new to_company_id property. In email notification, the company_id property specifies the vendor who is the sender.

Changes in Vendor Plans

commision_amount does not display the marketplace profit now. It can include fees and taxes (if the Collect taxes from vendors setting is enabled). The marketplace profit is displayed by marketplace_profit.

Changes in Admin Panel Menu

Third-party add-ons can no longer create root elements in the admin panel menu. As a part of the current release, the validate_menu tweak has been added to maintain backward compatibility. This will allow you to disable such filtering.

Changes in Add-on Scheme

A new supplier_page tag was added to the add-on scheme file. Use it to specify the path to the developer page. The developer page must be written in the following format: controller.mode.

Core Changes

Removed Classes

  • \Tygh\Api\Entities\Combinations

Changed Classes

Notification Changes

  1. //Old:
    // New:
  2. Public property removed: \Tygh\Notifications\Transports\Internal\InternalMessageSchema::$recipient_search_method

  3. Public property removed: \Tygh\Notifications\Transports\Internal\InternalMessageSchema::$recipient_search_criteria

  4. Public property added: \Tygh\Notifications\Transports\Internal\InternalMessageSchema::$to_company_id

New Classes

  1. Gets an error message of failed antibot validation:

  2. Contains all possible setting object types:


Notification Changes

  1. Represents a message receiver search condition:

  2. Provides classes that find receivers for internal notifications:

  3. Describes the class that is used to find receivers for internal notifications:

  4. Finds receivers of internal notifications by their email addresses:

  5. Finds order managers that receive internal notifications:

  6. Finds receivers of internal notifications in the specified user group:

  7. Finds receivers of internal notifications by user identifiers:

  8. Finds main administrators of vendors that receive internal notifications:

  9. Describes class that is used to find receivers for e-mail notifications:

  10. Finds receivers of email notifications by their email addresses:

  11. Finds order managers that receive email notifications:

  12. Finds receivers of email notifications in the specified user group:

  13. Finds receivers of email notifications by user identifiers:

  14. Finds main administrators of vendors that receive email notifications:


Changed Functions

  1. // Old:
    \Tygh\Backend\Storage\ABackend.php::getUrl($file = '', $protocol = '');
    // New:
    \Tygh\Backend\Storage\ABackend.php::getUrl($file = '', $protocol = '', $url = '');
  2. // Old:
    \Tygh\Backend\Storage\Amazon.php::getUrl($file = '', $protocol = '');
    // New:
    \Tygh\Backend\Storage\Amazon.php::getUrl($file = '', $protocol = '', $url = '');
  3. // Old:
    \Tygh\Backend\Storage\File.php::getUrl($file = '', $protocol = '');
    // New:
    \Tygh\Backend\Storage\File.php::getUrl($file = '', $protocol = '', $url = '');
  4. // Old:
    // New:
    fn_get_user_name($user_id, array $user_info = null)
  5. // Old:
    // New:
    fn_exim_get_field_label($value, $action = '')
  6. // Old:
    fn_generate_thumbnail($image_path, $width, $height = 0, $lazy = false, $return_rel_path = false, array $image = [])
    // New:
    fn_generate_thumbnail($image_path, $width, $height = 0, $lazy = false, $return_rel_path = false, array $image = [], $url = '')
  7. // Old:
    fn_image_to_display($images, $image_width = 0, $image_height = 0)
    // New:
    fn_image_to_display(array $images, $image_width = 0, $image_height = 0, $url = '')
  8. // Old:
    // New:
  9. // Old:
    fn_hybrid_auth_get_unlink_provider($user_id, $provider)
    // New:
    fn_hybrid_auth_get_unlink_provider($user_id, $provider_id)
  10. // Old:
    // New:
  11. // Old:
    // New:
  12. // Old:
    fn_hybrid_auth_link_provider($user_id, $identifier, $provider)
    // New:
    fn_hybrid_auth_link_provider($user_id, $identifier, $provider_id)
  13. // Old:
    fn_hybrid_auth_login($user_data, $auth_data, $provider)
    // New:
    fn_hybrid_auth_login($user_data, $auth_data, $provider_id)
  14. // Old:
    fn_hybrid_auth_link($user_data, $auth_data, $provider)
    // New:
    fn_hybrid_auth_link($user_data, $auth_data, $provider_id)
  15. // Old:
    fn_hybrid_auth_link_profile($auth_data, $provider)
    // New:
    fn_hybrid_auth_link_profile($auth_data, $provider_id)
  16. // Old:
    fn_hybrid_auth_fix_old_user($auth_data, $provider)
    // New:
    fn_hybrid_auth_fix_old_user($auth_data, $provider_id)
  17. // Old:
    fn_get_schema($schema_dir, $name, $type = 'php', $force_addon_init = false)
    // New:
    fn_get_schema($schema_dir, $name, $type = 'php', $force_addon_init = false, array $addons_to_load_schemas_from = null)
  18. // Old:
    fn_delete_discussion($object_id, $object_type)
    // New:
    fn_delete_discussion($object_id, $object_type, $company_id = null)

Notification Changes

  1. // Old:
    \Tygh\Notifications\Transports\ITransport::process(BaseMessageSchema $schema);
    // New:
    \Tygh\Notifications\Transports\ITransport::process(BaseMessageSchema $schema, array $receiver_search_conditions);

Changes in Settings

  1. // Old:
    \Tygh\Settings::instance($company_id = null)
    // New:
    \Tygh\Settings::instance($params = [])
  2. // Old:
    \Tygh\Settings::getList($section_id = 0, $section_tab_id = 0, $plain_list = false, $company_id = null, $lang_code = CART_LANGUAGE)
    // New:
    \Tygh\Settings::getList($section_id = 0, $section_tab_id = 0, $plain_list = false, $company_id = null, $lang_code = CART_LANGUAGE, $storefront_id = null)
  3. // Old:
    \Tygh\Settings::getSettingDataByName($setting_name, $company_id = null, $lang_code = CART_LANGUAGE)
    // New:
    \Tygh\Settings::getSettingDataByName($setting_name, $company_id = null, $lang_code = CART_LANGUAGE, $storefront_id = null)
  4. // Old:
    \Tygh\Settings::getValues($section_name = '', $section_type = Settings::CORE_SECTION, $hierarchy = true, $company_id = null)
    // New:
    \Tygh\Settings::getValues($section_name = '', $section_type = Settings::CORE_SECTION, $hierarchy = true, $company_id = null, $storefront_id = null)
  5. // Old:
    \Tygh\Settings::getValue($setting_name, $section_name, $company_id = null)
    // New:
    \Tygh\Settings::getValue($setting_name, $section_name, $company_id = null, $storefront_id = null)
  6. // Old:
    \Tygh\Settings::getData($object_id, $company_id = null, $lang_code = CART_LANGUAGE)
    // New:
    \Tygh\Settings::getData($object_id, $company_id = null, $lang_code = CART_LANGUAGE, $storefront_id = null)
  7. // Old:
    \Tygh\Settings::updateValue($setting_name, $setting_value, $section_name = '', $force_cache_cleanup = false, $company_id = null, $execute_functions = true)
    // New:
    \Tygh\Settings::updateValue($setting_name, $setting_value, $section_name = '', $force_cache_cleanup = false, $company_id = null, $execute_functions = true, $storefront_id = null)
  8. // Old:
    \Tygh\Settings::updateValueById($object_id, $value, $company_id = null, $execute_functions = true)
    // New:
    \Tygh\Settings::updateValueById($object_id, $value, $company_id = null, $execute_functions = true, $storefront_id = null)
  9. // Old:
    // New:
    fn_update_addon($settings, $storefront_id = null)
  10. // Old:
    fn_update_customization_mode(array $modes)
    // New:
    fn_update_customization_mode(array $modes, $storefront_id = null)
  11. // Old:
    fn_get_storefront_protocol($company_id = null)
    // New:
    fn_get_storefront_protocol($company_id = null, $storefront_id = null)

Removed Functions

  • fn_hybrid_auth_get_provider_id($provider)
  • fn_prepare_xml_product_options
  • fn_get_product_options_inventory_ebay
  • \Tygh\Commerceml\RusEximCommerceml::addNewCombination
  • \Tygh\Commerceml\RusEximCommerceml::addProductOptionException
  • fn_rus_exim_1c_look_through_variants_update_combination
  • fn_delete_product_combination
  • fn_delete_product_option_combinations
  • fn_look_through_variants
  • fn_delete_outdated_combinations
  • fn_rebuild_product_options_inventory
  • fn_update_exceptions
  • fn_clone_options_inventory
  • fn_get_product_options_inventory
  • fn_get_product_options_combination_data
  • fn_update_option_combination
  • fn_delete_option_combination

New Functions

  1. Get the list of statuses with the specific parameters:

    fn_get_status_by_type_and_param($type, $params)
  2. Send a notification about current return request status:

    fn_rma_send_notification($return_info, $order_info, $force_notification = [])
  3. Get the schema of event groups:

  4. Get notification settings:

    \Tygh\Providers\EventDispatcherProvider::getNotificationSettings($with_receivers = false)
  5. Get the schema of events:

  6. Get the user’s email:

    fn_get_user_email($user_id, array $user_info = null)
  7. Update the promotion image for the specified language (will be uploaded for all languages if new):

    fn_promotions_update_image($promotion_id, $lang_code = DESCR_SL)
  8. Delete the promotion image:

    fn_promotions_delete_image($promotion_id, $lang_code = null)
  9. Clone the promotion image links for the specified languages:

    fn_promotions_copy_image_link_to_langs($promotion_id, $original_lang = CART_LANGUAGE, array $cloned_langs = [])
  10. Clone the promotion image links to an added language:

  11. Delete the promotion images for deleted languages:

  12. Delete the image data specified for promotions:

  13. Get currency information:

    fn_get_currency($currency_id, $lang_code = DESCR_SL)
  14. Delete the file attachment by object ID:

    fn_attachments_delete_by_object_id($object_type, $object_id)
  15. Fetch the array of paths to the directory with imported attachments:

    fn_attachments_get_import_attachments_directory($company_id, $path = '')
  16. Check if the vendor administrator can use order_management:

  17. Save the data of user profile fields:

    fn_store_user_profile_fields(array $profile_data, $object_id, $object_type, $ship_to_another = false)
  18. Get current storefront data:

  19. Get storefront repository data:

  20. Remove all settings values for the storefront:

  21. Remove all company- and storefront-specific values of the setting:

  22. Check whether the setting can be overridden on a per-storefront or a per-company basis:

  23. Define if admin panel will be shown or not:

  24. Define if theme editor can be activated by a signed-in user:

  25. Prepare data for the bottom panel:


Deprecated Functions

  1. // Deprecated function:
    // What to use instead:
  2. // Deprecated function:
    // What to use instead:
  3. fn_filter_product_data

  4. fn_filters_not_found_notification

  5. // Deprecated function:
    // What to use instead:
  6. // Deprecated function:
    // What to use instead:
  7. // Deprecated function:
    // What to use instead:

Hook Changes

New Hooks

  1. This hook is executed before a notification about the creation of a new shipment is sent. The hook allows you to modify the shipment data in the notificaion:

    fn_set_hook('update_shipment_before_send_notification', $shipment_data, $shipment_id, $group_key, $all_products, $force_notification, $order_info, $shipment);
  2. This hook is executed before the existing product feature variants are selected by name:

    fn_set_hook('update_product_feature_variant_before_select', $feature_id, $feature_type, $variant, $lang_code, $fields, $joins, $conditions, $limit);
  3. This hook is executed after the display_language and the description_language parameters have been determined, and right before setting them. The hook allows you to change the languages that will be used and the list of available languages:

    fn_set_hook('init_language_post', $params, $area, $default_language, $session_display_language, $avail_languages, $display_language, $description_language, $browser_language);
  4. This hook changes parameters for selecting companies:

    fn_set_hook('get_companies_pre', $params, $items_per_page, $lang_code);
  5. This hook allows you to extend data provided to the bottom panel:

    fn_set_hook('prepare_bottom_panel_data', $bottom_panel_data);
  6. This hook adds additional vendors activity statistic to a dashboard:

    fn_set_hook('dashboard_get_vendor_activities_post', $timestamp_from, $timestamp_to, $dashboard_vendors_activity);
  7. This hook is executed when the cart content is calculated, after the shipping rates have been calculated. The hook allows you to modify the cart and the list of shipping methods:

    fn_set_hook('calculate_cart_content_after_shipping_calculation', $cart, $auth, $calculate_shipping, $calculate_taxes, $options_style, $apply_cart_promotions, $lang_code, $area, $cart_products, $product_groups);
  8. This POST hook allows you to update product filter:

    fn_set_hook('update_product_filter_post', $filter_data, $filter_id, $lang_code, $create);
  9. This hook changes the message before it is converted:

    fn_set_hook('message_style_formatter_convert_pre', $message, $inline_css);
  10. This hook changes the message after it has been converted:

    fn_set_hook('message_style_formatter_convert_post', $message);

Deprecated Hooks

  1. // Deprecated hook:
    // What to use instead:
  2. // Deprecated hook:
    // What to use instead:
  3. get_avail_product_features_before_select

  4. filter_product_data

  5. update_product_filter

Changed Hooks

  1. // Old:
    fn_set_hook('get_orders_totals', $paid_statuses, $join, $condition, $group);
    // New:
    fn_set_hook('get_orders_totals', $paid_statuses, $join, $condition, $group, $totals);
  2. // Old:
    fn_set_hook('settings_update_value_by_id_pre', $this, $object_id, $value, $company_id, $execute_functions, $data, $old_data, $table);
    // New:
    fn_set_hook('settings_update_value_by_id_pre', $this, $object_id, $value, $company_id, $execute_functions, $data, $old_data, $table, $storefront_id);
  3. // Old:
    fn_set_hook('settings_update_value_by_id_post', $this, $object_id, $value, $company_id, $execute_functions, $data, $old_data, $table);
     // New:
    fn_set_hook('settings_update_value_by_id_post', $this, $object_id, $value, $company_id, $execute_functions, $data, $old_data, $table, $storefront_id);
  4. // Old:
    fn_set_hook('get_product_data_pre', $product_id, $auth, $lang_code, $field_list, $get_add_pairs, $get_main_pair, $get_taxes, $get_qty_discounts, $preview, $features, $skip_company_condition);
    // New:
    fn_set_hook('get_product_data_pre', $product_id, $auth, $lang_code, $field_list, $get_add_pairs, $get_main_pair, $get_taxes, $get_qty_discounts, $preview, $features, $skip_company_condition, $params);
  5. // Old:
    fn_set_hook('pre_get_cart_product_data', $hash, $product, $skip_promotion, $cart, $auth, $promotion_amount, $fields, $join);
    // New:
    fn_set_hook('pre_get_cart_product_data', $hash, $product, $skip_promotion, $cart, $auth, $promotion_amount, $fields, $join, $params);
  6. // Old:
    fn_set_hook('delete_discussion_pre', $object_id, $object_type);
    // New:
    fn_set_hook('delete_discussion_pre', $object_id, $object_type, $company_id);
  7. // Old:
    fn_set_hook('delete_discussion_post', $object_id, $object_type, $is_deleted);
    // New:
    fn_set_hook('delete_discussion_post', $object_id, $object_type, $is_deleted, $company_id);

Removed Hooks

  1. fn_set_hook('delete_product_option_combinations', $product_id);
  2. fn_set_hook('look_through_variants_pre', $product_id, $amount, $options, $variants);
  3. fn_set_hook('look_through_variants_update_combination', $combination, $_data, $product_id, $amount, $options, $variants);
  4. fn_set_hook('look_through_variants_post', $combinations, $product_id, $amount, $options, $variants);
  5. fn_set_hook('rebuild_product_options_inventory_pre', $product_id, $amount);
  6. fn_set_hook('rebuild_product_options_inventory_post', $product_id);
  7. fn_set_hook('clone_options_inventory_pre', $from_product_id, $to_product_id, $options, $variants);
  8. fn_set_hook('clone_options_inventory_post', $from_product_id, $to_product_id, $options, $variants);
  9. fn_set_hook('get_product_options_inventory_pre', $params, $items_per_page, $lang_code);
  10. fn_set_hook('get_product_options_inventory_post', $params, $items_per_page, $lang_code, $inventory);
  11. fn_set_hook('get_product_options_combination_data_post', $combination_hash, $combination);
  12. fn_set_hook('update_option_combination_pre', $combination_data, $combination_hash);
  13. fn_set_hook('update_option_combination_post', $combination_data, $combination_hash, $inventory_amount);
  14. fn_set_hook('delete_option_combination_pre', $combination_hash);