Jump to content
Jack_mcs

Google XML Sitemap SEO

Recommended Posts

Hello Jack, @Jack_mcs how are you?

Sorry, I got confused by topic in my last question :unsure: .

This addon (Google XML Sitemap SEO)  generates an XML file sitemapimages.xml that contains all the images of the site if I am not wrong....

Now for what I saw in my web site it only covers the main image of the product.
If I add a Large Image (or several) they are not added to the sitemapimages.xml file.

That's right?

Best regards

Valqui


Setting up a new Frozen site with so many nice addons available on the market and waiting to be admitted to Phoenix club!

Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Hi Valquiria . :) The sitemapimages.xml only contains the main image for the product. The main image is stored in the products table but any additional images are stored in the products_images table and the code in this addon doesn't access that table. It would be possible but would not be a simple code change.

Share this post


Link to post
Share on other sites

Thank you very much  Jack, @Jack_mcs  for the clarification of the doubt.

In my opinion it would be interesting and necessary to add those images in future updates of this addon, do not you think the same?

Best regards

Valqui


Setting up a new Frozen site with so many nice addons available on the market and waiting to be admitted to Phoenix club!

Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Yes, I think it would be helpful. It was requested for the google base feeder too. I added it to that addon and will to this one eventually but it will be quite a while before I can get to it.

Share this post


Link to post
Share on other sites

If you are asking if this addon is necessary, then yes, it is. All of the search engines look for sitemaps so having one will help your site.

Share this post


Link to post
Share on other sites

Just started using this but for some reason i cant get the cron job to work. The command suggested by my host is "/usr/local/bin/ea-php56 /***/***/public_html/googlesitemap/index.php". Have also tried "php /***/***/public_html/googlesitemap/index.php" and neither work. If triggered manually it updates, any have a suggestion?

Thanks

Share this post


Link to post
Share on other sites

Try this, after adjusting the locations to fit your server:

cd /home/***/public_html/googlesitemap/; /usr/local/bin/php -c /home/***/public_html/php.ini -q /home/***/public_html/googlesitemap/index.php

If that doesn't work, ask your host to let you know what the cron error is. Or change the email address in cron to a working one, assuming it isn't already set that way, and see what the email says.

Share this post


Link to post
Share on other sites
On 5/8/2019 at 12:55 AM, boelle said:

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

I just started using this addon in my v2.3.4.1 CE.

I noticed that anybody knowing the name of googlesitemap directory can run the sitemap creation. This may not be harmful, but the result page revealed my full Cpanel path, including my user id.
I first renamed the directory.  This also required some code changes, which I made.  I also protected the directory with .htaccess:

Require ip my.server.ip
Require forward-dns  my.dynamic.vpn.adddress

This code seems to have no effect, whether it is in application_top.php or not:

  /**** Begin Google Sitemap Manual Run ****/
  if (strpos(GOOGLE_XML_SITEMAP_MANUAL_IP, $_SERVER['REMOTE_ADDR']) !== FALSE) {
      $future_date = strtotime('+' . GOOGLE_XML_SITEMAP_MANUAL_RUN . ' day');
      if ($future_date <= date('Y-m-d')) {
          tep_redirect(HTTP_SERVER . DIR_WS_HTTPS_CATALOG . 'googlesitemap/index.php');  //   
      }
  }
  /**** End Google Sitemap Manual Run ****/

Did I miss something?

 

Share this post


Link to post
Share on other sites
36 minutes ago, vmn said:

I noticed that anybody knowing the name of googlesitemap directory can run the sitemap creation.

You could use the Secure IP option in the settings.

Share this post


Link to post
Share on other sites
1 hour ago, Jack_mcs said:

You could use the Secure IP option in the settings.

I could not find any reference to GOOGLE_XML_SITEMAP_SECURE_IP in the code.

Share this post


Link to post
Share on other sites

I see the code in my shop but not in the package. I must have forgot to include it or deleted in an earlier version. I do apologize for the mistake. To fix it, edit the googlesitemap/index.php file and find this line:

  include_once('includes/application_top.php');

and add this below it:

  if (! empty(GOOGLE_XML_SITEMAP_SECURE_IP)) {
     $safe_ips = explode(',', GOOGLE_XML_SITEMAP_SECURE_IP);
  
     if (! in_array($_SERVER['REMOTE_ADDR'], $safe_ips)) {
        header("location:http:127.0.0.1");
     }
  }

 

Share this post


Link to post
Share on other sites

Thanks,  GOOGLE_XML_SITEMAP_SECURE_IP  is working now.

Share this post


Link to post
Share on other sites

I could not get the running from command-line to work without the following changes.

My catalog resides in a sub-folder where I also wanted to put the sitemap. I'm redirecting all traffic pointing to document root to a sub-folder  called portal.
The direcotry structure is:
/
/portal
/shop

Maybe this is why it did not work.

in index.php

after
  include_once('includes/application_top.php');
 
insert
 
  $run_env = php_sapi_name();
  echo 'Environment:' . $run_env . "\n";
 
  if ($run_env === 'cli' || $run_env === 'cgi-fcgi') {
    //DO NOT CHECK IP
  }
  else {
    if (! empty(GOOGLE_XML_SITEMAP_SECURE_IP)) {
        $safe_ips = explode(',', GOOGLE_XML_SITEMAP_SECURE_IP);
    
        if (! in_array($_SERVER['REMOTE_ADDR'], $safe_ips)) {
            header("location:http:127.0.0.1");
        }
    }
  }
 
 
after
          echo 'For your convenience here is the <strong>CRON command</strong> for your site:' . "\n\n";
replace          
          echo "\t" . '<strong>php ' . dirname($_SERVER['SCRIPT_FILENAME']) . '/index.php</strong>' . "\n\n";
with          
          echo "\t" . '<strong>php ' .  __FILE__  . '</strong>' . "\n\n";


in sitemap.class.php

before
        $this->base_url = $domain_name;
add
        $run_env = php_sapi_name();
        if ($run_env === 'cli' || $run_env === 'cgi-fcgi') {
            if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'this->savepath:' . $this->savepath . "\n";    
            $temp = getcwd();
            $temp .= (substr($temp, -1) !== '/') ? '/' : ''; //append a slash if needed
            if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'temp:' . $temp . "\n";
            if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'DIR_FS_CATALOG:' . DIR_FS_CATALOG . "\n";    
            $this->savepath = substr($temp, 0, strpos($temp, DIR_FS_CATALOG)) . $this->savepath;    
            if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'this->savepath:' . $this->savepath . "\n";
        }        

I noticed that categories are retrieved multiple times (in all shop languages):

find
        $sql = "SELECT c.categories_id as cID, c.date_added, c.last_modified as last_mod
replace
        $sql = "SELECT distinct c.categories_id as cID, c.date_added, c.last_modified as last_mod


after
    $path = (($pos = strpos(DIR_FS_CATALOG, "googlesitemap")) !== FALSE) ? substr(DIR_FS_CATALOG, 0, -strlen('googlesitemap') - $slash) : DIR_FS_CATALOG;
insert
    $run_env = php_sapi_name();
    if ($run_env === 'cli' || $run_env === 'cgi-fcgi') {
        if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'path:' . $path . "\n";    
        $temp = getcwd();
        $temp .= (substr($temp, -1) !== '/') ? '/' : ''; //append a slash if needed
        if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'temp:' . $temp . "\n";
        if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'DIR_FS_CATALOG:' . DIR_FS_CATALOG . "\n";    
        $path = substr($temp, 0, strpos($temp, DIR_FS_CATALOG)) . $path;    
        if (GOOGLE_XML_SITEMAP_SHOW_DIAGNOSTIC == 'true') echo 'path:' . $path . "\n";
    }        

 

There is some unnecessary stuff, e.g.:
class MySQL_DataBase (because DB handling is done in the core).

I removed all usage of the class MySQL_DataBase.

 

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

×