Page 1 of 1
Customer Data - Date of Birth module
Posted: Tue Aug 16, 2022 10:06 am
by Omar_one
Hello,
on the error log file show this error >
Code: Select all
PHP Fatal error: Cannot redeclare cd_dob_date_raw() (previously declared
in /home/xxxx/public_html/shop/includes/languages/english/modules/customer_data/cd_dob.php:24)
in /home/xxxx/public_html/shop/includes/languages/finnish/modules/customer_data/cd_dob.php on line 24
and the lines 24-26
Code: Select all
function cd_dob_date_raw($date, $reverse = false) {
return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
}
change the line 24 in (includes/languages/english/modules/customer_data/cd_dob.php , includes/languages/finnish/modules/customer_data/cd_dob.php)
from this
Code: Select all
function cd_dob_date_raw($date, $reverse = false) {
to this
Code: Select all
if(function_exists('cd_dob_date_raw($date, $reverse = false)')) {
it's seems fix the issue ,,
@ecartz is there is any another way for fix it ?
Br
Omar
Re: Customer Data - Date of Birth module
Posted: Tue Aug 16, 2022 10:30 am
by ecartz
Why is it loading both English and Finnish? Perhaps change the if to
Code: Select all
if (isset($_SESSION['language']) && (basename(dirname(__DIR__, 2)) === $_SESSION['language'])) {
Or simply make it stop trying to load two languages.
Re: Customer Data - Date of Birth module
Posted: Tue Aug 16, 2022 12:01 pm
by Omar_one
ecartz wrote: ↑Tue Aug 16, 2022 10:30 am
Why is it loading both English and Finnish?
I don't know why, as it's an updated version from the first version, it can be an file left not updated ??!!
ecartz wrote: ↑Tue Aug 16, 2022 10:30 am
Perhaps change the if to
Code: Select all
if (isset($_SESSION['language']) && (basename(dirname(__DIR__, 2)) === $_SESSION['language'])) {
Or simply make it stop trying to load two languages.
do you mean to add it to line 24 or in somewhere else?
Re: Customer Data - Date of Birth module
Posted: Tue Aug 16, 2022 12:09 pm
by ecartz
I mean change
Code: Select all
if(function_exists('cd_dob_date_raw($date, $reverse = false)')) {
to what I posted.
The function_exists blocks redefining the function, but it doesn't ensure that the correct version is loaded. So you might use the English version for Finnish or vice versa.
Re: Customer Data - Date of Birth module
Posted: Wed Aug 17, 2022 5:59 pm
by Omar_one
ecartz wrote: ↑Tue Aug 16, 2022 12:09 pm
I mean change
Code: Select all
if(function_exists('cd_dob_date_raw($date, $reverse = false)')) {
to what I posted.
in admin->orders I got this error
Code: Select all
Notice: Undefined variable: date in /home/XXXX/public_html/shop/includes/languages/english/modules/customer_data/cd_dob.php on line 25
ecartz wrote: ↑Tue Aug 16, 2022 12:09 pm
So you might use the English version for Finnish or vice versa.
maybe I copied the English folder and translate it to finnish,, really I don't remember how it was done ,,, if there any way to fix this.
thank you for your help
Omar
Re: Customer Data - Date of Birth module
Posted: Wed Aug 17, 2022 8:18 pm
by ecartz
It should look like
Code: Select all
if (isset($_SESSION['language']) && (basename(dirname(__DIR__, 2)) === $_SESSION['language'])) {
function cd_dob_date_raw($date, $reverse = false) {
return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
}
}
Perhaps I misunderstood what you were doing previously.