Forums / All Other Contributions/Addons / SitemapXML v4 [Support thread]

SitemapXML v4 [Support thread]

Results 1 to 20 of 40
29 Sep 2020, 16:33
#1
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

SitemapXML v4 [Support thread]

uploading shortly a new update for Site Map XML to version 4 for ZC1.5.7 if accepted, should show up on it's own. If you are interested in helping out, got some ideas or just want something to play with, GitHub location.

I still have some things I want to play with, but for now as is it's working as before on ZC1.5.7 and PHP7.4 with allot easier install. A number of files was changed or deleted, thus I would not suggest this as a easy update, but a new install.
29 Sep 2020, 21:46
#2
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Posts:
2,850
Plugin Contributions:
3

Re: SitemapXML v4 [Support thread]

Thanks for the effort, duly noted.
03 Oct 2020, 23:48
#3
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

If you use the EzPage template, it was pointed out that the language wasn't following along. Actually, it had some issues with tables and such so I cleaned it up and push to GitHub. I have no way to test it, so if you do, please let me know it it's working as you would expect it to.. Thanks..
06 Oct 2020, 10:12
#4
vasilt avatar

vasilt

New Zenner

Join Date:
Jan 2006
Posts:
44
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

Thanks for the work on this plugin. I noticed a few things. First, \includes\templates\template_default\sitemapxml\html_header.php has a missing closing curly bracket. Second, the first parameter passed to the $snifer->field_exists and $sniffer->table_exists in \includes\modules\pages\sitemapxml\sitemapxml_ezpages.php should be without quotes. And third, TABLE_EZPAGES_TEXT is used but TABLE_EZPAGES_CONTENT should be used instead in \includes\modules\pages\sitemapxml\sitemapxml_ezpages.php. With these modifications I was able to generate the three xml files for categories, products and ezpages. Haven't tried the others.
06 Oct 2020, 14:53
#5
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

vasilt:

Thanks for the work on this plugin. I noticed a few things. First, \includes\templates\template_default\sitemapxml\html_header.php has a missing closing curly bracket. Second, the first parameter passed to the $snifer->field_exists and $sniffer->table_exists in \includes\modules\pages\sitemapxml\sitemapxml_ezpages.php should be without quotes. And third, TABLE_EZPAGES_TEXT is used but TABLE_EZPAGES_CONTENT should be used instead in \includes\modules\pages\sitemapxml\sitemapxml_ezpages.php. With these modifications I was able to generate the three xml files for categories, products and ezpages. Haven't tried the others.


Looks like header page got cut short... ezpage is in Github not the download yet as pointed out in the post.. still working on some things to add..
well push up the corrected header file too..
06 Oct 2020, 15:40
#6
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

pushed to Github fixes for bugs pointed out as well code changes.

- bug.. Undefined table sent to be sniffed out. plugins that may or may not exist for all users.
- Change in ezpage, no need to sniff out what exists in ZC1.5.7!

Still working on some ideas before sending in an update.
06 Oct 2020, 18:36
#7
jadebox avatar

jadebox

New Zenner

Join Date:
Jul 2009
Posts:
15
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

Dave,

I was just experimenting with your plug-in (as pulled from github). It wouldn't install through Zen Cart until I changed:

$this->executeInstallerSql($sql);

to

$db->Execute($sql);

in ScriptedInstaller.php.

After that, it seemed to work.

One nitpick ... the "Create Sitemap's" button text should be "Create Sitemaps" in \admin\includes\languages\english\sitemapxml.php.
06 Oct 2020, 19:53
#8
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

jadebox:

Dave,

I was just experimenting with your plug-in (as pulled from github). It wouldn't install through Zen Cart until I changed:

$this->executeInstallerSql($sql);

to

$db->Execute($sql);

in ScriptedInstaller.php.

After that, it seemed to work.

One nitpick ... the "Create Sitemap's" button text should be "Create Sitemaps" in \admin\includes\languages\english\sitemapxml.php.

$this->executeInstallerSql($sql);
should work on ZC1.5.7 as is... I use $db->Execute($sql); for debugging but not having any issues with a vanilla install with the default $this->executeInstallerSql($sql); statement.. What's the environment?

Difference in spell check... but such is why language files are created for..
06 Oct 2020, 20:04
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: SitemapXML v4 [Support thread]

davewest:

$this->executeInstallerSql($sql);
should work on ZC1.5.7 as is... I use $db->Execute($sql); for debugging but not having any issues with a vanilla install with the default $this->executeInstallerSql($sql); statement.. What's the environment?

Difference in spell check... but such is why language files are created for..

Dave, it's not a difference in spell check. The difference is between possessive (its) and contractions (it's = it is). In this case, it's the difference between plural (Sitemaps) and contractions (Sitemap's = Sitemap is).
07 Oct 2020, 01:46
#10
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

lat9:

Dave, it's not a difference in spell check. The difference is between possessive (its) and contractions (it's = it is). In this case, it's the difference between plural (Sitemaps) and contractions (Sitemap's = Sitemap is).


LOL.. After 70 some years you think I could figure it out... nop... 3's and E's still can't tell the difference.. I'm told quite often NOP is spelled wrong too...

pushed an update for the spelling...
13 Oct 2020, 04:46
#11
jadebox avatar

jadebox

New Zenner

Join Date:
Jul 2009
Posts:
15
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

davewest:

$this->executeInstallerSql($sql);
should work on ZC1.5.7 as is... I use $db->Execute($sql); for debugging but not having any issues with a vanilla install with the default $this->executeInstallerSql($sql); statement.. What's the environment?


Sorry, I'm not sure what the difference is or was. Looking at the code, maybe the sql was bad and switching to $db->Execute masked it. But that wouldn't explain why the plug in works for me after that.
13 Oct 2020, 14:39
#12
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

jadebox:

Sorry, I'm not sure what the difference is or was. Looking at the code, maybe the sql was bad and switching to $db->Execute masked it. But that wouldn't explain why the plug in works for me after that.


Which is why more info would help tracking down the problem..

currently working in this environment:
[2020-05-18] XAMPP for Linux 7.4.6-0
This version of XAMPP contains the following software releases:
- Apache 2.4.43
- MariaDB 10.4.11
- OpenSSL 1.1.1g
- PEAR 1.7.1
- PHP 7.4.6
- phpMyAdmin 5.0.2

For me, $this->executeInstallerSql($sql) does not push a log file on errors... haven't spent time to find out why..
With $db->Execute($sql) does push log files..

I'm running in strict mode to make MariaDB supper picky on installs so I can find errors in my sql statements.
20 Jan 2021, 12:35
#13
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Posts:
1,684
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

Hi Dave - I hope this finds you well. I just upgraded to 1.5.7b and installed SiteMapXML 4.0 and the plugin manager shows it installed ok - the problem is it is not generating any sitemaps. I have ticked the ones I want generated and then saved settings then rebuild all sitemap xml files and I get a 500 error plus see myDEBUG below.

anything you can do to help would be great thanks mate.

cheers,
Mike

This is the myDEBUG error;
[20-Jan-2021 23:11:27 Australia/Sydney] PHP Parse error:  syntax error, unexpected end of file in /home2/dazzler3/public_html/includes/templates/template_default/sitemapxml/html_header.php on line 40

[20-Jan-2021 23:11:27 Australia/Sydney] Request URI: /index.php?main_page=sitemapxml&rebuild=yes, IP address: 115.166.19.58
--> PHP Parse error: syntax error, unexpected end of file in /home2/dazzler3/public_html/includes/templates/template_default/sitemapxml/html_header.php on line 40.


this is the file in question - line 40 is blank at the very end of the file;

<?php
/**
 * Common Template
 *
 * outputs the html header. i,e, everything that comes before the \</head\> tag <br />
 *
 * @copyright Copyright 2003-2020 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: Zen4All 2020 May 12 Modified in v1.5.7 $
 */
/* Mobile_Detect.php old school, responsive design doesn't need scripting */

// Prevent clickjacking risks by setting X-Frame-Options:SAMEORIGIN
header('X-Frame-Options:SAMEORIGIN');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
<head>
<title><?php echo HEADING_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<?php if (defined('FAVICON')) { ?>
<link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<?php } //endif FAVICON ?>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<style>
body {
  font-family: Verdana, Geneva, sans-serif;
  font-size: small;
  }
</style>
</head>
<?php
// BOF hreflang for multilingual sites
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
  $lng = new language;
20 Jan 2021, 15:21
#14
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

shags38:

Hi Dave - I hope this finds you well. I just upgraded to 1.5.7b and installed SiteMapXML 4.0 and the plugin manager shows it installed ok - the problem is it is not generating any sitemaps. I have ticked the ones I want generated and then saved settings then rebuild all sitemap xml files and I get a 500 error plus see myDEBUG below.

anything you can do to help would be great thanks mate.

cheers,
Mike


Looks like you are missing lines 40-46... going back through my files, for some reason those lines was left out during the compression.. strange . well have to re-compress and try again... Thanks for the report.. You can find the full code on GitHub too..
  }
if (count($lng->catalog_languages) > 1) {
  foreach($lng->catalog_languages as $key => $value) {
    echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type, false) : $canonicalLink . (strpos($canonicalLink, '?') ? '&' : '?') . 'language=' . $key) . '" hreflang="' . $key . '" />' . "\n";
  }
}
// EOF hreflang for multilingual sites
20 Jan 2021, 23:22
#15
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Posts:
1,684
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

davewest:

Looks like you are missing lines 40-46... going back through my files, for some reason those lines was left out during the compression.. strange . well have to re-compress and try again... Thanks for the report.. You can find the full code on GitHub too..
  }
if (count($lng->catalog_languages) > 1) {
  foreach($lng->catalog_languages as $key => $value) {
    echo '<link rel="alternate" href="' . ($this_is_home_page ? zen_href_link(FILENAME_DEFAULT, 'language=' . $key, $request_type, false) : $canonicalLink . (strpos($canonicalLink, '?') ? '&' : '?') . 'language=' . $key) . '" hreflang="' . $key . '" />' . "\n";
  }
}
// EOF hreflang for multilingual sites


G'day Dave - thanks for that. Only 1 sitemap is being generated and I get the following notice;
'Categories Sitemap
File https://www.dazzlerscliponearrings.com.au/sitemap/sitemapcategories.xml. Written 21 items (5129 bytes), Filesize: 5138 bytes
Total: files 1, items 21 (5138 bytes), execution time 0:0.0508, db queries 43, db queries time 0:0.0457.
Ezpages Sitemap
WARNING: An Error occurred, please refresh the page and try again.'

note that Ezpages Sitemap is mentioned but not generated - it is the next one in order selected in the options (something preventing the generation going past the first one?) - not even the main sitemap is generated - no myDEBUG error has been thrown.

cheers, Mike
21 Jan 2021, 00:38
#16
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

Not sure where I got off, but the zip I sent in still has old templates and holes in some of the files... Been updating allot of mads for PHP and such... Sent in a new zip after testing it to make sure it has complete files. Please download from GitHub and replace all your files. Shouldn't need to run the installer. All the templates that create the xml files are wrong in the zip I sent in. I just checked Github to make sure my local and remote are the same and they are.

Sorry about the mix-up..
21 Jan 2021, 01:17
#17
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Posts:
1,684
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

davewest:

Not sure where I got off, but the zip I sent in still has old templates and holes in some of the files... Been updating allot of mads for PHP and such... Sent in a new zip after testing it to make sure it has complete files. Please download from GitHub and replace all your files. Shouldn't need to run the installer. All the templates that create the xml files are wrong in the zip I sent in. I just checked Github to make sure my local and remote are the same and they are.

Sorry about the mix-up..


Thanks Dave .... works a treat .... your blood is worth bottling!!

be safe

cheers, Mike
21 Jan 2021, 01:31
#18
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Posts:
1,684
Plugin Contributions:
0

Re: SitemapXML v4 [Support thread]

shags38:

Thanks Dave .... works a treat .... your blood is worth bottling!!

be safe

cheers, Mike


I may have spoken too soon Dave - sitemaps all generate but there is one issue which existed on previous versions. In electing yes to include images sitemap is pulling images from images/large/ which is adding the suffix .LRG to all image url's - I do not put my images in that /large/ folder - they are placed in a folder of another name, in this site's case the images are located in images/earrings/

Is there a file I can modify that will tell sitemap the correct folder to pull the images from?

cheers,
Mike

example url from products site map https://www.dazzlerscliponearrings.com.au/images/large/earrings/415521_LRG.jpg ... throws 404 error
21 Jan 2021, 15:40
#19
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Posts:
1,075
Plugin Contributions:
5

Re: SitemapXML v4 [Support thread]

shags38:

I may have spoken too soon Dave - sitemaps all generate but there is one issue which existed on previous versions. In electing yes to include images sitemap is pulling images from images/large/ which is adding the suffix .LRG to all image url's - I do not put my images in that /large/ folder - they are placed in a folder of another name, in this site's case the images are located in images/earrings/

Is there a file I can modify that will tell sitemap the correct folder to pull the images from?

cheers,
Mike

example url from products site map https://www.dazzlerscliponearrings.com.au/images/large/earrings/415521_LRG.jpg ... throws 404 error


It's a bit outside the suggested image setup, so would have to see how much work and what other effects it would have for others. I use the large, medium folders and suffix.. think image handler does something different.. Well see, have piles to burn yet before the snow comes.
21 Jan 2021, 16:28
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Posts:
13,980
Plugin Contributions:
46

Re: SitemapXML v4 [Support thread]

davewest:

It's a bit outside the suggested image setup, so would have to see how much work and what other effects it would have for others. I use the large, medium folders and suffix.. think image handler does something different.. Well see, have piles to burn yet before the snow comes.

FWIW, from the IH 5.1.9 readme:

If you are using IH[SUP]5[/SUP] on a site that also uses SitemapXML and have configured SitemapXML to Add Products Images, you'll need to edit one of the SitemapXML's files to allow those images to be properly reported. Editing /includes/modules/pages/sitemapxml/sitemapxml_products.php, you'll see this code-block towards the top of the file:

define('SITEMAPXML_PRODUCTS_IMAGES_SIZE', 'large');
define('SITEMAPXML_PRODUCTS_IMAGES_ADDITIONAL', 'false'); // true false
define('SITEMAPXML_PRODUCTS_IMAGES_FUNCTION', 'false'); // true false

… and you'll make the highlighted change to instruct SitemapXML to use the built-in Zen Cart function to create the images' links:

define('SITEMAPXML_PRODUCTS_IMAGES_SIZE', 'large');
define('SITEMAPXML_PRODUCTS_IMAGES_ADDITIONAL', 'false'); // true false
define('SITEMAPXML_PRODUCTS_IMAGES_FUNCTION', 'true'); // true false

I've not yet tried the SiteMapXML v4 to see if the same changes apply.