Template override in languages/english/modules/shipping not working
I upgraded my 1.3.8 site to 1.5. I started with a fresh 1.5 install and moved everything over.
My customer just rang to tell me people are having trouble ordering and when I tried to sign up as a new user I received a message telling me there where no shipping options available. When I log into the admin system and look at modules/shipping I saw lots of messages like this:
ERROR: module not loaded due to missing language file: /home/plr/public_html/includes/languages/english/modules/shipping/flatCourierUK.php
The file flatCourierUK.php was in a folder with the template name inside shipping. As soon as I moved it out to shipping then it started working again.
flatCourierUK.php was a shipping method I created based on the standard flat.php I created as it was the easiest way I found to create multiple flat shipping fees. The customer chooses which flat shipping method they want based on where they are, so for example royal mail for parcels under 5Kg or courier to the shetland islands.
Is this a bug with zencart not handling my language override properly or is it me not creating the new shipping method correctly?
Re: Template override in languages/english/modules/shipping not working
Sounds like you didn't *test* any transactions after doing the upgrade. Something to remember for future.
The "module not loaded due to missing language file" message appears when you don't have matching files for shipping module and its corresponding language file.
Shipping modules come in pairs:
/includes/modules/shipping/FILENAME.php
/includes/languages/YOUR_LANGUAGE/modules/shipping/FILENAME.PHP
If you don't have the pair of files on the server, you'll get errors and malfunction.
Re: Template override in languages/english/modules/shipping not working
Quote:
Originally Posted by
TC!!
The file flatCourierUK.php was in a folder with the template name inside shipping. As soon as I moved it out to shipping then it started working again.
Quote:
Originally Posted by
DrByte
Shipping modules come in pairs:
/includes/modules/shipping/FILENAME.php
/includes/languages/YOUR_LANGUAGE/modules/shipping/FILENAME.PHP
The overiding system is being applied for language files in /includes/languages/YOUR_LANGUAGE/modules/shipping/ folder.
But it seems, the code in admin/modules.php and admin/orders.php files does not provide this option...
In admin/orders.php should be
Code:
if (file_exists(zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/', $file, 'false'))) {
include(zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/', $file, 'false'));
instead of
Code:
if (file_exists(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file)) {
include(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file);
and in admin/orders.php should be (in many places):
Code:
require_once zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/', $order->info['payment_module_code'] . '.php', 'false');
instead of:
Code:
require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
and
Code:
require zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/', $order->info['payment_module_code'] . '.php', 'false');
instead of:
Code:
require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
(quoting code from v.155e)
Re: Template override in languages/english/modules/shipping not working
The issue described and the suggested revision(s) do not align.
DrByte pointed out that all modules should be in includes/modules/shipping/ and have whatever name each is to be called. Then the words to be displayed for that shipping module are to be captured within each language used for each such shipping module (a language that does not have definitions for that shipping module will not show the shipping module as available, but will also generate an error.
The suggested code fix appears that would offer the default language (typically "english") for the admin if the current admin language is not supported by the front end of the system. In otherwords it would make it "easier" on the admin side to use an admin language not supported by the store, but at the cost of the admin's "user experience" because the text would not be presented in the language used by the admin if that language was not addressed in the catalog.
Basically, the shipping methods themselves are not overrideable. The language part of it is. Limits to the display of a shipping method are contained either in the admin setup (such as zones) or in additional code within the module based on whatever factor(s) of concern.
Re: Template override in languages/english/modules/shipping not working
Quote:
Originally Posted by
mc12345678
The issue described and the suggested revision(s) do not align.
The issue described and the suggested revision(s) do align.
Please read carefully the description of the problem and its solution in the initial topicstarter's message:
Quote:
Originally Posted by
TC!!
ERROR: module not loaded due to missing language file: /home/plr/public_html/includes/languages/english/modules/shipping/flatCourierUK.php
The file flatCourierUK.php was in a folder with the template name inside shipping. As soon as I moved it out to shipping then it started working again.
Additionally, this has absolutely no connection with language (wether English or not) used in admin
Re: Template override in languages/english/modules/shipping not working
Hi yesaul,
Quote:
Originally Posted by
yesaul
The overiding system is being applied for language files in
/includes/languages/YOUR_LANGUAGE/modules/shipping/ folder.
But it seems, the code in
admin/modules.php and
admin/orders.php files does not provide this option...
In
admin/orders.php should be
Code:
if (file_exists(zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/', $file, 'false'))) {
include(zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/', $file, 'false'));
instead of
Code:
if (file_exists(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file)) {
include(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/' . $module_type . '/' . $file);
and in
admin/orders.php should be (in many places):
Code:
require_once zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/', $order->info['payment_module_code'] . '.php', 'false');
instead of:
Code:
require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
and
Code:
require zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/', $order->info['payment_module_code'] . '.php', 'false');
instead of:
Code:
require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
(quoting code from v.155e)
Thanks for the bugfix. Really unpleasant bug. Add this bugfix to zen-cart-1.5.5-Russian.