Jump to content
Latest News: (loading..)
Jack_mcs

Google XML Sitemap SEO

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:

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

@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"

Share this post


Link to post
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.

Share this post


Link to post
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"

Share this post


Link to post
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"

Share this post


Link to post
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"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×