Totally Zenned
- Join Date:
- Mar 2004
- Posts:
- 651
- Plugin Contributions:
- 1
SitemapXML v.2
It has been a long time and is nice of you to remember.
I search for an occasional answer and lurk for awhile.
But, I just don't have available the 6-8 hrs a day I use to spend on the forum.
After much checking and testing, I found the problem.
I update all tables using SQL statements. I don't enter fields where the default is acceptable; have even changed a few field defaults to reduce the data I have to maintain. Normally, I don't bother entering data for "date_added" or "last_modified" and accept the NULL default value. Except for products; because I use that information on some pages.
I use IIS for local server and naturally the remote server is Apache.
When I installed sitemapXML on local server to test, I saw that "Last modification date" was 2001-01-01 for sitemapcategories.xml.
I changed my SQL statement and added today, in yyyyy-mm-dd format, to the last_modified field; date_added field was still empty (NULL).
Local category report looked fine.
However, same PHP files and data produces different reports on an Apache server.
- If both date_added and last_modified are NULL, sitemapcategories.xml contains no tags or data for "Last modification date".
- If data is entered into last_modified field only, as I did, the sitemapcategories.xml still contains no tags or data for "Last modification date".
- Data MUST be present in the date_added field for "Last modification date" information to appear in the XML report.
- If both fields contain date, the later date is used.
These results where found using phpMyAdmin on local and remote server and deleting and adding different date combinations in the category tables.
The way the program is now written,
IIS will supply a date of 2001-01-01 if null and you only need data in the last_modified field.
Apache says NULL means NULL and requires data in the date_added field to work at all.
Remember, I use SQL statements and can create my own problems (and solutions) and ZenCart users who use Admin will never be affected. I may alter my SQL statement to include date_added data or default date_added to some datetime other than NULL.
As far as the program code;
In sitemapxml_categories.php line 27, I thought it might have failed because "0001-01-01" is out of range for MySQL. Changed to "2003-01-01" and still no joy.
Don't think lines 22 and 27 are getting the job done.
Might be tempted to stick a default "NOW" in there some place.
That's all I came up with.
Now that I understand that date_added field is needed for current code to work on Apache server, I'll take needed action.
Best wishes,
Juxi