Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Adapt Your Add-Ons To Cs-Cart 4.1.3 Rate Topic   - - - - -

 
  • alexions
  • Architect
  • CS-Cart Architects
  • Join Date: 17-Jun 11
  • 39 posts

Posted 20 March 2014 - 07:51 AM #1

Attached File  ini2json.php   910bytes   282 downloads

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.
Alexander Zinovyev,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • cscartrocks
  • Member
  • Members
  • Join Date: 24-Jan 11
  • 1850 posts

Posted 20 March 2014 - 08:02 AM #2

Thanks for this info. Bookmarked.

One Step Checkout Addon - The ultimate checkout experience
Best CS-Cart SEO addon - CS-Cart SEO Ultimate Addon
PM for 365-day support and custom development service


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22818 posts

Posted 20 March 2014 - 08:42 AM #3

@alexions,

Thanks. Very helpful!

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 20 March 2014 - 07:30 PM #4

Excellent. Looking forward to being able to sync addon changes required for a new release when a new release becomes available rather than having it be a discovery process.

But just so you know, using fn_decompress_files($archive_name, './') still generates the _tmp file failure error notification, but the archive does seem to be extracted properly. "./" should be a valid path for the function.

Now, if changes to an addon.xml file processing could be picked up so that new parameters can be added and/or language values updated without having to uninstall/install an addon, it would be great! User should only have to 'Save' to pick up changes. Now, the control shows (if any) without any title field. I.e. a blank and a checkbox for a new checkbox entry in addon.xml.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • ThomH
  • Senior Member
  • Members
  • Join Date: 20-Nov 07
  • 1675 posts

Posted 21 March 2014 - 07:34 AM #5

Thank you. This will help us in add-ons compatibility check.

WebGraphiq offers a wide range of professionally developed, ready to use CS-Cart add-ons to provide additional functionality and boost your sales. The oldest active CS-Cart add-on development team. -- Since 2006 --


CS-CART ADD-ONS | FREE QUOTE | CS-CART DEVELOPMENT | @webgraphiq


 
  • alexions
  • Architect
  • CS-Cart Architects
  • Join Date: 17-Jun 11
  • 39 posts

Posted 21 March 2014 - 02:23 PM #6

Excellent.  Looking forward to being able to sync addon changes required for a new release when a n
ew release becomes available rather than having it be a discovery process.
 
But just so you know, using fn_decompress_files($archive_name, './') still generates the _tmp file
failure error notification, but the archive does seem to be extracted properly.  "./" should be a v
alid path for the function.

 
As we discussed before, you should use the full path or not specify it at all. The function gets it
 from getcwd(). (getcwd will be removed in 4.1.4). Yes, the backward compatibility was broken here,
 but this is default behaviour of the built-in Phar functionality.
 

Now, if changes to an addon.xml file processing could be picked up so that new parameters can be ad
ded and/or language values updated without having to uninstall/install an addon, it would be great!
  User should only have to 'Save' to pick up changes.  Now, the control shows (if any) without any
title field.  I.e. a blank and a checkbox for a new checkbox entry in addon.xml.

 
Add-ons use the default Settings system, so it is quite hard to check and create new structures on
every update.
I know that you use your upgrade system, so you can update your add-on the "Store import" way. Check
 the "Store import" add-on.
 
This way is:
1) Save values of settings
2) Delete all settings of the add-on
3) Create a new structure
4) Restore values
 
Thank you!
Alexander Zinovyev,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 21 March 2014 - 07:28 PM #7

Still like to know why using "./" as the path argument (rather than a full path) generates the error message about the _tmp file, but the archive extracts okay. I still contend that "./" is a valid "path" and that NO php library function should require a full path to operate properly. BTW, I have also seen the _tmp file failure message when using a full path for the path argument. It could be that there is a permissions problem at the site and the message is erroneous.

Regarding the settings.... When saved, the language variables should be updated as well as any 'function' tags that exist. Seems to me that the "system" should do what you suggest above for me rather than having me do that myself. You have all the info there between the existing settings and the xml information. Right now, the setting "control" is there (checkbox, input, radiogroup, etc.) but there is no title (I.e. if I added a checkbox item for "test mode", "test mode" will not display, but the checkbox will). I "think" that if I checked the box, that the setting is in fact applied. I'm more interested in new things that are added than deleting ones that no longer apply. It's certainly not critical, but would seem like a valuable extension for those of us who don't have the luxury of embedding support for our addons in the product release.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • alexions
  • Architect
  • CS-Cart Architects
  • Join Date: 17-Jun 11
  • 39 posts

Posted 25 March 2014 - 01:46 PM #8

Dear Tony,

Yes, you are actually right. The best way is to let the system make the necessary modifications automatically.
We will think about this point and how to help you and other developers to improve their add-ons.

Best wishes!
Alexander Zinovyev,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 25 March 2014 - 06:40 PM #9

Thanks... I know for me, that I make incremental changes and need to be able to account for 'additions' without having the user uninstall/install the addon (they could loose customizations if they do).

I already process language variables outside the addon.xml since this was a long-term need (all my controllers have a 'install_lang_vars' mode that can be done at anytime and is automatically done on upgrade). But having the ability to specify new addon settings for user selection in an updated addon.xml would be a big plus. Otherwise I have to move all the addon settings out of the addon.xml and into their own settings/manage pages which kind of defeats the purpose for the addon.xml.

Again, thanks for considering it.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • kkzhi
  • Newbie
  • Trial users
  • Join Date: 09-Mar 14
  • 5 posts

Posted 06 July 2015 - 01:27 AM #10

Hello may i know the documentation about paramenter can be used on render function?

I want to create custom packing slip(pdf) size

i try is :

$default_params = array(
		    'content' => $html,
		    //'page_size' => 'A4'
   'page_width' => '870px',
   'page_height' => '396px'
	    );

but the object / content was missing, maybe we must precisely set the margin / axis / something in that?

Thank you

 
  • imac
  • CEO
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 2077 posts

Posted 07 July 2015 - 07:54 PM #11

Hello may i know the documentation about paramenter can be used on render function?

I want to create custom packing slip(pdf) size

i try is :

$default_params = array(
			'content' => $html,
			//'page_size' => 'A4'
   'page_width' => '870px',
   'page_height' => '396px'
		);

but the object / content was missing, maybe we must precisely set the margin / axis / something in that?

Thank you


The PDF generator code is published at github: https://github.com/bzzeke/pdf
Hope this will help)
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug