Hi lat9,
I'm using SitemapXML (formerly "Google Sitemap") - Version: v4.0.4 on Zen Cart 2.1.0, and I encountered a MySQL error when attempting to rebuild the sitemap. The issue specifically occurs with the Ezpages Sitemap generation.
Here’s the error from my logs:
[13-Mar-2025 08:03:17 UTC] Request URI: /index.php?main_page=sitemapxml&rebuild=yes, IP address: 220.133.4.108, Language id 4
#0 [internal function]: zen_debug_error_handler()
#1 /var/www/vhosts/hz.com.tw/httpdocs/includes/classes/db/mysql/query_factory.php(733): trigger_error()
#2 /var/www/vhosts/hz.com.tw/httpdocs/includes/classes/db/mysql/query_factory.php(678): queryFactory->show_error()
#3 /var/www/vhosts/hz.com.tw/httpdocs/includes/classes/db/mysql/query_factory.php(307): queryFactory->set_error()
#4 /var/www/vhosts/hz.com.tw/httpdocs/includes/modules/pages/sitemapxml/sitemapxml_ezpages.php(99): queryFactory->Execute()
#5 /var/www/vhosts/hz.com.tw/httpdocs/includes/templates/template_default/sitemapxml/tpl_main_page.php(21): require('...')
#6 /var/www/vhosts/hz.com.tw/httpdocs/index.php(94): require('...')
--> PHP Fatal error: MySQL error 1054: Unknown column 'p.sidebox_sort_orderASC' in 'order clause' :: SELECT *
FROM ezpages p
WHERE p.alt_url_external = ''
AND (
(p.status_header = 1 AND p.header_sort_order > 0)
OR (p.status_sidebox = 1 AND p.sidebox_sort_order > 0)
OR (p.status_footer = 1 AND p.footer_sort_order > 0) OR p.toc_chapter IN (0)
) ORDER BY p.sidebox_sort_orderASC, p.header_sort_orderASC, p.footer_sort_orderASC ==> (as called by) /var/www/vhosts/hz.com.tw/httpdocs/includes/modules/pages/sitemapxml/sitemapxml_ezpages.php on line 99 <== in /var/www/vhosts/hz.com.tw/httpdocs/includes/classes/db/mysql/query_factory.php on line 733.
Issue Summary:
The error seems to originate from ORDER BY in sitemapxml_ezpages.php, where column names are concatenated with "ASC" without a space.
The generated SQL query includes ORDER BY p.sidebox_sort_orderASC, p.header_sort_orderASC, p.footer_sort_orderASC, which is not valid SQL syntax.
This results in MySQL error 1054 (Unknown column 'p.sidebox_sort_orderASC').
Steps to Reproduce:
Install SitemapXML v4.0.4 on Zen Cart 2.1.0.
Run the sitemap rebuild via:
https://hz.com.tw/index.php?main_pag...ml&rebuild=yes
The error occurs when generating the Ezpages Sitemap.
Possible Cause:
In sitemapxml_ezpages.php, the ORDER BY clause is constructed dynamically:
$order_by_elements = explode(',', SITEMAPXML_EZPAGES_ORDERBY);
If SITEMAPXML_EZPAGES_ORDERBY is missing spaces between column names and ASC, the query becomes invalid.
Temporary Fix:
I manually checked sitemapxml_ezpages.php and ensured that ORDER BY is formatted correctly:
ORDER BY p.sidebox_sort_order ASC, p.header_sort_order ASC, p.footer_sort_order ASC
This resolved the issue.
Request:
Could you confirm whether this is a bug in v4.0.4 and whether an official patch will be released?
If needed, I can provide additional debugging details.
Thanks for your help!
Best regards,
[showren]
Bookmarks