Difference between revisions of "How to Change Text"

From Phoenix Cart User Guide
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
<span class="btn-grey"><historylink type="back">&#129032; Back</historylink></span>
+
<div class="btn btn-grey btn-back">{{#fas:arrow-left}} Back</div> <div class="btn btn-grey btn-faq">{{#fas:question-circle}} FAQ Tips & Tricks</div>
<span class="btn-grey" style="color:#0088dd;">'''&#x1F809; [[FAQS TIPS & TRICKS]]'''</span>
 
 
<hr>
 
<hr>
You can change any text in a language file in admin '''Tools → Define Languages''' - see <big>'''[[Change Language Files]]'''</big>.
+
Text can be changed in a language file.
 +
 
 +
As an example here, the text shown in the e-mail notification that is sent to the customer automatically after registering on the website.
 +
 
 +
Often, the language file is associated with the module that uses it.
 +
 
 +
In this case, it is a '''notification''' module, so the language file will be found in '''/includes/languages/english/modules/notifications/''', specifically, '''n_create_account.php'''
  
 
Sometimes it can be difficult to find which language file contains the text.
 
Sometimes it can be difficult to find which language file contains the text.
  
To find text in a language file, use the search facility at Github where the repository for the code for CE Phoenix is stored.
+
To find text in a language file, use the search facility in file editing software to search your backup folder/directory - see:- <big>'''[[How to Back Up]]'''</big> and <big>'''[[Must Have Tools]]'''</big> -  or at Github, where the repository for the code for CE Phoenix Cart is stored - '''https://github.com/CE-PhoenixCart/PhoenixCart'''
  
For our example: How to change Welcome email text.
+
So, using the CE Phoenix Cart Github Repository to search, the search box can be seen at the top of the page.
  
After completing a test purchase, it can be seen that an email is sent to the customer that starts with the text, '''We welcome'''
+
<div class="mainpage_box">
 +
[[File:github-search-1.jpg|link=]]
 +
</div>
  
*Go to the Github repository for CE Phoenix.
+
A test purchase should have been made and it will be seen that the e-mail to the customer starts with '''Welcome to'''
  
 +
So, search for '''Welcome to''' and click on the results for '''Search in this repository'''.
  
 
<div class="mainpage_box">
 
<div class="mainpage_box">
[[File:githubSearch.jpg]]
+
[[File:github-search-2.jpg|link=]]
 
</div>
 
</div>
  
 +
Which gives a few results:
  
*Enter the search term in the input box (top left) - enclose the text in double quotes.
+
<div class="mainpage_box">
*For this example enter, '''"We welcome"'''
+
[[File:github-search-3.jpg|link=]]
*Click '''In this repository''' in the drop down menu.
+
</div>
*The search results will show this:
 
  
 +
 +
*A quick look at the results shows an obvious file:
 +
** '''includes/languages/english/modules/notifications/n_create_account.php'''
 +
*In a multi language store, the same file will also be in other language directories, for example, at:
 +
**'''includes/languages/otherLanguage/modules/notifications/n_create_account.php'''
 +
 +
 +
Open the language file to see the constants and their values:
 +
<div class="mainpage_box">
 +
[[File:change-text-1.jpg|link=|1500px]]
 +
</div>
 +
The value will be output wherever the constant is used.
 +
 +
Note: Some language files might have the constants and values written slightly differently like:
  
 
<div class="mainpage_box">
 
<div class="mainpage_box">
[[File:githubSearchResult.jpg]]
+
[[File:language-define.jpg|link=]]
 
</div>
 
</div>
 +
 +
Open the module's template file, '''includes/modules/notifications/templates/tpl_n_create_account.php'''
 +
 +
This shows how the constants are used and how they will be output in the e-mail:
 +
<div class="mainpage_box">
 +
[[File:change-text-2.jpg|link=]]
 +
</div>
 +
 +
 +
Changes to any language file for the Store side are made to a copy which is saved in a new location in the override template.
 +
 +
This prevents them being overwritten in updates.
 +
 +
Changes to any language file for the Admin side are saved in the original location.
 +
 +
If making a change to an Admin side language file, backup that file before and after making changes to the file on the server.
 +
 +
 +
Making a change to a Store side language file (presuming using English):
 +
*From the admin dashboard go to '''Tools > Language Explorer'''.
 +
*Look in the list for '''english > modules > notifications''', click the drop down arrow and see the language files associated with the modules.
 +
*See '''n_create_account.php''' which is the language file associated with the module.
 +
*Click it. This will copy the file to your template (which is override in a new install).
 +
*Now a copy of that file will be at /templates/override/includes/languages/english/modules/notifications/n_create_account.php
 +
*Open the new file '''/templates/override/includes/languages/english/modules/notifications/n_create_account.php'''
 +
*Change the text as required.
 +
*If you enter any more single quotes in your text, you must use a backslash before the single quote, for example, '''don\'t'''.
 +
*Save, check and test the changes in the store. Remember to refresh/reload the page to see changes. Back up the file.
 +
  
  
*Find the language file in admin '''Tools → Define Languages''' list - in this example the file is '''includes/languages/english/modules/notifications/n_create_account.php'''.
+
See:- <big>'''[[How to Use a Template]]'''</big>
*Click to open, make changes to the text, click Save - done.
 
  
  
 
<hr>
 
<hr>
 
{{Contribute}}
 
{{Contribute}}

Latest revision as of 07:37, 4 June 2025

Back
FAQ Tips & Tricks

Text can be changed in a language file.

As an example here, the text shown in the e-mail notification that is sent to the customer automatically after registering on the website.

Often, the language file is associated with the module that uses it.

In this case, it is a notification module, so the language file will be found in /includes/languages/english/modules/notifications/, specifically, n_create_account.php

Sometimes it can be difficult to find which language file contains the text.

To find text in a language file, use the search facility in file editing software to search your backup folder/directory - see:- How to Back Up and Must Have Tools - or at Github, where the repository for the code for CE Phoenix Cart is stored - https://github.com/CE-PhoenixCart/PhoenixCart

So, using the CE Phoenix Cart Github Repository to search, the search box can be seen at the top of the page.

Github-search-1.jpg

A test purchase should have been made and it will be seen that the e-mail to the customer starts with Welcome to

So, search for Welcome to and click on the results for Search in this repository.

Github-search-2.jpg

Which gives a few results:

Github-search-3.jpg


  • A quick look at the results shows an obvious file:
    • includes/languages/english/modules/notifications/n_create_account.php
  • In a multi language store, the same file will also be in other language directories, for example, at:
    • includes/languages/otherLanguage/modules/notifications/n_create_account.php


Open the language file to see the constants and their values:

Change-text-1.jpg

The value will be output wherever the constant is used.

Note: Some language files might have the constants and values written slightly differently like:

Language-define.jpg

Open the module's template file, includes/modules/notifications/templates/tpl_n_create_account.php

This shows how the constants are used and how they will be output in the e-mail:

Change-text-2.jpg


Changes to any language file for the Store side are made to a copy which is saved in a new location in the override template.

This prevents them being overwritten in updates.

Changes to any language file for the Admin side are saved in the original location.

If making a change to an Admin side language file, backup that file before and after making changes to the file on the server.


Making a change to a Store side language file (presuming using English):

  • From the admin dashboard go to Tools > Language Explorer.
  • Look in the list for english > modules > notifications, click the drop down arrow and see the language files associated with the modules.
  • See n_create_account.php which is the language file associated with the module.
  • Click it. This will copy the file to your template (which is override in a new install).
  • Now a copy of that file will be at /templates/override/includes/languages/english/modules/notifications/n_create_account.php
  • Open the new file /templates/override/includes/languages/english/modules/notifications/n_create_account.php
  • Change the text as required.
  • If you enter any more single quotes in your text, you must use a backslash before the single quote, for example, don\'t.
  • Save, check and test the changes in the store. Remember to refresh/reload the page to see changes. Back up the file.


See:- How to Use a Template



Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.

Code references are licensed under a Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org