
Hello, everybody!
To help developers adapt their add-ons to the new versions of CS-Cart, 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.
It is planned to make such compilations before each CS-Cart and Multi-Vendor release.
We published this very first one after the release, but in the future we will try to make it in advance, so that you could have enough time to prepare your add-ons.
After the release you will be able to find these changes at docs.cs-cart.com.
If you want to add something to the compilation, feel free to write about it in the comments.
We will surely add it to the list.
CORE
=============================================
Now the “Add-ons” tab on the Vendor’s company editing page is displayed if there is any content to be displayed. Earlier this tab was disabled for vendors.
So, an add-on must check the content that is added by the following hook:
{hook name="companies:detailed_content"}{/hook}
----------------------------------------------------------------------------------------------------
The following parameters of the installLanguagePack function were changed:
app/Tygh/Languages/Languages.php
– public static function installLanguagePack($pack_path, $reinstall = false)
+ public static function installLanguagePack($pack_path, $params = array())
Now, using this function one should pass the parameters in the array:
$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:
app/Tygh/Pdf.php
– public static function batchRender($filename = , $save = false)
+ public static function batchRender($filename = , $save = false, $params = array())
– public static function render($html, $filename = , $save = false)
+ public static function render($html, $filename = '', $save = false, $params = array())
Now the page size can be defined in the $params:
$params = array( 'page_size' => 'A4' );
----------------------------------------------------------------------------------------------------
Be careful with such code:
– unset($cart['products'][$k]);
+ fn_delete_cart_product($cart, $k);
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. So, if your add-on is still using any functions or hooks relating to Google Checkout, remove them.
----------------------------------------------------------------------------------------------------
The parameters of the fn_check_added_required_products function were changed:
(app/addons/required_products/func.php)
–function fn_check_added_required_products(&$product_data, $auth, $added_products = array())
+function fn_check_added_required_products(&$product_data, $auth, &$cart, $added_products = array())
----------------------------------------------------------------------------------------------------
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). 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:
Registry::get('settings.General.redirect_to_cart’)
you should use:
Registry::get('config.tweaks.redirect_to_cart’)
----------------------------------------------------------------------------------------------------
In the fn_start_payment function, the $payment_info parameter is no longer mandatory.
–function fn_start_payment($order_id, $force_notification = array(), $payment_info)
+function fn_start_payment($order_id, $force_notification = array(), $payment_info = array())
----------------------------------------------------------------------------------------------------
The fn_error function is removed. Use the exceptions instead.
----------------------------------------------------------------------------------------------------
The fn_decompress_files($archive_name, $dirname = ‘’) function:
If $dirname is empty:
In CS-Cart and Multi-Vendor 4.1.3 $dirname has the getcwd() value.
In CS-Cart and Multi-Vendor 4.1.4 getcwd will be replaced with $dirname = Registry::get('config.dir.files’);
Now, the full path to the target directory is defined in the dirname param.
HOOKS CHANGES
=============================================
The following hooks were expanded:
– fn_set_hook('get_categories_after_sql', $categories);
+ fn_set_hook('get_categories_after_sql', $categories, $params);
– fn_set_hook('redirect_complete');
+ fn_set_hook('redirect_complete', $meta_redirect);
– fn_set_hook('get_categories_after_sql', $categories);
+ fn_set_hook('get_categories_after_sql', $categories, $params);
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.