<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Zen Cart Documentation – Storefront</title>
    <link>https://docs.zen-cart.com/dev/storefront/</link>
    <description>Recent content in Storefront on Zen Cart Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="https://docs.zen-cart.com/dev/storefront/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Dev: Bootstrap in Zen Cart</title>
      <link>https://docs.zen-cart.com/dev/storefront/bootstrap/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/bootstrap/</guid>
      <description>
        
        
        &lt;h2 id=&#34;bootstrap-in-the-bootstrap-template&#34;&gt;Bootstrap in the Bootstrap Template&lt;/h2&gt;
&lt;p&gt;Bootstrap template version 3.X is based on &lt;a href=&#34;https://getbootstrap.com/docs/4.6/getting-started/introduction/&#34;&gt;Bootstrap 4&lt;/a&gt;.  You can find the exact version of Bootstrap (&lt;code&gt;major.minor.patch&lt;/code&gt;) in use by looking at the file &lt;code&gt;includes/templates/bootstrap/common/html_header.php&lt;/code&gt;, which pulls in the Bootstrap javascript and css.&lt;/p&gt;
&lt;p&gt;The Bootstrap template is described in more detail in the &lt;a href=&#34;https://docs.zen-cart.com/user/template/bootstrap/&#34;&gt;storefront documentation on Bootstrap template&lt;/a&gt;.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bootstrap Version&lt;/th&gt;
&lt;th&gt;Storefront Bootstrap Template&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BS 4.6.2&lt;/td&gt;
&lt;td&gt;Template Version 3.X&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;bootstrap-in-zen-cart-admin&#34;&gt;Bootstrap in Zen Cart Admin&lt;/h2&gt;
&lt;p&gt;Bootstrap has been used in the Zen Cart admin since Zen Cart version 1.5.5.
The following chart shows the association between Bootstrap and Zen Cart versions.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bootstrap Version&lt;/th&gt;
&lt;th&gt;Zen Cart Admin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BS 3.4.1&lt;/td&gt;
&lt;td&gt;ZC 1.5.6-2.2.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BS 3.3.7&lt;/td&gt;
&lt;td&gt;ZC 1.5.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;There is work underway to move the Zen Cart admin to Bootstrap 5.
You may follow this effort by monitoring &lt;a href=&#34;https://github.com/zencart/zencart/pull/6173&#34;&gt;this PR&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;bootstrap-in-zc_install&#34;&gt;Bootstrap in zc_install&lt;/h2&gt;
&lt;p&gt;Bootstrap has been used in the Zen Cart upgrader (&lt;code&gt;zc_install&lt;/code&gt;) since Zen Cart version 2.1.0.
The following chart shows the association between Bootstrap and Zen Cart versions.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bootstrap Version&lt;/th&gt;
&lt;th&gt;Zen Cart zc_install&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BS 5.3.3&lt;/td&gt;
&lt;td&gt;ZC 2.1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;help-on-bootstrap&#34;&gt;Help on Bootstrap&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://getbootstrap.com/docs/5.0/&#34;&gt;Bootstrap 5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://getbootstrap.com/docs/4.6/&#34;&gt;Bootstrap 4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://getbootstrap.com/docs/3.3/&#34;&gt;Bootstrap 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Dev: Building a Form</title>
      <link>https://docs.zen-cart.com/dev/storefront/forms/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/forms/</guid>
      <description>
        
        
        &lt;p&gt;Adding a custom form to your site is a common customization.  There are a few guidelines for when you do this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Always &lt;a href=&#34;https://docs.zen-cart.com/dev/plugins/upgrading_to_1.5/#rewriting-addon-admin-pages-to-use-form-posts-instead-of-gets&#34;&gt;submit your form data using POST&lt;/a&gt;. Never use GET for forms. (There are exceptions of course, but if you don&amp;rsquo;t already grok best practices for that, then never use GET for forms!)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;zen_draw_form&lt;/code&gt;, not the HTML &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag.  Note that when you use &lt;code&gt;zen_draw_form&lt;/code&gt;, you get the &lt;code&gt;securityToken&lt;/code&gt; with no extra work.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.zen-cart.com/dev/database/database_querying/&#34;&gt;Sanitize your inputs&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A good model for all of this is the Ask a Question feature, which has been part of Zen Cart since 1.5.7.  See the following files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;includes/modules/pages/ask_a_question/header_php.php&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;includes/templates/template_default/templates/tpl_ask_a_question_default.php&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;alternative-approach---use-a-form-builder&#34;&gt;Alternative Approach - Use a Form Builder&lt;/h3&gt;
&lt;p&gt;Another option which is highly recommended for storeowners who don&amp;rsquo;t have a developer is to use a form building tool like &lt;a href=&#34;https://www.wufoo.com/&#34;&gt;Wufoo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A Wufoo form can easily be embedded on a extra define page (page_2, page_3, page_4) or an existing page like Contact Us.  In the case of Contact Us, you would just edit the template file (&lt;code&gt;includes/templates/YOURTEMPLATE/templates/tpl_contact_us_default.php&lt;/code&gt;) and replace the built-in form with the script from Wufoo.  Similarly, using a define page would just mean editing the template file and inserting the script below the &lt;code&gt;content&lt;/code&gt; div.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Dev: Displaying Custom Fields</title>
      <link>https://docs.zen-cart.com/dev/storefront/displaying_custom_fields/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/displaying_custom_fields/</guid>
      <description>
        
        
        &lt;p&gt;Once you have finished adding a field to the database, you will need to figure out where you want to display it, and write the code to do that.   Here are some guidelines.&lt;/p&gt;
&lt;h2 id=&#34;case-1-new-field-in-products-table&#34;&gt;Case 1: New field in products table&lt;/h2&gt;
&lt;p&gt;a) Adding the new field to the &lt;a href=&#34;https://docs.zen-cart.com/user/products/product_info/&#34;&gt;product_info page&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;code&gt;includes/modules/pages/product_info/main_template_vars.php&lt;/code&gt; to retrieve the field and create a variable to store it.&lt;/li&gt;
&lt;li&gt;Modify &lt;code&gt;includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php&lt;/code&gt; to show the variable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;b) Adding the new field to the &lt;a href=&#34;https://docs.zen-cart.com/user/template/product_listing_page_configuration/&#34;&gt;product listing&lt;/a&gt; page:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;code&gt;includes/modules/pages/index/main_template_vars.php&lt;/code&gt; to retrieve the new field.&lt;/li&gt;
&lt;li&gt;Modify &lt;code&gt;includes/modules/YOURTEMPLATE/product_listing.php&lt;/code&gt; to display the field.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(Some people shortcut this process by skipping the first file and just doing the query in the second file.)&lt;/p&gt;
&lt;h2 id=&#34;case-2-new-field-in-orders-table&#34;&gt;Case 2: New field in orders table&lt;/h2&gt;
&lt;p&gt;If you add a field to the orders table which is set during order creation, add the field to &lt;code&gt;includes/classes/order.php&lt;/code&gt; in the &lt;code&gt;query()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;Then you can reference it as needed in&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tpl_account_default.php&lt;/li&gt;
&lt;li&gt;tpl_account_history_default.php&lt;/li&gt;
&lt;li&gt;tpl_account_history_info_default.php&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On the admin side, you may also wish to reference it in&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;admin/invoice.php&lt;/li&gt;
&lt;li&gt;admin/orders.php&lt;/li&gt;
&lt;li&gt;admin/packingslip.php&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the &lt;code&gt;query()&lt;/code&gt; method from &lt;code&gt;includes/classes/order.php&lt;/code&gt;, add it to whatever array makes sense (&lt;code&gt;info&lt;/code&gt;, &lt;code&gt;customer&lt;/code&gt;, or &lt;code&gt;delivery&lt;/code&gt;), then reference it in any of the files above the same way other fields in that array are referenced.&lt;/p&gt;
&lt;h2 id=&#34;related-articles&#34;&gt;Related Articles&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.zen-cart.com/dev/database/add_field_products/&#34;&gt;Adding a field to the products table&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Dev: Font Awesome in Zen Cart</title>
      <link>https://docs.zen-cart.com/dev/storefront/font_awesome/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/font_awesome/</guid>
      <description>
        
        
        &lt;p&gt;The &lt;a href=&#34;https://fontawesome.com/&#34;&gt;Font Awesome library&lt;/a&gt; provides a set of vector icons and social logos for your website.   It is one of the most popular icon sets available. See &lt;a href=&#34;https://docs.zen-cart.com/user/template/font_awesome/&#34;&gt;Font Awesome&lt;/a&gt; for storeowner docs.&lt;/p&gt;
&lt;h2 id=&#34;font-awesome-versions-in-zen-cart&#34;&gt;Font Awesome Versions in Zen Cart&lt;/h2&gt;
&lt;p&gt;Both the admin and provided storefront templates (&lt;code&gt;template_default&lt;/code&gt; and &lt;code&gt;responsive_classic&lt;/code&gt;) use the same version.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Font Awesome 6.4 is included in Zen Cart 2.0.0 and above.&lt;/li&gt;
&lt;li&gt;Font Awesome 4.7 is included in Zen Cart 1.5.5-1.5.8.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;font-awesome-versions-in-the-bootstrap-template&#34;&gt;Font Awesome Versions in the Bootstrap Template&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;https://docs.zen-cart.com/user/template/bootstrap/&#34;&gt;Bootstrap template&lt;/a&gt; uses its own version of Font Awesome, which may not be the same as the version used by &lt;code&gt;template_default&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bootstrap template version 3.5.0 and above uses Font Awesome 5.15.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;font-awesome-help-and-icons&#34;&gt;Font Awesome Help and Icons&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Help&lt;/th&gt;
&lt;th&gt;Icons&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v6/docs&#34;&gt;Font Awesome 6 Help&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v6/search&#34;&gt;Font Awesome 6 icons&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v5/docs&#34;&gt;Font Awesome 5 Help&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v5/search&#34;&gt;Font Awesome 5 icons&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v4.7.0/&#34;&gt;Font Awesome 4.7 Help&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&#34;https://fontawesome.com/v4/icons/&#34;&gt;Font Awesome 4.7 icons&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;backwards-compatibility&#34;&gt;Backwards Compatibility&lt;/h2&gt;
&lt;p&gt;In Zen Cart 2.0.0 and above, for backwards compatibility with plugins that have not yet been updated, by default, the &lt;a href=&#34;https://fontawesome.com/v5/docs/web/setup/upgrade-from-v4&#34;&gt;Font Awesome v4 shim&lt;/a&gt; is loaded so that older Font Awesome classes may be used.  Loading the shim can be switched off in the &lt;a href=&#34;https://docs.zen-cart.com/user/admin/site_specific_overrides/&#34;&gt;site specific overrides&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;An example of the kind of change that needs to be made to older code to go from V4 to V6 is shown in this image:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://docs.zen-cart.com/images/fa_6.png&#34; alt=&#34;Font Awesome Migration&#34;&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Dev: jQuery in Zen Cart</title>
      <link>https://docs.zen-cart.com/dev/storefront/jquery/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/jquery/</guid>
      <description>
        
        
        &lt;h2 id=&#34;jquery-in-the-zen-cart-storefront&#34;&gt;jQuery in the Zen Cart Storefront&lt;/h2&gt;
&lt;p&gt;The use of jQuery in the Zen Cart storefront is very much
template dependent, with each template making its own choices.&lt;/p&gt;
&lt;p&gt;Template Default in general will use the same version as the admin does.&lt;/p&gt;
&lt;p&gt;To see which jQuery version your template uses, look at &lt;code&gt;includes/templates/YOUR_TEMPLATE/common/html_header.php&lt;/code&gt;.  You will see something like&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;script src=&amp;#34;https://code.jquery.com/jquery-3.6.1.min.js&amp;#34; integrity=&amp;#34;sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=&amp;#34; crossorigin=&amp;#34;anonymous&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;which shows you version 3.6.1 is in use.&lt;/p&gt;
&lt;p&gt;You can also open a browser window to the storefront, open the Chrome Developer Tools console and type&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jQuery().jquery
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;to see the jQuery version.&lt;/p&gt;
&lt;h2 id=&#34;jquery-in-zen-cart-admin&#34;&gt;jQuery in Zen Cart Admin&lt;/h2&gt;
&lt;p&gt;jQuery has been used in the Zen Cart admin since Zen Cart version 1.5.5.
The following chart shows the association between jQuery and Zen Cart versions.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;jQuery&lt;/th&gt;
&lt;th&gt;Zen Cart Admin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;jQuery 3.7.1&lt;/td&gt;
&lt;td&gt;ZC 2.1.0-2.2.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery 3.6.1&lt;/td&gt;
&lt;td&gt;ZC 1.5.8-2.0.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery 3.5.1&lt;/td&gt;
&lt;td&gt;ZC 1.5.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery 3.4.0&lt;/td&gt;
&lt;td&gt;ZC 1.5.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery 1.12.4&lt;/td&gt;
&lt;td&gt;ZC 1.5.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;jquery-ui&#34;&gt;jQuery UI&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;https://jqueryui.com/&#34;&gt;jQuery UI library&lt;/a&gt; has been used in the Zen Cart admin since 1.5.6.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;jQuery UI&lt;/th&gt;
&lt;th&gt;Zen Cart Admin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;jQuery UI 1.14.0&lt;/td&gt;
&lt;td&gt;ZC 2.1.0-2.2.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery UI 1.13.2&lt;/td&gt;
&lt;td&gt;ZC 1.5.8-2.0.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jQuery UI 1.12.1&lt;/td&gt;
&lt;td&gt;ZC 1.5.6-1.5.7&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;help-on-jquery-and-jquery-ui&#34;&gt;Help on jQuery and jQuery UI&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://jquery.com/&#34;&gt;jQuery&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://jqueryui.com/&#34;&gt;jQuery UI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Dev: Template Settings and the $tplSetting object</title>
      <link>https://docs.zen-cart.com/dev/storefront/template_settings/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/storefront/template_settings/</guid>
      <description>
        
        
        &lt;p&gt;Starting with Zen Cart v2.0.0 there is a &lt;code&gt;$tplSetting&lt;/code&gt; object which can be used to access site configuration settings that are customized to a specific template.&lt;/p&gt;
&lt;p&gt;This means you can have the usual global settings configured in the Admin as usual, but allow for template-specific overrides which only take effect when a certain template is used.&lt;/p&gt;
&lt;p&gt;One benefit of this for both storeowners and developers is the ability to try out a new template without destroying the existing configuration settings, so that your live site can function normally even while you&amp;rsquo;re experimenting with new things.&lt;/p&gt;
&lt;p&gt;It also allows template authors to distribute configuration settings with their template, without those settings messing with a store&amp;rsquo;s already-configured settings.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;NOTE: This can be used in tandem with the &lt;code&gt;init_site_specific_non_db_settings.php&lt;/code&gt; feature available since Zen Cart v1.5.8 - see &lt;a href=&#34;https://docs.zen-cart.com/user/customizing/site_specific_overrides/&#34;&gt;Site Specific Overrides&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Starting in Zen Cart 2.1.0, the template settings file may be viewed from your admin page.&lt;/p&gt;
&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;p&gt;There are two requirements, using Zen Cart v2.0.0 or newer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the template must use &lt;code&gt;$tplSetting&lt;/code&gt; to access settings instead of directly referring to the global CONSTANT&lt;/li&gt;
&lt;li&gt;the template&amp;rsquo;s &lt;code&gt;/includes/templates/YOUR_TEMPLATE_NAME/template_settings.php&lt;/code&gt; file must contain the override settings. (See the 2 kinds of overrides, explained below)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;two-kinds-of-settings-available&#34;&gt;Two Kinds of Settings Available&lt;/h2&gt;
&lt;h3 id=&#34;1-overriding-a-constant-such-as-an-admin-configuration-setting&#34;&gt;1. Overriding a CONSTANT such as an admin configuration setting&lt;/h3&gt;
&lt;p&gt;Many site configuration settings used by templates (and modules that supply data to templates) are controlled via the Admin configuration pages.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s an example of how to override the setting by making an adjustment to your template file and defining the override separately for each template which desires to use something other than the Admin configuration setting.&lt;/p&gt;
&lt;h4 id=&#34;example-banner-group-2&#34;&gt;Example: Banner Group #2&lt;/h4&gt;
&lt;p&gt;Zen Cart&amp;rsquo;s banner feature can be used to show in-site ads or offsite ads or other messages to customers. Some templates use the feature to control a gallery/slider-effect of images.&lt;/p&gt;
&lt;p&gt;Banners are rendered in various positions of the template, and it&amp;rsquo;s possible that one template wants the feature turned off completely, but another template leverages it specifically. This is a good time to use template-specific settings.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Determine the CONSTANT&lt;/strong&gt; that is used in the Admin for accessing the configured value. The Developers Toolkit can be useful here. If looking in the database at the &lt;code&gt;configuration&lt;/code&gt; table, it&amp;rsquo;s the &lt;code&gt;configuration_key&lt;/code&gt; that we&amp;rsquo;re looking for, because a CONSTANT is declared for the &lt;code&gt;configuration_key&lt;/code&gt;, with its value set to what&amp;rsquo;s stored in &lt;code&gt;configuration_value&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the case of our example, we&amp;rsquo;re looking at the controls for &lt;code&gt;SHOW_BANNERS_GROUP_SET2&lt;/code&gt;.&lt;/p&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;&lt;strong&gt;Replace the constant with $tplSetting-&amp;gt;foo in the template.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Look in your template files for wherever that &lt;code&gt;SHOW_BANNERS_GROUP_SET2&lt;/code&gt; constant is used, and replace the constant with a reference to &lt;code&gt;$tplSetting-&amp;gt;foo&lt;/code&gt; where &lt;code&gt;foo&lt;/code&gt; is that constant.&lt;/p&gt;
&lt;p&gt;eg:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;SHOW_BANNERS_GROUP_SET2&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;$banner&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;zen_banner_exists&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;dynamic&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;SHOW_BANNERS_GROUP_SET2&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;))&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;becomes the following, where two replacements are made:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;  if ($tplSetting-&amp;gt;SHOW_BANNERS_GROUP_SET2 != &amp;#39;&amp;#39; &amp;amp;&amp;amp; $banner = zen_banner_exists(&amp;#39;dynamic&amp;#39;, $tplSetting-&amp;gt;SHOW_BANNERS_GROUP_SET2)) {
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To test, things should work as they did before, without any change yet because we haven&amp;rsquo;t configured an override setting yet. We&amp;rsquo;ll do that next:&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Set the new value into the &lt;code&gt;$tpl_settings&lt;/code&gt; array in &lt;code&gt;template_settings.php&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In your template&amp;rsquo;s &lt;code&gt;template_settings.php&lt;/code&gt; file, find the list of array entries for &lt;code&gt;$tpl_settings&lt;/code&gt;, and add one for the setting you&amp;rsquo;re overriding.&lt;/p&gt;
&lt;p&gt;eg: &lt;code&gt;$tpl_settings[&#39;SHOW_BANNERS_GROUP_SET2&#39;] = &#39;current_promotions&#39;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can now refresh the template page in your browser, and the new banner group will be applied. (Of course, you will have to have already defined a banner group by the name you&amp;rsquo;re using here. If the banner group exists and banners are assigned to it, they will be displayed.)&lt;/p&gt;
&lt;h3 id=&#34;2-defining-a-public-variable-that-is-used-someplace-in-a-template-or-module-file&#34;&gt;2. Defining a public variable that is used someplace in a template or module file.&lt;/h3&gt;
&lt;p&gt;Sometimes templates or modules are coded to be alert to the pre-existence of a variable that could be overridden by setting it earlier in the PHP code execution process.&lt;/p&gt;
&lt;p&gt;Defining such variables is sometimes referred to as a &amp;ldquo;soft&amp;rdquo; setting/override.&lt;/p&gt;
&lt;h4 id=&#34;example&#34;&gt;Example:&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;product_listing.php&lt;/code&gt; module has the ability to specify some CSS classes that should be applied to the grid used when in &amp;ldquo;fluid&amp;rdquo; mode (where Product Listing Columns Per Row is set to &amp;lsquo;0&amp;rsquo;).&lt;/p&gt;
&lt;p&gt;If your template doesn&amp;rsquo;t need to customize anything other than the CSS style class names for the product-listing to display as desired, you could define those classes in &lt;code&gt;template_settings.php&lt;/code&gt; instead of creating an override module file and directory for &lt;code&gt;product_listing.php&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;responsive_classic&lt;/code&gt; template sets the following variables in its &lt;code&gt;template_settings.php&lt;/code&gt; file to define those CSS classes:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;$grid_product_cards_classes&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;row row-clmns-3&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;$grid_product_classes_matrix&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;480&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;row row-clms-1 row-clms-sm-2 row-clms-md-3 row-clms-lg-4 row-clms-xl-6&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;potential-conflicts&#34;&gt;Potential Conflicts&lt;/h2&gt;
&lt;p&gt;Be aware that if you are setting any of these public/&amp;ldquo;soft&amp;rdquo; variables using the &lt;code&gt;site-specific-settings&lt;/code&gt;, there might be a clash. See the Technical Information For Developers section below for troubleshooting clashes.&lt;/p&gt;
&lt;h2 id=&#34;using-template_settings-in-tandem-with-init_site_specific_non_db_settingsphp&#34;&gt;Using &lt;code&gt;template_settings&lt;/code&gt; in tandem with &lt;code&gt;init_site_specific_non_db_settings.php&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;It is recommended to put template-specific settings into the &lt;code&gt;template_settings.php&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;You may leave your preferred site-wide defaults as variables in &lt;code&gt;init_site_specific_non_db_settings.php&lt;/code&gt;, but they will be overridden by &lt;code&gt;template_settings.php&lt;/code&gt; when it is loaded.&lt;/p&gt;
&lt;p&gt;This can work in your favor.&lt;/p&gt;
&lt;h2 id=&#34;technical-information-for-developers&#34;&gt;Technical Information for Developers&lt;/h2&gt;
&lt;h3 id=&#34;about-the-tplsetting-helper-object&#34;&gt;About the &lt;code&gt;$tplSetting&lt;/code&gt; helper object&lt;/h3&gt;
&lt;h4 id=&#34;lookup-order&#34;&gt;Lookup Order&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;$tplSetting&lt;/code&gt; object looks for a value to return using this order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The global $tpl_settings array for a key matching the $setting requested. (It loads that array upon instantiation.)&lt;/li&gt;
&lt;li&gt;A defined CONSTANT matching the $setting requested&lt;/li&gt;
&lt;li&gt;If nothing is found, &lt;code&gt;null&lt;/code&gt; is returned&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&#34;casting-types&#34;&gt;Casting types&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;$tplSetting&lt;/code&gt; object allows you to set a &lt;code&gt;type&lt;/code&gt; to cast each setting to upon return.&lt;/p&gt;
&lt;p&gt;eg: &lt;code&gt;ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN&lt;/code&gt; is an admin configuration setting, stored as a string.&lt;/p&gt;
&lt;p&gt;So &lt;code&gt;echo $tplSetting-&amp;gt;ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN;&lt;/code&gt; would normally return &lt;code&gt;&#39;false&#39;&lt;/code&gt; as a string.&lt;/p&gt;
&lt;p&gt;But if we set it to boolean, like this:
&lt;code&gt;$tplSetting-&amp;gt;setType(&#39;ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN&#39;, &#39;bool&#39;);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;then
&lt;code&gt;echo $tplSetting-&amp;gt;ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN;&lt;/code&gt; returns &lt;code&gt;false&lt;/code&gt; as a boolean.&lt;/p&gt;
&lt;h4 id=&#34;combining-types-and-values-in-tpl_settings-array&#34;&gt;Combining types and values in &lt;code&gt;$tpl_settings[]&lt;/code&gt; array&lt;/h4&gt;
&lt;p&gt;The basic use of the &lt;code&gt;$tpl_settings&lt;/code&gt; array lets you establish values to return when a specific key is referenced.&lt;/p&gt;
&lt;p&gt;But if you want to also specify how to cast those values into a certain PHP type without manually calling &lt;code&gt;-&amp;gt;setType()&lt;/code&gt; on each one, you can declare them in the initial &lt;code&gt;$tpl_settings&lt;/code&gt; array as nested values of &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;type (see example below). The &lt;/code&gt;$tplSetting` object will look for this nested-array format and use it automatically if the array keys match, instead of treating the setting as an array.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$tpl_settings[&amp;#39;GET_VALUE_OF_TWO&amp;#39;] = &amp;#39;2&amp;#39;;
// $tplSetting-&amp;gt;GET_VALUE_OF_TWO will return the string &amp;#39;2&amp;#39;.

$tpl_settings[&amp;#39;GET_VALUE_OF_TWO&amp;#39;] = [
    &amp;#39;value&amp;#39; =&amp;gt; &amp;#39;2&amp;#39;,
    &amp;#39;type&amp;#39; =&amp;gt; &amp;#39;int&amp;#39;,
    ];
// $tplSetting-&amp;gt;GET_VALUE_OF_TWO will return the integer 2.
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;load-order&#34;&gt;Load Order&lt;/h3&gt;
&lt;p&gt;Zen Cart loads certain features/settings in a prescribed order. If you have a setting defined earlier in the process, it will be overridden if something else defines the same thing later on.&lt;/p&gt;
&lt;p&gt;Also, due to the way PHP works, any CONSTANTs you&amp;rsquo;ve defined earlier in the process will NOT be overridden/definable later in the process, since they can only be defined once.&lt;/p&gt;
&lt;p&gt;Related init-system load-order information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;extra_datafiles&lt;/code&gt; including &lt;code&gt;site_specific_overrides&lt;/code&gt; before breakpoint 0&lt;/li&gt;
&lt;li&gt;db CONSTANTs (admin-defined config settings) at breakpoint 40&lt;/li&gt;
&lt;li&gt;non-db CONSTANTs and variables in &lt;code&gt;init_non_db_settings&lt;/code&gt; and &lt;code&gt;init_site_specific_non_db_settings.php&lt;/code&gt; at breakpoint 45&lt;/li&gt;
&lt;li&gt;&lt;code&gt;functions&lt;/code&gt; and &lt;code&gt;extra_functions&lt;/code&gt; files at breakpoint 60&lt;/li&gt;
&lt;li&gt;&lt;code&gt;template_settings.php&lt;/code&gt; at breakpoint 110&lt;/li&gt;
&lt;li&gt;followed by language-defines and &lt;code&gt;extra_definitions&lt;/code&gt; for the current language&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
