Missing argument 3 for usu5_create_sitemap_set(), called in /xxx/xxx/xxx/xxx/sitemaps/index.php on line 43 and defined in /xxx/xxx/xxx/xxx/sitemaps/index.php on line 49
and the 4 sitemap files should be placed in the "sitemap" dir and not on the "usu5_sitemaps/" wich doesnt even exist upon instalation and described in the instructions.txt file inside the "sitemap" dir.
cron job also has to be corrected
Ultimate SEO Urls
Bug when generating the sitemap files - Ultimate SEO Urls
Re: Bug when generating the sitemap files
[02-Apr-2021 00:07:15 Europe/Lisbon] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function usu5_create_sitemap_set(), 2 passed in /xxx/xxx/xxx/xxx/sitemaps/index.php on line 43 and exactly 3 expected in /xxx/xxx/xxx/xxx/sitemaps/index.php:49
Stack trace:
#0 /xxx/xxx/xxx/xxx/sitemaps/index.php(43): usu5_create_sitemap_set('english', 'en')
#1 {main}
thrown in /xxx/xxx/xxx/xxx/sitemaps/index.php on line 49
Using only 1 language file.
PHP 7.4.16
Phoenix 1.0.8.1 Clean Instalation
Only sitemapIndex.xml is created.
Stack trace:
#0 /xxx/xxx/xxx/xxx/sitemaps/index.php(43): usu5_create_sitemap_set('english', 'en')
#1 {main}
thrown in /xxx/xxx/xxx/xxx/sitemaps/index.php on line 49
Using only 1 language file.
PHP 7.4.16
Phoenix 1.0.8.1 Clean Instalation
Only sitemapIndex.xml is created.
-
- Posts: 31
- Joined: Sun Feb 28, 2021 8:03 pm
- Contact:
Re: Bug when generating the sitemap files
I'm sorry I tested latest version with more than one languages. Will fix it.
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Bug when generating the sitemap files
Please replace content of sitemaps/index.php with this one and let me know if it works:
Code: Select all
<?php
/**
*
* ULTIMATE Seo Urls (version 3.0.3)
*
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU Public License
* Copyright 2021 JMC
* Portions Copyright 2008-2009 FWR Media, 2005 Bobby Easland
* @Id: index.php
*
*/
chdir( '../' );
include_once 'includes/application_top.php';
if ( !defined( 'USU_ENABLED' ) || ( USU_ENABLED != 'True' )){
die ('USU is not installed');
}
if (count ( usu_Main::i()->getVar( 'catalog_languages' ) ) > 1 ) {
$languages_query = tep_db_query( "select languages_id, name, code, image, directory from languages order by sort_order" );
$current_language = '';
$languages_array = array();
while ( $languages = tep_db_fetch_array( $languages_query ) ) {
$languages_id = $languages['languages_id'];
$language = $languages['directory'];
usu_Main::i()->initiate( array(), $languages_id, $language, true );
usu5_create_sitemap_set( $languages['directory'], $languages['code'] );
$languages_array[] = $languages;
}
usu5_xml_init( $doc, $root, true );
foreach ( $languages_array as $index => $language_data ) {
$filename_suffix = ( $language_data['code'] == DEFAULT_LANGUAGE ) ? '.xml' : '_' . $language_data['directory'] . '.xml';
create_single_sitemap_index( $doc, $root, $filename_suffix );
}
usu5_xml_exists( $doc, 'sitemapIndex.xml' );
} else {
usu5_xml_init( $doc, $root, true );
create_single_sitemap_index( $doc, $root );
usu5_xml_exists( $doc, 'sitemapIndex.xml' );
usu5_create_sitemap_set( $language, DEFAULT_LANGUAGE );
}
include_once 'includes/application_bottom.php';
function usu5_create_sitemap_set( $language_directory, $languages_code ) {
$filename_suffix = ( $languages_code == DEFAULT_LANGUAGE ) ? '.xml' : '_' . $languages_code . '.xml';
// Begin products
$detail = array();
usu5_xml_init( $doc, $root);
$query = "SELECT products_id, products_date_added, products_last_modified FROM products ORDER BY products_last_modified DESC, products_date_added DESC";
$result = tep_db_query( $query );
$count = 1;
while ( $row = tep_db_fetch_array( $result ) ) {
$detail = array( 'url' => tep_href_link( 'product_info.php', 'products_id=' . (int)$row['products_id'], 'SSL' ),
'lastmod' => ( strtotime( $row['products_last_modified'] ) > strtotime( $row['products_date_added'] ) ) ? date( "Y-m-d", strtotime( $row['products_last_modified'] ) ) : date( "Y-m-d", strtotime( $row['products_date_added'] ) ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail );
}
if ( phoenix_min_version('1.0.8.1') ) {
$result ->free_result();
} else {
tep_db_free_result( $result );
}
usu5_xml_exists( $doc, 'sitemapProducts' . $filename_suffix );
// End products
// Begin Manufacturers
$detail = array();
usu5_xml_init( $doc, $root);
$query = "SELECT m.manufacturers_id, m.date_added, m.last_modified FROM manufacturers m ORDER BY m.last_modified DESC, m.date_added DESC";
$result = tep_db_query( $query );
$count = 1;
while ( $row = tep_db_fetch_array( $result ) ) {
$link = tep_href_link( 'index.php', 'manufacturers_id=' . (int)$row['manufacturers_id'] . '&view=all', 'SSL', false) ;
$detail = array( 'url' => $link,
'lastmod' => ( strtotime( $row['last_modified'] ) > strtotime( $row['date_added'] ) ) ? date( "Y-m-d", strtotime( $row['last_modified'] ) ) : date( "Y-m-d", strtotime( $row['date_added'] ) ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail );
}
if ( phoenix_min_version('1.0.8.1') ) {
$result ->free_result();
} else {
tep_db_free_result( $result );
}
usu5_xml_exists( $doc, 'sitemapManufacturers' . $filename_suffix );
// End Manufacturers
// Begin categories xml
$detail = array();
usu5_xml_init( $doc, $root);
$categories = buildCategoriesCache();
foreach ( $categories as $cid => $detail ) {
if( preg_match( '@[0-9_]@', $detail['path'] ) ) {
$detail = array( 'url' => tep_href_link( 'index.php', 'cPath=' . $detail['path'] . '&view=all', 'SSL', false ),
'lastmod' => date( "Y-m-d", strtotime($detail['last_mod'] ) ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail );
}
}
usu5_xml_exists( $doc, 'sitemapCategories' . $filename_suffix );
// End categories xml
// Begin other pages
// End other pages
} // end function
function usu5_xml_exists( $doc, $file ) {
$filepath = realpath( dirname( __FILE__ ) . '/../' ) . '/' . $file;
if ( !is_readable( $filepath ) ) {
if ( $fp = fopen( $filepath, 'w+' ) ) {
fclose( $fp );
} else {
return trigger_error( __FUNCTION__ . ' could not open ' . $file, E_USER_WARNING );
}
}
$doc->save( $filepath );
}
function usu5_xml_init( &$doc, &$root, $index = false ) {
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
if ( false === $index ) {
$root = $doc->createElement( "urlset" );
} else {
$root = $doc->createElement( "sitemapindex" );
}
$root->setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");
$doc->appendChild( $root );
}
function usu5_node_create( &$doc, &$root, $detail, $index = false ) {
if ( false === $index ) {
$parent = $doc->createElement( "url" );
} else {
$parent = $doc->createElement( "sitemap" );
}
$current = $doc->createElement( "loc" );
$current->appendChild(
$doc->createTextNode( $detail['url'] ) );
$mod = $doc->createElement( "lastmod" );
$mod->appendChild(
$doc->createTextNode( $detail['lastmod'] ) );
$freq = $doc->createElement( "changefreq" );
$freq->appendChild(
$doc->createTextNode( $detail['freq'] ));
$priority = $doc->createElement( "priority" );
$priority->appendChild(
$doc->createTextNode( $detail['priority'] ));
$parent->appendChild( $current );
$parent->appendChild( $mod );
if ( false === $index ) $parent->appendChild( $freq );
if ( false === $index ) $parent->appendChild( $priority );
$root->appendChild( $parent );
}
function setCpath( $categories, $id ) {
static $entry_id, $cpatharray;
if(!isset($entry_id) || $entry_id == NULL) $entry_id = $id;
( empty( $cpatharray ) ? $cpatharray = array( $id ) : NULL );
array_push( $cpatharray, $categories[$id]['parent'] );
if( ( isset( $categories[$categories[$id]['parent']]['parent'] ) && $categories[$categories[$id]['parent']]['parent'] != '0' ) ) {
setCpath( $categories, $categories[$id]['parent'] );
}
$fwrcpath = implode( '_', array_reverse( $cpatharray ) );
if( $id == $entry_id ) {
$entry_id = NULL;
$cpatharray = array();
return $fwrcpath;
}
}
function categoriesFullScan(){
$sql = "SELECT categories_id, parent_id, date_added, last_modified FROM categories GROUP BY categories_id ORDER BY date_added ASC, last_modified ASC";
return tep_db_query($sql);
}
function buildCategoriesCache() {
$result = categoriesFullScan();
while ( $row = tep_db_fetch_array( $result ) ) {
$categories[$row['categories_id']] = array( 'id' => $row['categories_id'],
'parent' => $row['parent_id'],
'path' => '',
'last_mod' => ( strtotime( $row['last_modified'] ) > strtotime( $row['date_added'] ) ) ? $row['last_modified'] : $row['date_added'] );
}
if ( phoenix_min_version('1.0.8.1') ) {
$result ->free_result(); // Housekeeping
} else {
tep_db_free_result( $result );
}
foreach ( $categories as $cat_id => $key ) {
if ( $key['parent'] != '0' ) {
( isset( $categories[$key['parent']]['children'] ) && ( $categories[$key['parent']]['children'] !== null ) ) ? null : $categories[$key['parent']]['children'] = '';
$categories[$key['parent']]['children'] .= $key['id'] . ',';
} else {
$categories[$key['id']]['path'] .= $key['id'];
}
}
foreach ( $categories as $cat_id => $key ) {
$fullcatpath = '';
if( $key['parent'] != '0' ) {
$fullcatpath = setCpath( $categories, $key['id'] );
$categories[$key['id']]['path'] = $fullcatpath;
}
}
return $categories;
}
function create_single_sitemap_index( &$doc, &$root, $filename_suffix = '.xml' ) {
$detail = array( 'url' => tep_href_link( 'sitemapCategories' . $filename_suffix ),
'lastmod' => date( "Y-m-d" ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail, true );
$detail = array( 'url' => tep_href_link( 'sitemapProducts' . $filename_suffix ),
'lastmod' => date( "Y-m-d" ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail, true );
$detail = array( 'url' => tep_href_link( 'sitemapManufacturers' . $filename_suffix ),
'lastmod' => date( "Y-m-d" ),
'freq' => 'weekly',
'priority' => '0.5' );
usu5_node_create( $doc, $root, $detail, true );
}
-
- Posts: 96
- Joined: Thu Mar 11, 2021 2:16 am
- Contact:
Re: Bug when generating the sitemap files
Greetings,
It now seems to work perfectly generating the sitemaps files.
Excellent work
It now seems to work perfectly generating the sitemaps files.
Excellent work
-
- Posts: 31
- Joined: Sun Feb 28, 2021 8:03 pm
- Contact:
Re: Bug when generating the sitemap files
Greetings again.
Ok.. this is the wierdest of the bugs. The generated "sitemapProducts.xml" file always gives the first 3 entries with an invalid "<loc></loc>". Obvisouly when you submit it to the Google Console you get a nasty surprise.
All entries bellow that gets correctly generated. It happens on all the 3 installed language generated files.
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
Phoenix 1.0.8.0 @PHP 7.0, 7.1, 7.4
Ok.. this is the wierdest of the bugs. The generated "sitemapProducts.xml" file always gives the first 3 entries with an invalid "<loc></loc>". Obvisouly when you submit it to the Google Console you get a nasty surprise.
All entries bellow that gets correctly generated. It happens on all the 3 installed language generated files.
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc></loc>
<lastmod>2021-06-16</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
Phoenix 1.0.8.0 @PHP 7.0, 7.1, 7.4
-
- Posts: 31
- Joined: Sun Feb 28, 2021 8:03 pm
- Contact:
Re: Bug when generating the sitemap files
in case someone got the same problem as above, it happens when the products are outside a category. Move the problematic products to a proper category.
-
- Posts: 31
- Joined: Sun Feb 28, 2021 8:03 pm
- Contact: