Hello everybody!
We continue to inform our developers about the core changes that can affect custom add-ons.
This time we observe changes from 4.1.3 to 4.1.4 versions.
[size=5]CORE
===============================================[/size]
[color=#000000][font=Arial][size=4]The new setting that restricts using API through HTTP was added (only HTTPS connection allowed).[/size][/font][/color]
[color=#000000][font=Arial][size=4]Check the [/size][/font][/color][color=#000000][font=Arial][size=4]config.tweaks.api_https_only[/size][/font][/color][color=#000000][font=Arial][size=4] setting if API is used in the add-on.[/size][/font][/color]
[color=#000000][font=Arial][size=4]
[/size][/font][/color]
$https_flag = Registry::get('config.tweaks.api_https_only');
if ($https_flag) {
......
}
[HR]
[color=#000000][font=Arial][size=4]The new setting that restricts using API in the customer area was added.[/size][/font][/color][color=#000000][font=Arial][size=4]So, check the [/size][/font][/color][color=#000000][font=Arial][size=4]config.tweaks.api_allow_customer[/size][/font][/color][color=#000000][font=Arial][size=4] setting.[/size][/font][/color]
[HR]
The getOnline($area) function was added to the Sessions class:
$sessions = Session::getOnline('C');
[HR]
[color=#000000][font=Arial][size=4]Now the [/size][/font][/color][color=#000000][font=Arial][size=4]delivery_time[/size][/font][/color][color=#000000][font=Arial][size=4] parameter can be used for the real-time shipping methods.[/size][/font][/color]
[color=#000000][font=Arial][size=4]It is not used in the CS-Cart core by default. But it is possible to use this functionality in the add-on that will extend the checkout page, so that the delivery time will be displayed on it.[/size][/font][/color]
[HR]
[color=#000000][font=Arial][size=4]The '[/size][/font][/color][color=#000000][font=Arial][size=4]basic'[/size][/font][/color][color=#000000][font=Arial][size=4] theme name must [/size][/font][/color][color=#000000][font=Arial][size=4]not [/size][/font][/color][color=#000000][font=Arial][size=4]be used in the code for getting or using templates.[/size][/font][/color]
[color=#000000][font=Arial][size=4]Use the following structure instead: [/size][/font][/color][color=#000000][font=Arial][size=4]Registry::get('config.base_theme');[/size][/font][/color]
[color=#000000][font=Arial][size=4]Example:[/size][/font][/color]
NO: $path = 'basic' + $file_path;
YES: $path = Registry::get('config.base_theme') + $file_path;
[HR]
[color=#000000][font=Arial][size=4]The [/size][/font][/color][color=#000000][font=Arial][size=4]theme_editor.php[/size][/font][/color][color=#000000][font=Arial][size=4] controller was renamed to the [/size][/font][/color][color=#000000][font=Arial][size=4]file_editor.ph[/size][/font][/color][color=#000000][font=Arial][size=4]p[/size][/font][/color]
Appropriate permissions and TPL files were renamed too.
[HR]
[color=#000000][font=Arial][size=4]The[/size][/font][/color][color=#000000][font=Arial][size=4] manifest.ini[/size][/font][/color][color=#000000][font=Arial][size=4] support was returned to the themes. When installing a theme from the [/size][/font][/color][color=#000000][font=Arial][size=4]var/themes_repository [/size][/font][/color][color=#000000][font=Arial][size=4]directory[/size][/font][/color][color=#000000][font=Arial][size=4], [/size][/font][/color][color=#000000][font=Arial][size=4]the [/size][/font][/color][color=#000000][font=Arial][size=4]manifest.json[/size][/font][/color][color=#000000][font=Arial][size=4] file is created automatically.[/size][/font][/color]
[color=#000000][font=Arial][size=4]And if a theme is installed directly to the[/size][/font][/color][color=#000000][font=Arial][size=4] design/themes [/size][/font][/color][color=#000000][font=Arial][size=4]directory, it will work correctly with [/size][/font][/color][color=#000000][font=Arial][size=4]manifest.ini. [/size][/font][/color][color=#000000][font=Arial][size=4]Note that when cloning this theme, the new one will contain the [/size][/font][/color][color=#000000][font=Arial][size=4]manifest.json[/size][/font][/color][color=#000000][font=Arial][size=4] file.[/size][/font][/color]
[HR]
[color=#000000][font=Arial][size=4]Another one change concerning the themes: the new [/size][/font][/color][color=#000000][font=Arial][size=4]parent_theme[/size][/font][/color][color=#000000][font=Arial][size=4] parameter was added to the [/size][/font][/color][color=#000000][font=Arial][size=4]manifest.json[/size][/font][/color][color=#000000][font=Arial][size=4] (or [/size][/font][/color][color=#000000][font=Arial][size=4].ini[/size][/font][/color][color=#000000][font=Arial][size=4]) file.[/size][/font][/color]
[color=#000000][font=Arial][size=4]This parameter defines the existing theme which files will be taken as basic when installing the new theme.[/size][/font][/color]
[color=#000000][font=Arial][size=4]Earlier files were copied in the following order during the theme installation process:[/size][/font][/color][list]
[][color=#000000][font=Arial][size=4]Files from the [/size][/font][/color][color=#000000][font=Arial][size=4]var/themes_repository/basic [/size][/font][/color][color=#000000][font=Arial][size=4]directory.[/size][/font][/color]
[][color=#000000][font=Arial][size=4]Files from the [/size][/font][/color][color=#000000][font=Arial][size=4]var/themes_repository/my_custom_theme[/size][/font][/color][color=#000000][font=Arial][size=4]. Where [/size][/font][/color][color=#000000][font=Arial][size=4]my_custom_theme[/size][/font][/color][color=#000000][font=Arial][size=4] is the newly installed theme.[/size][/font][/color]
[/list]
[color=#000000][font=Arial][size=4]Now the order will be as follows:[/size][/font][/color][list]
[][color=#000000][font=Arial][size=4]Files from the [/size][/font][/color][color=#000000][font=Arial][size=4]parent_theme[/size][/font][/color][color=#000000][font=Arial][size=4] directory.[/size][/font][/color]
[][color=#000000][font=Arial][size=4]Files from the [/size][/font][/color][color=#000000][font=Arial][size=4]var/themes_repository/my_custom_theme[/size][/font][/color][color=#000000][font=Arial][size=4]. Where [/size][/font][/color][color=#000000][font=Arial][size=4]my_custom_theme[/size][/font][/color][color=#000000][font=Arial][size=4] is the newly installed theme.[/size][/font][/color]
[/list]
[color=#000000][font=Arial][size=4]If the [/size][/font][/color][color=#000000][font=Arial][size=4]parent_theme [/size][/font][/color][color=#000000][font=Arial][size=4]parameter is not defined, files will be copied from the [/size][/font][/color][color=#000000][font=Arial][size=4]var/themes_repository/basic [/size][/font][/color][color=#000000][font=Arial][size=4]directory as before. If it is defined but empty, basic files will not be copied. In this case only the files from the newly installed theme will be copied.[/size][/font][/color]
[size=5]HOOKS AND FUNCTIONS
===============================================[/size]
[color=#000000][font=Arial][size=4]The following hook was extended:[/size][/font][/color]
[color=#b22222][font=Arial][size=4]- fn_set_hook('sitemap_link', $link);[/size][/font][/color]
[color=#006400][font=Arial][size=4]+ fn_set_hook('sitemap_link', $link, $object, $value, $languages, $links);[/size][/font][/color]
[HR]
[color=#000000][font=Arial][size=4]Parameters of the following function were changed:[/size][/font][/color]
[color=#b22222][font=Arial][size=4]- function fn_merge_styles($files, $styles=[/size][/font][font=Arial][size=4], $prepend_prefix = [/size][/font][font=Arial][size=4], $params = array())[/size][/font][/color]
[color=#006400][font=Arial][size=4]+ function fn_merge_styles($files, $styles=[/size][/font][font=Arial][size=4], $prepend_prefix = [/size][/font][font=Arial][size=4], $params = array(), $area = AREA)[/size][/font][/color]
[HR]
[color=#000000][font=Arial][size=4]Parameters of the following function were changed: [/size][/font][/color]
[color=#b22222][font=Arial][size=4]- [/size][/font][font=Arial][size=4]function fn_get_file($filepath, $filename = )[/size][/font][/color]
[color=#006400][font=Arial][size=4]+ function fn_get_file($filepath, $filename = [/size][/font][font=Arial][size=4], $delete = false)[/size][/font][/color]
[color=#000000][font=Arial][size=4]Now it is possible to delete a file after receiving it.[/size][/font][/color]
[HR]
[color=#000000][font=Arial][size=4]Parameters of the following function were changed:[/size][/font][/color]
[color=#b22222][font=Arial][size=4]- function fn_get_dir_contents($dir, $get_dirs = true, $get_files = false, $extension = [/size][/font][font=Arial][size=4], $prefix = [/size][/font][font=Arial][size=4], $recursive = false)[/size][/font][/color]
[color=#006400][font=Arial][size=4]+ function fn_get_dir_contents($dir, $get_dirs = true, $get_files = false, $extension = [/size][/font][font=Arial][size=4], $prefix = [/size][/font][font=Arial][size=4], $recursive = false, $exclude = array())[/size][/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]The newly added hooks are not described here as before, only the ones that changed. Refer to our [/font][/color]Hook Base[color=#282828][font=arial, verdana, tahoma, sans-serif] to see all the hooks in all CS-Cart and Multi-Vendor versions. [/font][/color]