Skip to content

Commit

Permalink
Language file related updates
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcwilson committed Aug 4, 2023
1 parent 3b01dff commit 61a110f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
13 changes: 11 additions & 2 deletions content/dev/plugins/upgrading_to_158.md
@@ -1,6 +1,6 @@
---
title: Upgrading plugins to work with 1.5.8/PHP 8.0+
description: Upgrading old Zen Cart plugins to work with Zen Cart 1.5.8
title: Upgrading plugins to work with PHP8+/1.5.8+
description: Upgrading old Zen Cart plugins to work with PHP 8.x and Zen Cart 1.5.8+
category: plugins
---

Expand Down Expand Up @@ -189,6 +189,15 @@ to
$this->statisticModuleQueries = $db->queryCount();
```

### PHP 8.0+ and missing constants

If you get a debug log like this:

```
[04-Aug-2023 11:50:03 UTC] PHP Fatal error: Uncaught Error: Undefined constant "SOME_CONSTANT" in /Users/scott/Sites/gh_demo_200/...
```

please see [missing language constants](/user/localization/missing_language_constants/).


{{% code_help_links %}}
Expand Down
Expand Up @@ -74,3 +74,5 @@ $define['FEATURED'] = '<li><a href="' . zen_href_link(FILENAME_FEATURED_PRODUCTS
Notice that the anchor text is `$define['TABLE_HEADING_FEATURED_PRODUCTS']` rather than `TABLE_HEADING_FEATURED_PRODUCTS`.

You can read more about array based language files in [Language Files - Developer Information on Array based Language files](/dev/code/158_language_files/).

{{% language_help_links %}}
26 changes: 26 additions & 0 deletions content/user/localization/missing_language_constants.md
@@ -0,0 +1,26 @@
---
title: Missing Language Constants
description: Fixing a missing language define in translated language packs
category: localization
weight: 10
---

**NOTE:** These instructions are for Zen Cart 1.5.8 and above.

If you are running under PHP 8.0 or higher, a missing language definition will cause a blank screen. This is a particular risk for translated language packs, which might not be up to date with the latest Zen Cart version, but it can also happen for plugins with out of date or incomplete language files.

The [debug log](/user/troubleshooting/debug_logs/) will start with a message like this:

```
[04-Aug-2023 11:50:03 UTC] PHP Fatal error: Uncaught Error: Undefined constant "SOME_CONSTANT" in /Users/scott/Sites/gh_demo_200/...
```

To fix this issue, follow these steps:

- Locate the language constant in English, looking first in `includes/languages/lang.english.php`, then under `includes/languages/english`.
- When you have found the English language definition, update the file in the version for `YOURLANGUAGE` to add the definition. For example:
- If the definition is in `includes/languages/lang.english.php`, update `includes/languages/lang.YOURLANGUAGE.php`
- If the definition is in `includes/languages/english/lang.index.php`, update `includes/languages/YOURLANGUAGE/lang.index.php`


{{% language_help_links %}}
11 changes: 7 additions & 4 deletions content/user/troubleshooting/blank_page.md
Expand Up @@ -49,7 +49,7 @@ If your hoster updated your PHP version, be aware that if you're running an old

The most common customization errors include:

* adding or deleting apostrophes or quotations (ie: ' or " marks) inside define() statements, resulting in mismatched quotes
* adding or deleting apostrophes or quotations (ie: ' or " marks) inside `define()` statements, resulting in mismatched quotes
* removing or adding punctuation to define() statements, thus breaking the correct syntax. A define() statement should look like this:

```
Expand All @@ -59,7 +59,7 @@ The most common customization errors include:
* missing semi-colons and periods, unbalanced parentheses, braces, brackets
* uploading files to the wrong places. For more information about overrides, see the [Overrides Chart](https://www.zen-cart.com/downloads.php?do=file&id=192)
and the [Overrides FAQs](/user/template/template_overrides/).
* When renaming files (for backup), be sure to NOT keep the extension ".php". For instance, rename header_php.php to header_php.old or header_php.php.20110701, BUT *NOT* header_php.old.php.
* When renaming files (for backup), be sure to NOT keep the extension ".php". For instance, rename header_php.php to header_php.old or header_php.php.20110701, **NOT** header_php.old.php.

## 5\. Do you have bad product data?

Expand Down Expand Up @@ -136,8 +136,7 @@ Kinds of errors:

How to read the errors:

* Note that many error/warning messages will be a result of previous error/warning messages.
<font color="#FF0000">**Deal with them in the order they appear**,</font> and don't blame the later errors until the earlier ones are dealt with first.
* Note that many error/warning messages will be a result of previous error/warning messages. <font color="#FF0000">**Deal with them in the order they appear**,</font> and don't spend time on the later errors until the earlier ones are dealt with first.
* One of the MOST COMMON errors you'll see is addressed here: [Warning: Headers Already Sent ...](/user/troubleshooting/warning_headers_already_sent/).
* Use the search option on this page to find answers to any other errors you find.

Expand All @@ -146,6 +145,10 @@ How to read the errors:
If you're seeing a blank screen but have no log files in your /logs/ folder,
it could be that your configuration has changed the default logging behavior. See [Missing Log files](/user/troubleshooting/missing_log_files/).

### d) Common fixes

The [Upgrading plugins to 1.5.8](/dev/plugins/upgrading_to_158) page shows some common issues and fixes.

* * *

### Advanced Developer Option. (THIS APPROACH IS *NOT* NEEDED FOR MOST SITUATIONS!!!!)
Expand Down
9 changes: 9 additions & 0 deletions content/user/troubleshooting/undefined_constant.md
@@ -0,0 +1,9 @@
---
title: Fatal error from an undefined constant
description: How do I fix an undefined constant debug log?
category: admin
weight: 10
noindex: yes
---

Please see [missing language constants](/user/localization/missing_language_constants/).
1 change: 1 addition & 0 deletions layouts/shortcodes/language_help_links.md
Expand Up @@ -9,3 +9,4 @@
- [Upgrading plugins to work with 1.5.8/PHP 8.0+](/dev/plugins/upgrading_to_158/)
- [Basic 158+ Language Customizations](/user/localization/basic_158_language_customizations/)
- [Updated Language Packs for 1.5.8+](/user/localization/updated_language_packs/)
- [Missing Language Constants](/user/localization/missing_language_constants/)

0 comments on commit 61a110f

Please sign in to comment.