Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Documentation on the Override System

Documentation on the Override System

Sticky

Views: 74,842

Results 21 to 40 of 41
18 Jul 2008, 7:45 AM
#21
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Documentation on the Override System

One More Question:

Everything I've seen in the FAQ and here on the board indicates that Override folders/files only need to be made where there's a "Classic" directory, and only when something is changed.

But the Zen book says to create Overrides in both the Classic and Template_Default directories and even goes so far as to explain how the structure is different for each.

Since these two instructions are opposite of each other, I'm left wondering which is the best one to follow?

Also, a quick suggestion: on the board and in the FAQ, under "First Steps", the Override System should be very first in line because it must be the first thing that's done before any customization.

I had to throw out all my changes and reinstall because I didn't understand this and followed the instructions of the steps in order. Posts on the Override System didn't come until several posts later and weren't even mentioned in the first steps.

Also, it should be made clear that the Override System is NECESSARY for anyone not wanting to redo their store every time they update. Right now the language isn't quite strong enough for us literal types :P

18 Jul 2008, 7:47 AM
#22
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

Re: Documentation on the Override System

barebones IS your override directory now. Everyplace that you need an override folder now (i.e. languages) you would use barebones as the override directory name. does that make sense? Any time you are reading and see "custom template", "Your template", etc you can replace that with barebones.

19 Jul 2008, 10:06 AM
#24
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Documentation on the Override System

DrByte, I downloaded that the other night before posting here, and that's about when my confusion started. I'm confused because I can't see how following that structure in any way relates back to the barebones template directory. However, I sincerely appreciate your effort to help point me in the right direction. If it were not for the addition of a second template directory, the visual aid you pointed me towards would have been exactly what I needed.


Barco, I understand what you're saying and thank you for your help. I probably should have been more clear originally. The only two files I'm struggling with in terms of understanding their role in the override system are the template_info.php and the stylesheet.css from the template directory.

What I don't understand is how copying & modifying the template_info.php and stylesheet.css files from the classic template will override the files from the barebones template just by naming them barebones. Especially when the new files are placed in the classic directory.

I can name a copied file or a directory anything I want, but that doesn't change the contents within that file or directory from its original. I would still be modifying the classic template's template_info.php and stylesheet.css files when what I want to modify are those same files from the barebones template directory.

In my limited understanding, it seems that I'm still starting off with the classic template and therefore modifying that template, rather than modifying the barebones template. Maybe I just don't get it.

Let me give you my understanding using the following scenario:

Let's say I never uploaded the barebones template and I follow the instructions for creating the override system.

By going in to the classic directory (which houses the classic template), copying any files I want to modify, and moving them into a new directory called "My Classic" (for example), I'm telling Zen "hey, don't look in Classic's usual directory. Look here instead". Right?

Ok, so then let's say Classic requires too many modifications to get the look I want, but barebones is closer and requires less change. So I upload the template. This template sits in a directory at the same level with Classic.

Yet, according to what I'm hearing, I still follow the same process. How can the system modify the CSS & template PHP files from the barebones directory when I'm working off the CSS & template php files I copied from the Classic directory? Wouldn't I still be modifying the Classic template using this method?

Wouldn't I need to copy the template_info.php and stylesheet.css from the barebones directory and use those as my new (for those two particular files only) in my new override system?

If the answer to that question is "yes", then I need to know where to copy them to, per my first post.

If the answer to that is "no", then alternatively, are you saying that by simply naming the override directories and files "barebones", that I'm telling the software to override the template_info.php and stylesheet.css from the barebones directory, and that it will do so, regardless of the fact that I'm making modifications to the template_info.php and stylesheet.css from the classic template, which are completely different files stored in completely different directories?

If the answer to this question is yes, then I'm all set and know what to do from here.

Actually, I would have one final question from here.

The Zen book says to use the override system anywhere I see "Classic" and "Template_Default". But all other documentation says to only use the override system where I see "Classic".

Which one of those is correct?

Thanks in advance for your kind help!

19 Jul 2008, 10:15 AM
#25
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Documentation on the Override System

You can have:

/includes/templates/template_default
/includes/templates/barebones
/includes/templates/classic
/includes/templates/redhat

Each is treated separately and distinctly from each other. The only "dependency" is that if the store needs a certain file and can't find it in your custom template's folder structure, it will look into template_default to get the master instead.

Inside each of those folders would be a template_info.php file ... which is essentially used to 'name' the template ... that file is used mainly by the admin ... and is the only file that "must" be present.

Inside each of those folders, if you choose to customize it, is a "css" folder with stylesheet files. You can create your own from scratch, or you could copy the one from /includes/templates/classic/css/stylesheet.css as a starting point ... putting it into your own new /includes/templates/redhat/css/ folder.

Each template needs a "template_info.php" file. You can copy the master one from template_default or from classic. Just change the contents inside the file to suit your template details.

The rest of the files will use template_default versions if you haven't supplied them. If you choose to alter anything from template_default, you should save it into your custom template's folder using the same folder naming structure from where you obtained the first file.

19 Jul 2008, 2:14 PM
#26
tshooters avatar

tshooters

Totally Zenned

Join Date:
Dec 2005
Posts:
1,037
Plugin Contributions:
2

Re: Documentation on the Override System

The Zen book says to use the override system anywhere I see "Classic" and "Template_Default".The book actually says you can determine where to put your overrides folders & files anywhere you see either a classic or template_default sub-folder. There's
only one template_default folder, and it's in includes/templates.

The tutorials you're reading are assuming you are creating your own template and gives a starting point by suggesting you use the stylesheet from either the includes/templates/classic or includes/templates/template_default, and the template_info.php file associated with whichever you chose. By installing the barebones template, this step has been done for you.

The chart shows that you have 10 places where you can put your barebones (your custom template) in includes/templates, includes/languages, and includes/modules. When you create those folders in languages and modules,
they should be named exactly as your barebones folder in includes/templates.

Hope this helps! I know I struggled with learning this.

19 Jul 2008, 7:08 PM
#27
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Documentation on the Override System

Hi TShooters ~

Thank you so much for your help! I think light may be dawning on marble head.

There's a few different ways my exhausted brain could interpret what you're saying, so I want to check my understanding with you real quickly.

I'm ok with the includes/languages and includes/modules, but this includes/templates/classic & includes/templates/template_default is just messing with my head.

So, with regard to includes/templates/classic & includes/templates/template_default only:

Are you saying that all I have to do is copy my barebones folder and add it anywhere I see either Classic or Template_Default subdirectories and that would serve as my override? And then any additional files I need to change within the directory/subdirectory structure can merely be copied into that folder?

OR

Are you saying that I should follow the override system as is, except for when it comes to template_info.php and stylesheet.css, in which case I should copy those from the barebones directory & subdirectory (instead of from the classic directory & template_default directory) and then place them in the override folder I would have created? (thereby replacing the CSS & PHP files found in both classic & template_default)

OR

Are you saying that I can just leave template_info.php & stylesheet.css in barebones where they're currently at and that by selecting the barebones template in the admin module, this is what tells zen to look in the barebones subdirectory within includes/templates?

And if the answer to that third option is a resounding YES, then here's my next question:

Is it accurate to say the following:

  1. There's no reason to create an override a level beneath classic or move any barebones files in to includes/templates/classic because classic and barebones folders have the exact same file structure (housing the CSS & the PHP file for their respective templates) and by telling zen via the admin module that my preferred template is barebones, zen will never look in classic for those files and so there's no reason to override them - that in fact, the installation of the barebones template created the override system for that level of the directory structure?

AND

  1. That since the override rule for includes/templates/template_default is to create an override at the same level, any files within template_default that would need updating would be copied up to the already existing barebones folder on the same level, and so therefore, there is no reason to have to move any copies of any barebones files to the template_default folder?

AND

  1. If numbers 1 & 2 are true, then it must also be true that since I already have an override folder at the includes/template level, simply by virtue of having installed the barebones template and therefore, there's really nothing for me to do but move on to setting up the overrides for the includes/modules and includes/languages.

Is that correct? Am I finally getting it or am I still waaaaay off base here?

19 Jul 2008, 7:36 PM
#28
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Documentation on the Override System

Are you saying that I can just leave template_info.php & stylesheet.css in barebones where they're currently at and that by selecting the barebones template in the admin module, this is what tells zen to look in the barebones subdirectory within includes/templates?

And if the answer to that third option is a resounding YES, then here's my next question:

Is it accurate to say the following:

  1. There's no reason to create an override a level beneath classic or move any barebones files in to includes/templates/classic because classic and barebones folders have the exact same file structure (housing the CSS & the PHP file for their respective templates) and by telling zen via the admin module that my preferred template is barebones, zen will never look in classic for those files and so there's no reason to override them - that in fact, the installation of the barebones template created the override system for that level of the directory structure?

AND

  1. That since the override rule for includes/templates/template_default is to create an override at the same level, any files within template_default that would need updating would be copied up to the already existing barebones folder on the same level, and so therefore, there is no reason to have to move any copies of any barebones files to the template_default folder?

AND

  1. If numbers 1 & 2 are true, then it must also be true that since I already have an override folder at the includes/template level, simply by virtue of having installed the barebones template and therefore, there's really nothing for me to do but move on to setting up the overrides for the includes/modules and includes/languages.

:clap: The Penny has dropped!

19 Jul 2008, 7:57 PM
#29
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Documentation on the Override System

omg seriously? :shocking: I get it?? :shocking:

::falls face first into the keyboard and laughs the maniacal laugh known only to fellow insanely exhausted geeks who spend way too much time playing with software...and waits....diligently....for someone to come home and mainline some champagne into a major blood vessel::: :wacko:

You guys...thank you so much! Everyone's input was like a cog that helped the wheels in my tiny brain inch forward until it all finally came together.

You all have the patience of a dozen saints!

:::Running away into Zen bliss::: :smartalec:

(for now)

20 Jul 2008, 3:36 AM
#30
tshooters avatar

tshooters

Totally Zenned

Join Date:
Dec 2005
Posts:
1,037
Plugin Contributions:
2

Re: Documentation on the Override System

By golly, I think you've got it! :clap:

20 Jul 2008, 6:07 AM
#31
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

Re: Documentation on the Override System

Brings a tear to my eye when they leave the nest for their first flight......

20 Jul 2008, 8:58 AM
#32
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Documentation on the Override System

barco57:

Brings a tear to my eye when they leave the nest for their first flight......

LOL ... you do have a way with words, Mike !! :P

21 Jul 2008, 9:25 AM
#33
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Documentation on the Override System

LOL thanks again everyone!

6 Oct 2008, 4:56 AM
#34
cslactrn avatar

cslactrn

New Zenner

Join Date:
Oct 2008
Posts:
1
Plugin Contributions:
0

Re: Documentation on the Override System

Unfortunately, I read this after I have already done a good bit of customization on the classic template.

Would it be possible for me to just copy the classic folder that I have customized and name it classic_new or something like that?

Would that then be my "override" folder?

And then the includes/languages/english/classic/header.php file would be put in that classic_new folder? Or would I make an includes/languages/english/classic_new/ folder and put the header.php file that I've customized into that?

The same with any file that I've customized that has to do with the classic template?

Am I getting it? LOL... I'd just hate to think that all the work I've done so far would be wasted if I upgrade.

Thanks for any advice.

20 Apr 2009, 3:38 AM
#35
afo avatar

afo

Totally Zenned

Join Date:
Aug 2004
Location:
New York City
Posts:
6,800
Plugin Contributions:
0

Re: Documentation on the Override System

cslactrn:

Or would I make an includes/languages/english/classic_new/ folder and put the header.php file that I've customized into that?

The same with any file that I've customized that has to do with the classic template?

Am I getting it? LOL... I'd just hate to think that all the work I've done so far would be wasted if I upgrade.

Thanks for any advice.

Yes, that's the idea. If you know what file you modified, you can copy them into folders for your custom template.

29 Mar 2010, 10:32 AM
#36
g1smd avatar

g1smd

Zen Follower

Join Date:
Mar 2010
Location:
UK
Posts:
449
Plugin Contributions:
0

Re: Documentation on the Override System

Why does, what seems like, straight forward processes have to be chopped up into hundreds of disparate bits and pieces that make it impossible to see the big picture? Why? Why?

The overall process of getting a page of content to display includes

  • examing the URL request
  • getting stuff from the database
  • assembling the HTML header
  • assembling the navigation bar
  • assembling links to images
  • assembling the on-page content
  • grabbing the language-dependant buttons and links
  • sending the page to thebrowser

You have to do all of the database stuff before you send anything out to the browser, therefore stuff will be spread out through several parts of the code.

A large number of blog and cart systems start sending HTML out to the browser before they have even decided which records to read from the database. Those systems are unable to send a proper 404 error when there is nothing in the database for the requested page number!

ZenCart, like many other advanced web applications, is a very intricate system catering for a wide variety of e-comm needs, and for most people various functions and chunks of template will be discarded.

Additionally, if the code were one long file it would be impossible to work on.

6 Aug 2012, 12:26 PM
#37
kobiadato avatar

kobiadato

New Zenner

Join Date:
Aug 2005
Posts:
25
Plugin Contributions:
0

Re: Documentation on the Override System

Hi i was wondering if i can override tpl.header. I tried many stuff but only with override the actual file is working for me..any ideas?

6 Aug 2012, 3:55 PM
#38
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Documentation on the Override System

Yes. Overriding /includes/templates/template_default/common/tpl_header.php is as simple as copying that file to your own custom template folder and making the changes there.
ie: put the file at /includes/templates/NAME_OF_YOUR_TEMPLATE_FOLDER/common/tpl_header.php

7 Aug 2012, 6:15 AM
#39
kobiadato avatar

kobiadato

New Zenner

Join Date:
Aug 2005
Posts:
25
Plugin Contributions:
0

Re: Documentation on the Override System

DrByte:

Yes. Overriding /includes/templates/template_default/common/tpl_header.php is as simple as copying that file to your own custom template folder and making the changes there.
ie: put the file at /includes/templates/NAME_OF_YOUR_TEMPLATE_FOLDER/common/tpl_header.php

Hi. Well i do have already my own custom template so my directory is: includes/templates/enk_sales/common/tpl_header.php so i guess i should just make changes there and thats it. I just wanted to not override my own custom template just in case i make a coding mistake. BUt i guess the best way is just to rename the file im changing and upload the new one...
Do you have a better way maybe?

Also another small question. When i upload products images do i upload them to /images/large and also /images/medium because i did upload them to just the images folder it self and i had to create another images folder inside the image for me to see them in the store. images/images...
Thanks

1 Dec 2013, 8:46 PM
#40
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Documentation on the Override System

g1smd:

if the code were one long file it would be impossible to work on.

So, I am wondering, how is the code otherwise "visualized" to possibly track down issues? I realize there are those that see the code, recognize the compartmentalization and can relatively quickly determine the status of a given object, but I was wondering if there is some sort of object oriented visualization of what files are loaded, a long view of the code at the point of execution, that sort of thing. I hoof it out like what I think others do, starting at what I see working back to what created it. I guess I just remember the good ole days when programs were a mere few thousand lines long, whereas ZC is probably on the order of a few 100 thousand at any given time.

I guess wondering if there is a php parser/assembler that would plugin all of the dependencies given a known starting point I currently use NetBeans to do my code work, but I'm wondering if the debug option (when properly setup) would give more of what I'm looking for?