[attachment=7845:ini2json.php]
[color=#000000][font=Arial][size=4]Hello, everybody![/size][/font][/color]
[color=#000000][font=Arial][size=4]To help developers adapt their add-ons to the new versions of CS-Cart, [/size][/font][/color]we decided to list the changes between the current and the previous versions of CS-Cart on every new release.
So, if your add-on deals with the CS-Cart code, please pay attention to this material.
[color=#000000][font=Arial][size=4]It is planned to make such compilations before each CS-Cart and Multi-Vendor release.[/size][/font][/color]
[color=#000000][font=Arial][size=4]We published this very first one after the release, but in the future we will try to make it in advance, [/size][/font][/color]so that you could have enough time to prepare your add-ons.
[color=#000000][font=Arial][size=4]After the release you will be able to find these changes at docs.cs-cart.com.[/size][/font][/color]
[color=#000000][font=Arial][size=4]If you want to add something to the compilation, [/size][/font][/color]feel free to write about it in the comments[color=#000000][font=Arial][size=4].[/size][/font][/color]
[color=#000000][font=Arial][size=4]We will surely add it to the list.[/size][/font][/color]
[size=5][color=#000000][font=Arial]CORE[/font][/color][/size]
[color=#000000][font=Arial][size=5]​=============================================[/size][/font][/color]
Now the “Add-ons†tab on the Vendor’s company editing page is displayed if there is any content to be displayed[color=#000000][font=Arial]. Earlier this tab was disabled for vendors.[/font][/color]
So, an add-on must check the content that is added by the following hook:
[color=#000000][font=Arial]{hook name="companies:detailed_content"}{/hook}
[/font][/color]
----------------------------------------------------------------------------------------------------
[color=#000000][font=Arial]The following parameters of the installLanguagePack function were changed:[/font][/color]
[color=#000000][font=Arial]app/Tygh/Languages/Languages.php[/font][/color]
[color=#b22222][font=Arial]– public static function installLanguagePack($pack_path, $reinstall = false)[/font][/color]
[color=#006400][font=Arial]+ public static function installLanguagePack($pack_path, $params = array())[/font][/color]
[color=#000000][font=Arial]Now, using this function one should pass the parameters in the array:[/font][/color]
$params = array(
'reinstall' => false, // Skip adding new language
'validate_lang_code' => , // Check meta information (lang_code) with updated language data (lang_code) and forbid to update if does not match
);
----------------------------------------------------------------------------------------------------
Parameters of the batchRender and render functions of the Pdf class were also changed:
[color=#000000][font=Arial]app/Tygh/Pdf.php[/font][/color]
[color=#b22222][font=Arial]– public static function batchRender($filename = , $save = false)[/font][/color]
[color=#006400][font=Arial]+ public static function batchRender($filename = , $save = false, $params = array())[/font][/color]
[color=#b22222][font=Arial]– public static function render($html, $filename = , $save = false)[/font][/color]
[color=#006400][font=Arial]+ public static function render($html, $filename = '', $save = false, $params = array())[/font][/color]
Now the page size can be defined in the $params:
$params = array(
'page_size' => 'A4'
);
----------------------------------------------------------------------------------------------------
[color=#000000][font=Arial]Be careful with such code:[/font][/color]
[color=#b22222][font=Arial]– unset($cart['products'][$k]);[/font][/color]
[color=#008000][font=Arial]+ fn_delete_cart_product($cart, $k);[/font][/color]
A product is be removed from cart with the fn_delete_cart_product function; unsetting the state isn't enough.
----------------------------------------------------------------------------------------------------
All Google Checkout-related code was removed[color=#000000][font=Arial]. So, if your add-on is still using any functions or hooks relating to Google Checkout, remove them.[/font][/color]
----------------------------------------------------------------------------------------------------
[color=#000000][font=Arial]The parameters of the [/font][/color][color=#000000][font=Arial]fn_check_added_required_products [/font][/color][color=#000000][font=Arial]function were changed:[/font][/color]
[color=#000000]font=Arial[/font][/color]
[color=#b22222][font=Arial]–function fn_check_added_required_products(&$product_data, $auth, $added_products = array())[/font][/color]
[color=#006400][font=Arial]+function fn_check_added_required_products(&$product_data, $auth, &$cart, $added_products = array())[/font][/color]
----------------------------------------------------------------------------------------------------
Now, theme manifest is stored in the manifest.json file instead of manifest.ini. (We plan to provide the legacy manifest.ini support in CS-Cart and Multi-Vendor 4.1.4).[color=#000000][font=Arial] [/font][/color]Use the attached script to convert existing manifest.ini files to manifest.json in your themes. Place the script into the root directory of your installation and launch it.
----------------------------------------------------------------------------------------------------
Registry entry settings.General is now referred to as config.tweaks. Instead of:
[color=#b22222][font=Arial]Registry::get('settings.General.redirect_to_cart’) [/font][/color]
you should use:
[color=#006400][font=Arial]Registry::get('config.tweaks.redirect_to_cart’)[/font][/color]
----------------------------------------------------------------------------------------------------
In the fn_start_payment function, the $payment_info parameter is no longer mandatory.
[color=#b22222][font=Arial]–function fn_start_payment($order_id, $force_notification = array(), $payment_info)[/font][/color]
[color=#006400][font=Arial]+function fn_start_payment($order_id, $force_notification = array(), $payment_info = array())[/font][/color]
----------------------------------------------------------------------------------------------------
[color=#000000][font=Arial]The [/font][/color][color=#000000][font=Arial]fn_error[/font][/color][color=#000000][font=Arial] function is removed. Use the exceptions instead.[/font][/color]
----------------------------------------------------------------------------------------------------
[color=#000000][font=Arial]The [/font][/color][color=#000000][font=Arial]fn_decompress_files($archive_name, $dirname = ‘’) [/font][/color][color=#000000][font=Arial]function:[/font][/color]
[color=#000000][font=Arial]If [/font][/color][color=#000000][font=Arial]$dirname[/font][/color][color=#000000][font=Arial] is empty:[/font][/color]
[color=#000000][font=Arial]In CS-Cart and Multi-Vendor 4.1.3 [/font][/color][color=#000000][font=Arial]$dirname[/font][/color][color=#000000][font=Arial] has the[/font][/color][color=#000000][font=Arial] getcwd()[/font][/color][color=#000000][font=Arial] value.[/font][/color]
[color=#000000][font=Arial]In CS-Cart and Multi-Vendor 4.1.4 [/font][/color][color=#000000][font=Arial]getcwd[/font][/color][color=#000000][font=Arial] will be replaced with [/font][/color][color=#000000][font=Arial]$dirname = Registry::get('config.dir.files’);[/font][/color]
Now, the full path to the target directory is defined in the dirname param.
[size=5][color=#000000][font=Arial]HOOKS CHANGES[/font][/color][/size]
[size=5][color=#000000][font=Arial]=============================================[/font][/color][/size]
[color=#000000][font=Arial]The following hooks were expanded:[/font][/color]
[color=#b22222][font=Arial]– fn_set_hook('get_categories_after_sql', $categories);[/font][/color]
[color=#006400][font=Arial]+ fn_set_hook('get_categories_after_sql', $categories, $params);[/font][/color]
[color=#b22222][font=Arial]– fn_set_hook('redirect_complete');[/font][/color]
[color=#006400][font=Arial]+ fn_set_hook('redirect_complete', $meta_redirect);[/font][/color]
[color=#b22222][font=Arial]– fn_set_hook('get_categories_after_sql', $categories);[/font][/color]
[color=#006400][font=Arial]+ fn_set_hook('get_categories_after_sql', $categories, $params);[/font][/color]
The newly added hooks are not described here, only the ones that changed. Refer to our Hook Base to see all the hooks in all CS-Cart and Multi-Vendor versions.