Jump to content
Jack_mcs

Sitemap SEO

Recommended Posts

I don't have it installed in that version but try changing this line

1 hour ago, artfulweb said:

if (strpos($cat['id'], (string)$current_category_id) === FALSE) continue;

to

          if (! isset($cat['id']) || (strpos($cat['id'], (string)$current_category_id) === FALSE)) continue;

Please let me know if it works so I can add it to the next version.

Share this post


Link to post
Share on other sites
8 minutes ago, Jack_mcs said:

I don't have it installed in that version but try changing this line

to


          if (! isset($cat['id']) || (strpos($cat['id'], (string)$current_category_id) === FALSE)) continue;

Please let me know if it works so I can add it to the next version.

Thanks Jack, but unfortunately it still has the same error message.

Share this post


Link to post
Share on other sites

@artfulwebI just did a quick install of 7.1 and installed this addon but I'm not getting any warnings. What are you doing to see the failure?

Share this post


Link to post
Share on other sites
Just now, Jack_mcs said:

@artfulwebI just did a quick install of 7.1 and installed this addon but I'm not getting any warnings. What are you doing to see the failure?

It does not fail, Jack, it is a warning in my logs that comes evey time someone clicks a product page so the error file becomes huge.

Share this post


Link to post
Share on other sites

@artfulwebYes, I understood what you were saying but I can't duplicate it here. I clicked all around the site but never got a warning. Are you using a non-English language? I only have English in my test shop so that might be it. Also, did you go to page control for this addon and click update? That is required to initialize it.

Share this post


Link to post
Share on other sites
7 minutes ago, Jack_mcs said:

@artfulwebYes, I understood what you were saying but I can't duplicate it here. I clicked all around the site but never got a warning. Are you using a non-English language? I only have English in my test shop so that might be it. Also, did you go to page control for this addon and click update? That is required to initialize it.

Yes Jack I have done "Update" and it occurs both in French and English. The sitemaps show no problem, just the error logs. Using Php 7.3.17

Share this post


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

Any ideas, do not know what a "needle" is?

It's the second parameter to strpos.  In this case $current_category_id


Always back up before making changes.

Share this post


Link to post
Share on other sites
3 minutes ago, ecartz said:

It's the second parameter to strpos.  In this case $current_category_id

Thanks Matt, but I am still unable to find out why the php error message in my logs.

Share this post


Link to post
Share on other sites

Try

if (empty($current_category_id) || (strpos($cat['id'], (string)$current_category_id) === false)) continue;

 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@artfulwebThe $current_category_id is a core variable and should be set for all category and product pages. It appears to be not set in your installation for some reason, though I can't think of a reason why.  You can add this line above the one you mentioned

       echo 'ID '. $cat['id'] . ' - ' . $current_category_id . '<br>';

That should display all of the category ID's in your shop as well as the current category ID. They should all be numbers or strings like 1_4. If not, there is something unique to your shop that is causing the problem. In that case, you can install a test shop and just install this addon in it. Assuming it works, you can then compare your files to find out what is causing the problem. 

Share this post


Link to post
Share on other sites
15 hours ago, ecartz said:

Try


if (empty($current_category_id) || (strpos($cat['id'], (string)$current_category_id) === false)) continue;

 

Thank you Jack, thank you Matt,

Matt's solution worked. I do not understand why there would be a problem with $current_category_id as my test site has no modifications to the category id and was a clean install of 1.0.7.1.. Do have Header Tags SEO, Ultimate SEO URLs, All Products SEO, Sitemap SEO installed so could one of those have changed something. It also shows on a client's site that he upgraded to PHOENIX 1.O.7.0 with no previous errors showing so I can not explain it. Just checked his site and added the fix and the error goes away. He upgraded from 1.0.5.0 directly to 1.0.7.0.

Thank you both.

Share this post


Link to post
Share on other sites

@artfulwebI'm glad his fix worked but it should not be necessary. I don't have the addons you mentioned installed in a 1.0.7.1 shop but none of them alter that variable.  Since I can't cause the warning, I can't find the cause of it. But if you need the fix, I suggest the following instead of what was posted since his fix will allow a needless database call to be made and an extra <div></div> to be added to the page. To apply the change I suggest, change

  if (!isset($_GET['manufacturers_id']) && SITEMAP_SEO_SHOW_INDIVIDUAL_CATEGORY_SITEMAP  == 'true') { 

to

  if (! empty($current_category_id) && !isset($_GET['manufacturers_id']) && SITEMAP_SEO_SHOW_INDIVIDUAL_CATEGORY_SITEMAP  == 'true') { 

 

Share this post


Link to post
Share on other sites
25 minutes ago, Jack_mcs said:

@artfulwebI'm glad his fix worked but it should not be necessary. I don't have the addons you mentioned installed in a 1.0.7.1 shop but none of them alter that variable.  Since I can't cause the warning, I can't find the cause of it. But if you need the fix, I suggest the following instead of what was posted since his fix will allow a needless database call to be made and an extra <div></div> to be added to the page. To apply the change I suggest, change


  if (!isset($_GET['manufacturers_id']) && SITEMAP_SEO_SHOW_INDIVIDUAL_CATEGORY_SITEMAP  == 'true') { 

to


  if (! empty($current_category_id) && !isset($_GET['manufacturers_id']) && SITEMAP_SEO_SHOW_INDIVIDUAL_CATEGORY_SITEMAP  == 'true') { 

 

Thank you, Jack. Replaced it with that and it works fine on both sites.

Share this post


Link to post
Share on other sites

I wanted to use it with a Phoenix 1.0.7 ++ shop

the sitemaps are generated and are OK except the sitemapindex file

it contains just:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</sitemapindex>

all the other maps are complete ....

Share this post


Link to post
Share on other sites

@rupruprupThe code you mentioned is not part of this addon. Please post your question in the support thread for whatever addon you are using.

Share this post


Link to post
Share on other sites

Hi Jack, 

I noticed that when showing products the sitemap.php also displays products where the products_status is 0.  Maybe this is intentional but not for our site(s)

I changed the sitemap.php query on line 76 to:

$db_query = tep_db_query("select pd.products_id, pd.products_name from products p, products_description pd inner join products_to_categories p2c on pd.products_id = p2c.products_id where p.products_id=pd.products_id and p2c.categories_id = '" . (int)$category_id . "' and p.products_status='1' and pd.language_id = '" . (int)$languages_id . "'");

Regards Hans

 

Share this post


Link to post
Share on other sites

@koopmanh Thanks for pointing that out Hans. You should also change the commands in the sitemap_manufacturers.php and sitemap_product.php  files in the modules directory. I'll include these changes in the next version. Thank you for taking the time to mention it. :)

Share this post


Link to post
Share on other sites

@Jack_mcs I have just tried to install this addon to a phoenix 1.0.7.7. store and have the following error in admin/sitemap_seo_page_control.php

Quote

Fatal error: Uncaught Error: Call to undefined function tep_image_submit() in /home/railway1/public_html/phoenixtest/admin14/sitemap_seo_page_control.php:289 Stack trace: #0 {main} thrown in /home/railway1/public_html/phoenixtest/admin14/sitemap_seo_page_control.php on line 289

The relevant lines in the code are

        <tr> 
         <td align="center"><?php echo (tep_image_submit('button_update.gif', IMAGE_UPDATE, 'name="update_pages"') ); ?></td>
        </tr> 

I take it  that its due to the buttons being changed in the BS admin versions. There is also a similar error in the sitemap_seo_box_control.php and the sitemap_seo_settings_control.php.

When I get it working correctly, I have also updated the front end pages to work with the new template file system if you are interested.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@Jack_mcs I have managed to update the button code which seems to work where ever the button was needed in all the files.

        <tr> 
         <td align="center"><?php echo tep_draw_bootstrap_button(IMAGE_UPDATE, 'fas fa-refresh', null, 'primary', null, 'btn-success btn-block btn-lg'); ?></td>
        </tr>

I am now not getting all the pages to show in sitemap_seo_page_control.php. There is no error just no list of pages.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
4 hours ago, 14steve14 said:

When I get it working correctly, I have also updated the front end pages to work with the new template file system if you are interested.

Yes, please. I never turn down anything that will save me work. :)

4 hours ago, 14steve14 said:

There is no error just no list of pages.

Try turn of the modules in the settings - Show Related... The updated version I have here fixed some problems in those modules, as I recall. The version I have isn't ready for release but I am working on that. 

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

×