Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google XML Sitemap SEO


Jack_mcs

Recommended Posts

Yes, you are correct. It seems that when I clicked to upload, I chose the 1.4 package from my files instead of the 1.14 one. I have uploaded the correct files using version 1.14a. Please try it now. My apologies to you and anyone that had trouble due to my mistake. :blush:

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

33 minutes ago, Jack_mcs said:

Yes, you are correct. It seems that when I clicked to upload, I chose the 1.4 package from my files instead of the 1.14 one. I have uploaded the correct files using version 1.14a. Please try it now. My apologies to you and anyone that had trouble due to my mistake. :blush:

As the sage and all knowing Forest Gump once said...S&%# Happens. 😀

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Latest version working fine.  Thanks.  👍

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

  • 4 weeks later...

Greetings,

Im getting this error:

1146 - Table 'naturhigia_FrozenEdge.topics' doesn't exist

SELECT c.topics_id as cID,
               c.date_added as topic_date_added,
               c.last_modified as topic_last_mod,
               MAX(p.articles_date_added) as articles_date_added,
               MAX(p.articles_last_modified) as articles_last_mod
               FROM topics c, articles_to_topics p2c
               LEFT JOIN articles p ON (p2c.articles_id = p.articles_id)
               WHERE c.topics_id = p2c.topics_id
               GROUP BY cID
            ORDER BY topic_date_added ASC, topic_last_mod ASC, articles_date_added ASC, articles_last_mod ASC

[TEP STOP]


 

running Frozen at php 7.0

any thoughts?

Edited by Owl Sauron
text not showing
Link to comment
Share on other sites

The code is trying to create links for the topics in the Article Manager addon. If you have that addon installed, then something is wrong with the database since the topics table as always part of it, as I recall. If you don't have that addon installed, then you should turn off the setting for it in the settings for this addon.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 1 month later...

@Jack_mcs

Hi,

I have installed the latest version 1.14a (my previous version was 1.0 with some fixes !) but when I enter the xml page for products or else I have a top message indicates me there is no style associated to display the page correctly (products tree appears below but no table display) :
"This XML file does not appear to have any style information associated with it. The document tree is shown below."

What is the problem ?!?
Thank you for your lights.

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

The XML styling was provided by a script someone wrote years ago. It used the google sitemap rules. But modern scripts don't use googles rules so when I switched the code to use the rules from sitemaps.org, it broke the XML code. That code was just used for human readability and is not needed for the addon to work. I may fix it at some point but since it is not important, probably not.

If you want to view the files in a browser, be sure to delete the gss.xsl file from the server. If it still doesn't display, you can use the view source in the browser. That is what the search engines actually see.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Ok, thank you for the information.
You are right <xmlns="http://www.google.com/schemas/sitemap/0.84"> is deprecated (too bad, display was nice with "gss.xsl" steelsheet).

NB: I have tested with the deprecated link above and sitemaps (product, category, index) are accepted anyway...


 

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

Here is my contribution for 2.3.x users : Sitemap images file with "new large product images" add.*

*Just 2 functions to replace in "googlesitemap/sitemap.class.php" file (from latest package v1.14a):
- GenerateSitemapImages($data, $file)
- GenerateImagesSitemap()

1a. Edit "sitemap.class.php" file, and find at line 682 :

	function GenerateImagesSitemap(){
  $quotes = (defined('QUOTES_CATEGORY_NAME') ? " and customers_email_address = '' and quotes_email_address = ''" : '');
		$sql = "SELECT products_id as pID, products_image as img, products_date_added as date_added, products_last_modified as last_mod, products_ordered 
			    FROM products 
				WHERE products_status='1'" . $quotes . "
				ORDER BY products_ordered DESC";
		if ( $products_query = tep_db_query($sql) ){
			$this->debug['QUERY']['IMAGES']['STATUS'] = 'success';
			$this->debug['QUERY']['IMAGES']['NUM_ROWS'] = tep_db_num_rows($products_query);
			$container = array();
			$number = 0;
			$top = 0;
			while( $result = tep_db_fetch_array($products_query) ){
				$top = max($top, $result['products_ordered']);
				$location = tep_href_link('product_info.php', 'products_id=' . $result['pID'], 'NONSSL', false);
    $location_base = $this->base_url;
				$lastmod = tep_not_null($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
				$changefreq = GOOGLE_SITEMAP_IMAGES_CHANGE_FREQ;
				$ratio = $top > 0 ? $result['products_ordered']/$top : 0;
				$priority = $ratio < .1 ? .1 : number_format($ratio, 1, '.', ''); 
    if ($lastmod == 0) {
       $lastmod = date("Y-m-d H:m:s");
    }
				$container[] = array('loc' => htmlspecialchars(utf8_encode($location)),
                         'img' => htmlspecialchars(utf8_encode($location_base) . 'images/' . $result['img'] ),
				                     'lastmod' => date ("Y-m-d", strtotime($lastmod)),
								               	 'changefreq' => $changefreq,
								               	 'priority' => $priority
				                     );
				if ( sizeof($container) >= 50000 ){
					$type = $number == 0 ? 'images' : 'images' . $number;
					$this->GenerateSitemapImages($container, $type);
					$container = array();
					$number++;
				}
			} # end while
			tep_db_free_result($products_query);			
			if ( sizeof($container) > 0 ) {
				$type = $number == 0 ? 'images' : 'images' . $number;
				return $this->GenerateSitemapImages($container, $type);
			} # end if			
		} else {
			$this->debug['QUERY']['IMAGES']['STATUS'] = 'false';
			$this->debug['QUERY']['IMAGES']['NUM_ROWS'] = '0';
		}
	} # end function

1b. Replace with :

	function GenerateImagesSitemap(){
		$quotes = (defined('QUOTES_CATEGORY_NAME') ? " and customers_email_address = '' and quotes_email_address = ''" : '');
		$sql = "SELECT products_id as pID, products_image as img, products_date_added as date_added, products_last_modified as last_mod, products_ordered 
		        FROM products 
		        WHERE products_status='1'" . $quotes . " 
		        ORDER BY products_ordered DESC";
		if ( $products_query = tep_db_query($sql) ){
			$this->debug['QUERY']['IMAGES']['STATUS'] = 'success';
			$this->debug['QUERY']['IMAGES']['NUM_ROWS'] = tep_db_num_rows($products_query);
			$pre_container = array();
			$container = array();
			$number = 0;
			$top = 0;
			while( $result = tep_db_fetch_array($products_query) ){
				$top = max($top, $result['products_ordered']);
				$location = $this->hrefLink(FILENAME_PRODUCT_INFO, 'products_id=' . $result['pID'], $request_type, false);
				$location_base = $this->base_url;
				$lastmod = tep_not_null($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
				$changefreq = GOOGLE_SITEMAP_IMAGES_CHANGE_FREQ;
				$ratio = $top > 0 ? $result['products_ordered']/$top : 0;
				$priority = $ratio < .1 ? .1 : number_format($ratio, 1, '.', '');
				
				if ($lastmod == 0) {
					$lastmod = date("Y-m-d H:m:s");
				}
				
				$pimage_query = tep_db_query("SELECT image as pimg 
				                              FROM products_images 
				                              WHERE products_id = '" . $result['pID'] . "' 
				                              ORDER BY sort_order ASC");
				$pimg = array();
				if (tep_db_num_rows($pimage_query) > 0){
					$pimg = '';
					while( $pimage = tep_db_fetch_array($pimage_query) ){
						$pimg[] = $pimage['pimg'];
					}
				}
				
				$pre_container = array('loc' => htmlspecialchars(utf8_encode($location)),
				                       'lastmod' => date ("Y-m-d", strtotime($lastmod)),
				                       'changefreq' => $changefreq,
				                       'priority' => $priority,
				                       'img' => htmlspecialchars(utf8_encode($location_base) . 'images/' . $result['img'])
				                       );
				foreach ($pimg as $key => $val ) {
					$pre_container['pimg_'.$key] =  htmlspecialchars(utf8_encode($location_base) . 'images/' . $val);
				}
				
				$container[] = $pre_container;
				
				if ( sizeof($container) >= 50000 ){
					$type = $number == 0 ? 'images' : 'images' . $number;
					$this->GenerateSitemapImages($container, $type);
					$container = array();
					$number++;
				}
			} # end while
			
			tep_db_free_result($products_query);			
			if ( sizeof($container) > 0 ) {
				$type = $number == 0 ? 'images' : 'images' . $number;
				return $this->GenerateSitemapImages($container, $type);
			} # end if
		} else {
			$this->debug['QUERY']['IMAGES']['STATUS'] = 'false';
			$this->debug['QUERY']['IMAGES']['NUM_ROWS'] = '0';
		}
	} # end function


2a. Find at line 505 :

	function GenerateSitemapImages($data, $file){
		$content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
		$content .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
                $content .= 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n";
		foreach ($data as $url){
			$content .= "\t" . '<url>' . "\n";
			$content .= "\t\t" . '<loc>'.$url['loc'].'</loc>' . "\n";
                        $content .= "\t\t" . '<image:image>' . "\n";
                        $content .= "\t\t" . '<image:loc>' . $url['img'] . '</image:loc>' . "\n";
                        $content .= "\t\t" . '</image:image>' . "\n";
                        $content .= "\t\t" . '<lastmod>'.$url['lastmod'].'</lastmod>' . "\n";
                        $content .= "\t\t" . '<changefreq>'.$url['changefreq'].'</changefreq>' . "\n";
                        $content .= "\t\t" . '<priority>'.$url['priority'].'</priority>' . "\n";
                        $content .= "\t" . '</url>' . "\n";
		} # end foreach
		$content .= '</urlset>';
		return $this->SaveFile($content, $file);
	} # end function

2b. Replace with :

	function GenerateSitemapImages($data, $file){
		$content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
		$content .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
		$content .= 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n";
		foreach ($data as $url){
			$content .= "\t" . '<url>' . "\n";
			$content .= "\t\t" . '<loc>'.$url['loc'].'</loc>' . "\n";
			foreach ($url as $key => $val) {
				switch(substr($key,0,5)) {
					case "img":
					case "pimg_":
					$content .= "\t\t" . '<image:image>' . "\n";
					$content .= "\t\t" . '<image:loc>' . $val . '</image:loc>' . "\n";
					$content .= "\t\t" . '</image:image>' . "\n";
					break;
				}
			} # end foreach
			$content .= "\t\t" . '<lastmod>'.$url['lastmod'].'</lastmod>' . "\n";
			$content .= "\t\t" . '<changefreq>'.$url['changefreq'].'</changefreq>' . "\n";
			$content .= "\t\t" . '<priority>'.$url['priority'].'</priority>' . "\n";
			$content .= "\t" . '</url>' . "\n";
		} # end foreach
		$content .= '</urlset>';
		return $this->SaveFile($content, $file);
	} # end function

Enjoy ! :)



 

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

Sorry, for purists, in 1b, change this sentence :

$location = $this->hrefLink(FILENAME_PRODUCT_INFO, 'products_id=' . $result['pID'], $request_type, false);

By this one :

$location = tep_href_link('product_info.php', 'products_id=' . $result['pID'], 'NONSSL', false);

 

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

  • 3 months later...

Upload and run the google_xml_sitemap_seo_install.php file. Select delete and then run again to reload the database settings. Then upload the googlesitemap directory to the same location on the server, overwriting all of is files. Then delete any of the sitemap files in the root that you don't use.  

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 5 weeks later...

I tried this on a new blank website with only one product and no category, it threw an error about arrays. I created a new category (so I had one) and the errors when away. Maybe state that in the installation manual.

Working now Thankyou. :)

Link to comment
Share on other sites

  • 4 weeks later...
36 minutes ago, boelle said:

how can i mod the scripts so it saves the sitemaps to a folder and not in the root?

Find this line in googlesitemap/sitemap.class.php

  $this->base_url = $domain_name;

and add this above it

$this->savepath .= '/sub directory name/';

I haven't tried the above but it is my best guess. If you do that, you have to change the path to it in your google WMT account and in the robots file or the maps will not be found.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

tried this:

 

		    $this->savepath = substr(DIR_FS_CATALOG, 0, - $pos - 1);      //not returning right above - quick fix for now
  		  $this->savepath .= (substr($this->savepath, -1) !== '/') ? '/' : ''; //append a slash if needed
		} else {
      $this->savepath = DIR_FS_CATALOG . ((substr(DIR_FS_CATALOG, -1) !== '/') ? '/' : '');
  }
  $this->savepath .= 'sitemaps/';
  $this->base_url = $domain_name;

and also this one

		    $this->savepath = substr(DIR_FS_CATALOG, 0, - $pos - 1);      //not returning right above - quick fix for now
  		  $this->savepath .= (substr($this->savepath, -1) !== '/') ? '/' : ''; //append a slash if needed
          $this->savepath .= 'sitemaps/';
		} else {
      $this->savepath = DIR_FS_CATALOG . ((substr(DIR_FS_CATALOG, -1) !== '/') ? '/' : '');
  }
  
  $this->base_url = $domain_name;

 

Link to comment
Share on other sites

I'm sorry but altering the code to fit individual needs is beyond the scope of a support thread, at least for me. I would have to test the change to see where the problem is at and what the actual change should be and I don't have the time for that.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 3 weeks later...

Hi there

in the pages part of this addon I see you can disallow a page so my question is

On my site index.php is re-directed to home https://www.mysite.com.au/

index.php is in my sitemap but google rightly has chosen https://www.mysite/ as the canonical tag.

Is there a way instead of having index.php in the sitemap have https://www.mysite.com.au/

or should  I just add index.php to the disallow list.  

Edited by douglaswalker
spelling mistake
Link to comment
Share on other sites

In answer to your questions, there's no way to remove the index.php from the url short of editing the code for that special case.

But the sitemap won't override the canonical - it's the other way around. So it doesn't matter that there is a link to index.php in the sitemap file. There will also be a link to it, maybe many, in the shop. It's a non-issue.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

If you are redirecting index,php to the root, then you don't want to be submitting that URL in a sitemap. You should be submitting the root URL. If it's not easily possible with code, then hopefully it will be possible just to remove that entry form the sitemap, Google will still index the root URL. Also webmaster tools will alert with an error if you do have index.php in a sitemap, whilst there is a 301 redirect on it.

Any links in your script should be changed over to the root domain URL, otherwise you're linking to a perpetual redirect.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...