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


Please do not falsify my words. Are you interested in knowing who does it? Send me a PM.

The Phoenix Club won't allow me to join - why not?

Setting up a new Frozen site with so many nice addons available on the market. 

:heart: 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


Please do not falsify my words. Are you interested in knowing who does it? Send me a PM.

The Phoenix Club won't allow me to join - why not?

Setting up a new Frozen site with so many nice addons available on the market. 

:heart: 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

A new version has been uploaded. It includes the missing security code mentioned previously.

Share this post


Link to post
Share on other sites

Thank you very much Jack @Jack_mcsfor your support of the OSC community.

Especially for your excellent support and for SHARING.

Cheers

Valqui


Please do not falsify my words. Are you interested in knowing who does it? Send me a PM.

The Phoenix Club won't allow me to join - why not?

Setting up a new Frozen site with so many nice addons available on the market. 

:heart: Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Jack,

THANKS FOR THIS GREAT ADD ON.

The insertion of the "Manual IP" text during the install works fine - However when an individual tries to update the IP they are greeted with this error

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's with a comma.- Manual mode only')' at line 1

insert into configuration_changes (change_date,previous_setting,new_setting,change_title,change_description) values (now(),'127.0.0.1','XXX.XXX.XXX.XX','Manual IP','Enter the IP that you want to cause the manual run to happen. Separate muliple IP's with a comma.- Manual mode only')

[TEP STOP]

It is caused by this portion of the configuration text

" Separate muliple IP's with a comma."

removing the apostrophe removes the error.  As long as you are correcting it - there is also a "t" missing from the word multiple

BJ

Share this post


Link to post
Share on other sites
5 hours ago, Chadduck said:

It is caused by this portion of the configuration text

It works fine for me as is in my shop and in others I've it into. Maybe it has to do with the version of your shop and/or php/MySQ.

Share this post


Link to post
Share on other sites
11 hours ago, Jack_mcs said:

Maybe it has to do with the version of your shop and/or php/MySQ.

Ubuntu 18.04.3 LTS
MySQL Server version: 5.7.28-0ubuntu0.18.04.4
PHP version: 7.2.24-0ubuntu0.18.04.1

Share this post


Link to post
Share on other sites

If you used the php script to install the database, I can't think of a reason why it should fail. I haven't tried it in the latest Phoenix version so I suppose that could be an issue, though it seems unlikely.

Share this post


Link to post
Share on other sites

Dunno... As I pointed out originally once I removed the apostrophe the IP update went right through.

I simply thought you would want to know which is why I cut and pasted the sql error.

 

Share this post


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

I simply thought you would want to know which is why I cut and pasted the sql error.

I do appreciate it. Even though I can't reproduce it, others may have the problem and your fix might help them. Thank you for posting it.

Share this post


Link to post
Share on other sites

No problem - and again thanks for your wonderful mods. I certainly appreciate them as I am sure the entire OSC community does.

Share this post


Link to post
Share on other sites
       array("INSERT INTO configuration (" . $fields_short . ") VALUES ('Manual IP', 'GOOGLE_XML_SITEMAP_MANUAL_IP', '127.0.0.1', 'Enter the IP that you want to cause the manual run to happen. Separate muliple IP\'s with a comma.- <b>Manual mode only</b>', '" . $cfg_group_id . "', '" . ($sortID++) . "', now())"),

There the unnecessary apostrophe is escaped properly. 

insert into configuration_changes

Now that's interesting.  What is configuration_changes and why is something being inserted into it?  Might it possibly be some other change to your site that make it different?  If you figure out what inserts things in configuration_changes, you might know what is breaking.  Then you can fix that so that it escapes apostrophes properly. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
On 12/4/2019 at 3:21 PM, Chadduck said:

The insertion of the "Manual IP" text during the install works fine - However when an individual tries to update the IP they are greeted with this error 

Found it.  The App is called Store Configuration Monitor and it has a bug in its helper functions.  In admin/includes/functions/general.php change the two functions to

function tep_configuration_update($cID, $configuration_value) {
        $configuration_values_query = tep_db_query("select configuration_value, configuration_title, configuration_description from configuration where configuration_id = '" . (int)$cID . "'");
        $configuration_values = tep_db_fetch_array($configuration_values_query);
        tep_db_query("insert into configuration_changes (change_date,previous_setting,new_setting,change_title,change_description) values (now(),'". tep_db_input(tep_db_prepare_input($configuration_values['configuration_value'])) ."','". tep_db_input(tep_db_prepare_input($configuration_value)) ."','". tep_db_input(tep_db_prepare_input($configuration_values['configuration_title'])) ."','". tep_db_input(tep_db_prepare_input($configuration_values['configuration_description']))."')");

        // Check to see if the configuration value changed is the Store Owner's Email address - if it is send a configuration change notification to the existing Email address on file.
        if($cID == 3) {
          tep_mail(STORE_OWNER, $configuration_values['configuration_value'], EMAIL_CONFIGURATION_CHANGE_TEXT_SUBJECT, EMAIL_CONFIGURATION_CHANGE_TEXT_BODY, STORE_OWNER, $configuration_values['configuration_value']);
        }
        tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_CONFIGURATION_CHANGE_TEXT_SUBJECT, EMAIL_CONFIGURATION_CHANGE_TEXT_BODY, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}

function tep_module_change($action, $class) {
        tep_db_query("insert into configuration_changes (change_date,previous_setting,new_setting,change_title,change_description) values (now(),'','". tep_db_input(tep_db_prepare_input($action)) ."','". tep_db_input(tep_db_prepare_input($class)) ."','')");
        tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_CONFIGURATION_CHANGE_TEXT_SUBJECT, EMAIL_CONFIGURATION_CHANGE_TEXT_BODY, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}

Then you should be able to update values normally in admin. 

Edited by ecartz

Always back up before making changes.

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

×