Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Posts
    133
    Plugin Contributions
    1

    Default Specials Display - can this file have an override?

    main_page=specials

    It appears that some of the html formatting for the Specials page (for each individual product displayed) is done by this file:

    includes/modules/pages/specials/main_template_vars.php

    Is it possible to override this file for your own Templates? Where would you put it?

  2. #2
    Join Date
    Apr 2008
    Posts
    133
    Plugin Contributions
    1

    Default Re: Specials Display - can this file have an override?

    I found the answer here in this thread:

    https://www.zen-cart.com/showthread....plate_vars-php

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Specials Display - can this file have an override?

    One could also use the notifier/observer system to address overriding the code obtained from includes/templates/YOUR_TEMPLATE/common/main_template_vars.php assuming it has been updated with applicable changes from the template_default directory.

    There are two notifiers, one when coming into the file where the $template_dir is provided and the $current_base could be obtained, then there is one at the end that passes the editable $body_code. There are a few different directions one could go with this.

    Could temporarily substitute the $current_page_base with one that doesn't exist, but for which the associated tpl_ file does. Then change it back when leaving the code. (con to this is if any other observer is loaded and expects to properly use the variable, then load sequence would be a concern).
    At the conclusion of execution could use the exit notifier to set/reset the $body_code to whatever desired file if the $current_page_base is 'specials' and the $template_dir is 'my_template'. Could go and load additional files without "undoing" other things if the $current_page_base is 'specials' and $template_dir is 'my_template' or just in general or when loading the specials page.

    In this way an additional file check would not be needed for each page load like is suggested in the other thread, but instead one or more variable checks with whatever action to follow and no template directory override. Just saying that there are ways without digging into code that would have to be compared against for the next version, though the code would still need to be reviewed to be sure it was compatible or needed changes.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Specials Display - can this file have an override?

    You can also override that by creating a file named /includes/templates/YOUR_TEMPLATE/specials/main_template_vars.php.

    Going with that approach, you totally override the main_template_vars.php processing specified in /includes/modules/pages/specials.

 

 

Similar Threads

  1. v139h Can I Make An Override Of This File?
    By traytray in forum General Questions
    Replies: 2
    Last Post: 12 Jan 2013, 08:27 PM
  2. v139f Can't seem to override checkout_confirmation.php language file
    By WhitePhantom in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 1 Feb 2012, 02:04 PM
  3. Replies: 2
    Last Post: 8 Jun 2010, 01:25 AM
  4. Override this file or not?
    By pb4 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 26 May 2010, 11:35 AM

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