Hi lat9,
Thank you for your prompt response! I have followed your suggestion and successfully resolved the issue in SitemapXML v4.0.4. Here’s what I did:
1. Modifying init_sitemapxml.php
I located the SITEMAPXML_EZPAGES_ORDERBY configuration in:
/YOUR_Admin/includes/init_includes/init_sitemapxml.php
Originally, it was set as:
'SITEMAPXML_EZPAGES_ORDERBY' => [
'EZPages order by',
'p.sidebox_sort_order ASC, p.header_sort_order ASC, p.footer_sort_order ASC',
'',
60,
null,
null
],
To fix the issue, I removed the redundant ASC and updated it as:
'SITEMAPXML_EZPAGES_ORDERBY' => [
'EZPages order by',
'p.sidebox_sort_order, p.header_sort_order, p.footer_sort_order',
'',
60,
null,
null
],
2. Adjusting the ORDER BY Processing Logic
In init_sitemapxml.php, the following logic was present:
$order_by_elements = explode(',', str_replace(' ', '', SITEMAPXML_EZPAGES_ORDERBY));
foreach ($order_by_elements as $i => $element) {
if (strpos($element, 'p.') !== 0 && strpos($element, 'pt.') !== 0) {
$order_by_elements[$i] = 'p.' . $element;
}
}
$order_by = implode(', ', $order_by_elements);
This was removing all spaces, potentially causing ORDER BY p.sidebox_sort_orderASC (without a space).
To prevent this, I modified the logic:
$order_by_elements = explode(',', SITEMAPXML_EZPAGES_ORDERBY);
foreach ($order_by_elements as $i => $element) {
$element = trim($element); // Ensure spaces are preserved
if (strpos($element, 'p.') !== 0 && strpos($element, 'pt.') !== 0) {
$order_by_elements[$i] = 'p.' . $element;
}
}
$order_by = implode(', ', $order_by_elements);
Now, the ORDER BY clause correctly formats its output.
3. Updating the Database Configuration
Since Zen Cart saves configuration settings in the database, I executed the following SQL query to update the SITEMAPXML_EZPAGES_ORDERBY value:
UPDATE configuration
SET configuration_value = 'p.sidebox_sort_order, p.header_sort_order, p.footer_sort_order'
WHERE configuration_key = 'SITEMAPXML_EZPAGES_ORDERBY';
This ensures that existing settings do not retain the incorrect ASC formatting.
4. Testing and Verifying
Cleared the Zen Cart cache via Admin Panel (Tools → Template Cache → Reset).
Rebuilt the Sitemap using:
https://*******/index.php?main_page=...ml&rebuild=yes
Checked error logs (php_error.log & myDEBUG*.log), confirming that the MySQL 1054 Unknown Column error was resolved.
Everything is now working smoothly!
Thanks again for your guidance—I appreciate your continued support in maintaining and improving Zen Cart.
Best regards,
Showren
Bookmarks