Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2012
    Plugin Contributions

    Default Plugin mod approaches

    I'm making some modifications to a plugin and would like to minimize changes to the plugin by keeping the majority of my changes elsewhere. Currently, I'm adding code to a function (method) within a class. I've put my code in a file and call it through a require statement. Where is the recommended location for the file? It's not technically a function, since it's only part of a function. Should it nevertheless be put in extra_functions? Or somewhere else?

    Another approach might be to create a notifier-observer, but no notifiers exist in this method. What is involved with adding custom notifiers in the desired places, and locate the plugin mods in observers? Would calling a notifier class within another class method work? (Still uncomfortable with OOP and it's jargon, but learning!).

    What is best practice in this case?

    Thanks for any advice.

  2. #2
    Join Date
    Dec 2016
    Plugin Contributions

    Default Re: Plugin mod approaches

    Everything you need, you can find here:

  3. #3
    Join Date
    Jul 2012
    Plugin Contributions

    Default Re: Plugin mod approaches

    So you've got a couple of things going on here. Good that looking into it.

    First of all a function IS a function, but in this case it appears that the intent is to either override a class' method (function) or to modify an existing function (by way of a notifier). Which way this is done is open to debate and in part depends on how much of a change is being done as compared to the base code, what it would take to maintain it and anticipated changes in the future. Ideally, the plugin could be updated to include the notifier(s) to be added (suggest speaking with original author before just making the change.)

    As to if a notifier is used, if the parent class extends base, then could add a notifier like: $this->notify('NOTIFIER_NAME_FOR_THIS_NOTIFIER', array(), $param1, $param2, etc...); though some of this format also depends on the proposed ZC version compatibility to consider. And yes a notifier can exist inside of some other function, code, or other area provided that the notifier system has been loaded at a point prior to where/when the code is loaded.

    As far as some form of abstraction to override the existing function, well generally would think knowing more about the conditions would help to further advise.

    As far where all this gets stored, well edging on class related code and or init_includes related. It pretty much depends on structure and usage.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...



Similar Threads

  1. v151 Is there a mod/plugin to do this??
    By CunningStunt in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 1 Sep 2013, 03:46 AM
  2. Replies: 3
    Last Post: 21 Feb 2013, 01:36 PM
  3. Local Sales Tax Mod and Reward Points Mod
    By retched in forum Addon Payment Modules
    Replies: 1
    Last Post: 9 Feb 2011, 02:09 AM
  4. Adsmartmenus mod and zen lightbox mod compatibility issue
    By jdw1979 in forum Addon Sideboxes
    Replies: 5
    Last Post: 6 Aug 2009, 07:50 PM
  5. Stock by Attributes Mod with Time Zone Offset Mod
    By xman888 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 5 Aug 2007, 05:08 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Zen-Cart, Internet Selling Services, Klamath Falls, OR