Saturday, March 10, 2012

PrestaShop Tips - Order date is empty at back office with error - Undefined index: date_format_full

If you have installed the latest version of PrestaShop 1.4.7, you may encounter following issue.

Symptom
1. At back office Orders tab you will find the order date are empty in the list
2. At order details page, all date fields are left as empty
3. If you set "display_errors" to "on" in /config/config.inc.php, you will find following errors

Notice: Undefined index: date_format_full in ....\www\prestashop\christophe\classes\Tools.php on line 495





Cause
If this issue happened at your store, it indicated that your store was not installed correctly. Some data fields in database are missed. See below highlighted in red.



How to fix the problem?
In order to fix this problem you will need to add those missing field to database.

You can run following scripts to fix the issue.

ALTER TABLE `ps_lang` ADD `date_format_lite` char(32) NOT NULL DEFAULT 'Y-m-d' AFTER language_code;
ALTER TABLE `ps_lang` ADD `date_format_full` char(32) NOT NULL DEFAULT 'Y-m-d H:i:s' AFTER date_format_lite;
UPDATE `ps_lang` SET `date_format_lite` = 'd/m/Y' WHERE `iso_code` IN ('fr', 'es', 'it');
UPDATE `ps_lang` SET `date_format_full` = 'd/m/Y H:i:s' WHERE `iso_code` IN ('fr', 'es', 'it');
UPDATE `ps_lang` SET `date_format_lite` = 'd.m.Y' WHERE `iso_code` = 'de';
UPDATE `ps_lang` SET `date_format_full` = 'd.m.Y H:i:s' WHERE `iso_code` = 'de';
UPDATE `ps_lang` SET `date_format_lite` = 'm/d/Y' WHERE `iso_code` = 'en';
UPDATE `ps_lang` SET `date_format_full` = 'm/d/Y H:i:s' WHERE `iso_code`= 'en';

After you run the script. the problem should be fixed.

No comments: