<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Zen Cart Documentation – Getting Started</title>
    <link>https://docs.zen-cart.com/dev/getting-started/</link>
    <description>Recent content in Getting Started on Zen Cart Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="https://docs.zen-cart.com/dev/getting-started/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Dev: Developer Environment</title>
      <link>https://docs.zen-cart.com/dev/getting-started/developer_environment/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.zen-cart.com/dev/getting-started/developer_environment/</guid>
      <description>
        
        
        &lt;h2 id=&#34;writing-php-code-for-zen-cart-requires-no-particularly-special-environment&#34;&gt;Writing PHP code for Zen Cart requires no particularly special environment.&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;A PHP-aware IDE is very useful to highlight basic syntax errors. We use &lt;a href=&#34;https://www.jetbrains.com/phpstorm/&#34;&gt;PhpStorm&lt;/a&gt; (commercial) but there are various free IDEs available.
It&amp;rsquo;s helpful if your editor honors the &lt;code&gt;.editorconfig&lt;/code&gt; standard which sets out formatting standards for code files. VS Code can be set up to work as an IDE for PHP.&lt;/li&gt;
&lt;li&gt;A LAMP stack is necessary to locally host a working development copy of your store. Common options for this include XAMPP, WAMP/MAMP, Laragon, and even &lt;a href=&#34;https://herd.laravel.com&#34;&gt;Herd&lt;/a&gt; or &lt;a href=&#34;https://laravel.com/docs/valet&#34;&gt;Valet&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;code-formatting&#34;&gt;Code Formatting&lt;/h2&gt;
&lt;p&gt;Line-endings in the github repo are (or are expected to be) &lt;code&gt;LF&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Zen Cart uses &lt;a href=&#34;https://www.php-fig.org/psr/psr-12/&#34;&gt;PSR-12 formatting&lt;/a&gt; standards for &amp;ldquo;new&amp;rdquo; code.&lt;/p&gt;
&lt;p&gt;OLDER code uses a &amp;ldquo;modified&amp;rdquo; PSR-2 which embraces &amp;ldquo;2 spaces&amp;rdquo; for indentation, and often leaves the &amp;ldquo;opening curly brace&amp;rdquo; of classes and functions on the prior line, instead of starting on a new line.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;https://docs.zen-cart.com/dev/contributing/coding_standards&#34;&gt;Coding Standards&lt;/a&gt; for more details.&lt;/p&gt;
&lt;h2 id=&#34;version-control&#34;&gt;Version Control&lt;/h2&gt;
&lt;p&gt;Zen Cart is developed using GitHub version control. We encourage you to create a GitHub account, firstly to become aware of project activity, and secondly to encourage your input.
Read the &lt;a href=&#34;https://docs.zen-cart.com/dev/contributing/github_workflow/&#34;&gt;section on Git&lt;/a&gt; to learn about the workflow that the project uses.&lt;/p&gt;
&lt;h2 id=&#34;retaining-the-default-directory-structure&#34;&gt;Retaining the Default Directory Structure&lt;/h2&gt;
&lt;p&gt;By default, warnings are displayed if you don&amp;rsquo;t rename the &lt;code&gt;admin&lt;/code&gt; folder and delete the &lt;code&gt;zc_install&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;For local development you can eliminate these warnings but maintain those folders by creating a file called &lt;code&gt;admin/includes/extra_configures/dev-skip_admin_rename.php&lt;/code&gt; containing these two constants:&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;define&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;ADMIN_BLOCK_WARNING_OVERRIDE&amp;#39;&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;true&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;define&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;WARN_INSTALL_EXISTENCE&amp;#39;&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;0&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The filename prefix &lt;code&gt;dev-&lt;/code&gt; is significant: the project &lt;code&gt;.gitignore&lt;/code&gt; file ignores files with this prefix so you can keep this new file in your GitHub fork of the zencart project without accidentally checking it in.&lt;/p&gt;
&lt;h2 id=&#34;configuration-keys&#34;&gt;Configuration Keys&lt;/h2&gt;
&lt;p&gt;Every option that may be modified in the Admin screens is a constant stored in the database. It is very helpful to know the name of a constant (the &lt;code&gt;configuration_key&lt;/code&gt;) when searching in code for their use or to use them in your own code.&lt;/p&gt;
&lt;p&gt;The keys used by Zen Cart are listed in the &lt;a href=&#34;https://docs.zen-cart.com/user/admin_pages/configuration/all/&#34;&gt;All Configs&lt;/a&gt; page, but that will not be a comprehensive list for &lt;strong&gt;your&lt;/strong&gt; site as it does not include possible Plugins.&lt;br&gt;
However, the constant names may be displayed by enabling an admin option:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In your admin, each submenu under the Configuration menu has an url such as &lt;code&gt;admin/index.php?cmd=configuration&amp;amp;gID=1.&lt;/code&gt;&lt;br&gt;
Manually change the gID to &lt;code&gt;gID=6&lt;/code&gt; to display an additional page.&lt;/li&gt;
&lt;li&gt;Look for the value &lt;em&gt;Admin configuration_key shows&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Set this value to 1.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now when editing an admin option, the constant name will be shown in the InfoBox title.&lt;/p&gt;
&lt;img src=&#34;https://docs.zen-cart.com/images/show_keys.png&#34; alt=&#34;Show Configuration Keys in Zen Cart&#34; width=&#34;50%&#34; /&gt;
&lt;br&gt;&lt;br&gt;
&lt;p&gt;Example use: In my store I need to see if the configuration allows add to cart on out of stock products.  Go to &lt;code&gt;Admin &amp;gt; Configuration &amp;gt; Stock&lt;/code&gt; and select &lt;em&gt;Show Sold Out Image in place of Add to Cart&lt;/em&gt;.  You&amp;rsquo;ll see the key value is &lt;code&gt;SHOW_PRODUCTS_SOLD_OUT_IMAGE&lt;/code&gt;.  So your PHP code would be,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;if (SHOW_PRODUCTS_SOLD_OUT_IMAGE == &amp;#39;0&amp;#39;) { 
  // Add to cart allowed 
...
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;overriding-the-installer-zc_install-defaults&#34;&gt;Overriding the Installer (/zc_install) defaults&lt;/h2&gt;
&lt;p&gt;Since v1.5.6 the &lt;code&gt;zc_install&lt;/code&gt; process allows you to specify a &lt;code&gt;DEVELOPER_MODE&lt;/code&gt; environment variable, which if detected, will override two operations that occur at the end of &lt;code&gt;zc_install&lt;/code&gt;: the auto-renaming of the admin directory, and auto-creation of an Admin password.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;DEVELOPER_MODE&lt;/code&gt; is enabled, then the &lt;code&gt;admin&lt;/code&gt; directory will not be renamed, and the &lt;code&gt;Admin&lt;/code&gt; user password will be set to &lt;code&gt;developer1&lt;/code&gt; by default.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; This only occurs in the development environment, and only on new-installs, thus is not related to live/production databases.&lt;/p&gt;
&lt;p&gt;Since v1.5.7, the &lt;code&gt;zc_install/includes/localConfig.php&lt;/code&gt; file allows you to specify default database credentials which are pre-filled when going through a fresh install process.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; These defines only work if the &lt;code&gt;DEVELOPER_MODE&lt;/code&gt; setting is enabled/detected.&lt;/p&gt;
&lt;p&gt;A simple way of adding the &lt;code&gt;DEVELOPER_MODE&lt;/code&gt; setting is to create a file inside &lt;code&gt;zc_install/includes/extra_configures&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;e.g. &lt;code&gt;zc_install/includes/extra_configures/dev_mode.php&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;overriding-email-sending&#34;&gt;Overriding Email Sending&lt;/h2&gt;
&lt;p&gt;To prevent the sending of any emails at all
&lt;code&gt;define(&#39;DEVELOPER_OVERRIDE_EMAIL_STATUS&#39;, &#39;false&#39;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To send all emails to a specific testing address
&lt;code&gt;define(&#39;DEVELOPER_OVERRIDE_EMAIL_ADDRESS&#39;, &#39;root@localhost.com&#39;)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The function zen_mail checks for these constants at the moment of processing an email and acts accordingly.&lt;/p&gt;
&lt;p&gt;The function zen_mail could be called from the admin or the catalog, so the constants need to be available in both environments, ideally defined in one place and easily visible to avoid accidental copying to the production site.&lt;/p&gt;
&lt;p&gt;One option is to place the constants in a storefront file:&lt;br&gt;
e.g:
&lt;code&gt;/includes/extra_configures/dev-email_overrides.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and then &amp;ldquo;include&amp;rdquo; this file via an admin file:&lt;br&gt;
e.g:
&lt;code&gt;ADMIN/includes/extra_configures/dev-email_overrides.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;containing:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;?php
include DIR_FS_CATALOG . DIR_WS_INCLUDES . &amp;#39;extra_configures/dev-email_overrides.php&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When the admin environment detects these constants as defined, a message is displayed in the admin messageStack to that effect.&lt;/p&gt;
&lt;h2 id=&#34;innodb-settings&#34;&gt;InnoDB Settings&lt;/h2&gt;
&lt;p&gt;The Zen Cart installer allows for setting a define to create all Database tables using InnoDB rather than MyISAM.&lt;/p&gt;
&lt;p&gt;To enable this you need to add a define e.g.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;define(&#39;USE_INNODB&#39;, true);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Furthermore, you can also add another define that disables whether individual tables are not created as InnoDb tables and left as MyISAM tables.&lt;/p&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;define(&#39;INNODB_BLACKLIST&#39;, [&#39;address_book&#39;]);&lt;/code&gt;&lt;/p&gt;

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