Constants in Zen Cart

Program Constants

Zen Cart has a group of defined constants (created with the PHP define statement) that arise from values in the database, primarily in the configuration table.

The Configuration constants may be seen in the All Configuration Values page.

The majority of the constants in the configuration tables are created as define strings, based on the configuration_key for the row. So if you look at Admin > Configuration > My Store > Store Name, you can see the configuration_key is STORE_NAME. This means the defined constant is a string called STORE_NAME.

The exceptions to the rule of creating string constants are the values in configuration groups 2 and 3, which are the Minimum Values and Maximum Values.

The Min and Max values can be easily recognized as integer values because almost all of them contain the string MIN or MAX respectively in their name. The only exception is SHOW_NEW_PRODUCTS_LIMIT (a Max value).

There are a small number of exceptions to the two rules noted above, which are:

Value Config Group Screen Type
SECURITY_CODE_LENGTH 16 Admin > Configuration > GV Coupons Integer
PRODUCTS_MANUFACTURERS_STATUS 3 Admin > Configuration > Maximum Values String
SHOW_SALE_DISCOUNT_DECIMALS 18 Admin > Configuration > Product Info Integer

Note that the Max and Min values are converted to Integers at constant creation time in newer versions of Zen Cart in laravel/app/Models/Configuration.php.




Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified May 25, 2024 by Scott Wilson (c88f3d7).