Jump to content

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

Class includes for addons... Rate Topic   - - - - -

 
  • jagorny
  • Senior Member
  • Members
  • Join Date: 29-Nov 08
  • 226 posts

Posted 25 March 2013 - 04:57 AM #1

Hey folks,

So I'm working on a fairly complex Amazon integration and I am trying to establish the best place to put classes - I'd like to keep them separate in the addon because ultimately when they roll out API updates and update their models I'd like to be able to update them fairly easily.

However I am not entirely sure where/how to implement autoloading in 2.2.5 - the docs indicate that autoloading is already a feature in 3.0.x and that you simply need in include the classes you want in the 'core' subdirectory of the addon and name them class.ClassName.php - but for the 2.2.x what is the best way to set up an autoloader pull classes and where is that done from?

My gut says func.php and so I will try that tomorrow, but I hope another dev can share some experiences on pulling external class libraries into an add-on in a clean and nonobtrusive way.

Thanks in advance!
Jacob Gorny

www.orthodoxmarketplace.com - CS-Cart 2.2.4 Pro (Dedicated)

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

Posted 25 March 2013 - 05:27 AM #2

Doesn't really matter if the intent is that it be used in the addon's scope only. I'm not sure I understand the advantage of autoloading anyway. I'd rather be explicit when and where classes (or any other module) are loaded outside init.php or func.php which the addon does not have control over.

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.