Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    May 2012
    Posts
    564
    Plugin Contributions
    0

    Default Re: Yet Another Overrides Question

    Schoolboy, excellently explained. This shizzle is confusing, but I got it now!

  2. #12
    Join Date
    Aug 2004
    Location
    New York City
    Posts
    7,174
    Plugin Contributions
    0

    Default Re: Yet Another Overrides Question

    Yes, that was a very clear explanation, schoolboy (not that I expected less!).

    traytray, when I started with Zen Cart the hardest concept for me was the overrides. It took me a while to get the idea straight in my head. Once I did, it seems so simple to me I wondered why I had such a difficult time figuring it out.
    Mary Ellen
    I came; I saw; I Zenned
    Taking over the world... one website at a time
    Make sure brain is engaged before putting mouth in gear... or fingers to keyboard.

    Holzheimer
    Fan Odyssey

  3. #13
    Join Date
    May 2012
    Posts
    564
    Plugin Contributions
    0

    Default Re: Yet Another Overrides Question

    AFO, overrides are really tough to get a handle on for us new kids, but with people like you and schoolboy around, we will master it!

  4. #14
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Yet Another Overrides Question

    FWIW, you might be interested in my documentation "Plugin" that identifies the various opportunities for overrides (not just templates): http://www.zen-cart.com/downloads.ph...le&id=1393%29;

  5. #15
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Yet Another Overrides Question

    I think the key to understanding the "over-rides" system is to understand FIRSTLY, how zencart works with "custom" files.

    Zencart is not the only system that makes use of "customised" files... many platforms do so, but the principle is basically the same.

    Good developers of CMS platforms appreciate that people will want to make their sites "unique", or add special behaviours to the site. So they construct the platform to account for the possibility that such customisations will be made.

    The ORIGINAL platform will therefore comprise what are called CORE FILES (or DEFAULT files). These are all the code files that the program needs in order to function as intended, and they will reside in "default" folders (or locations). If these files are left alone, the program will function as designed (given that all other issues are running properly too - eg: the database).

    Good developers will also inform users what areas (files) are "safely customisable"... not all files have an "over-ride" capability. So while it is true that ANY file can be "customised", only SOME of them will be relevant to an "over-ride" system.

    In this context, appreciate that OVER-RIDE means that a custom file is being used IN PLACE OF an original file. Basically, the original file is copied, edited, then housed in an applicable over-ride folder. Thus your system has TWO files of the same name and purpose. The original file remains untouched and sits in its "default" location. The custom file has differences, and sits in a corresponding "over-ride" location.

    Files that do not have "over-ride" capacity CAN still be customised, but in such instances, the ORIGINAL (default) file is REPLACED by the edited file. So instead of having TWO files (one original, one custom), your system just has the ONE file, which when edited, REPLACES the core file entirely.

    It is not unusual to edit files that have no over-ride facility, but any core file treated in this way needs to be "managed" properly. For starters you should have an off-site backup of the ORIGINAL file, as well as its CUSTOM version, along with copious notes about why the edit was done, when it was done, and what the reasons are for the edit. (A "changelog", of sorts). I generally put in comment text into the code itself (firstly to identify the change I made, and secondly to specify why the change was made). I also put in a REFERENCE COMMENT, which helps greatly when doing upgrades. By looking for that unique reference in Developers Toolkit, I instantly get a full list of edited files - assisting greatly when time comes to upgrade.

    Now... back to the concept of "over-rides".

    Zencart works on the basis of FIRST looking for over-ride files in their respective over-ride locations (folders). If/when it finds a file that it needs in such a location, it uses that file, and IGNORES the original "default" file.

    If it does NOT find an over-ride file, then it reverts to the ORIGINAL file, which is in its default location.

    This is why it is only necessary to have copies of files in override locations that have been altered/edited. There is no need to put original files (unedited files) into over-ride folders... Zencart knows that if it can't find a file in an over-ride folder, it will then go fetch the original.

    In general (and there are some exceptions), zencart's over-ride system is based on the NAME given to a custom template. Now, appreciate also that "templates" are not just TEMPLATE (tpl_xxx_xxx.php) FILES... A template will also have MODULE and LANGUAGE files associated with it. These module and language files will be housed in folders bearing the name of the general "template" you are using, and this fits in nicely with the process of assembling a page by gathering up the relevant code from NAMED "over-ride" folders.

    The easiest way to determine if an over-ride possibility exists, is to look for places where the "classic" template has a folder.

    If there is a folder called "classic" in some location, then that location has over-ride capability, and you should have a folder named as your current template at the same directory level. These folders can remain empty UNTIL you have a need to make an edit to a file, at which point the edited file gets housed in the named folder.

    When setting up a ZC installation (and if I am not installing a pre-built template made by someone else), one of the first things I do is to go create my own "template" folders in all locations where I see a "classic" folder. Three are THREE MAIN AREAS where this happens:

    /includes/languages/
    /includes/modules/
    /includes/templates/

    In the case of MODULES and LANGUAGES, you will need to drill down through the directory trees to find all instances of "classic", as they appear in several SUB-directories in these locations.
    20 years a Zencart User

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Yet another Googlemaps question
    By mrcastle in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 11 May 2010, 10:11 PM
  2. Yet another SSL question..
    By Hazmat in forum Basic Configuration
    Replies: 4
    Last Post: 31 Oct 2007, 05:47 PM

Bookmarks

Posting Permissions

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