Jump to content
spidometrs

[CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

Recommended Posts

@artfulweb The error occurs when something is displayed before the code but finding that can be difficult. Here are some things to check:

- Check in the includes/hooks/shop/sitewide/ and templates/default/includes/hooks/shop/sitewide/ directories to see if there are any files added by addons. There will be some files there so you need to look at the original files to see which are not added by addons. If there are others, you can try renaming this one to something like aaa_seoUrl.php. The inclusion of hook files are done alphabetically so renaming it assures it is loafed before the others. As far as I know this only applies but directory but it might be better to search all of the includes/hooks/shop/ files (and the one in templates) for the startsearch code. Again, some of the stock ones will have that code. You just need to look for ones that are not stock files,

- Try to isolate the failure.  To do this, add a link, using the tep_href_link function, on a page that doesn't have one - maybe the contact us page. If the error still occurs then it is probably due to something in one of the modules. Try turning off modules, like navbar, logo and infoboxes. This is difficult for a live shop but it is a good way to elimiate potential problems. I would concentrate first on modules that were added by addons. As mentioned, the addon works for me here but that is in a test shop without any addons.

- Try enabling the developer console in your browser. Cause the error to occur and then check the path the code took to get there. Any file in the path can be the cause. If one of them has a space before the first <?php or if a file has the BOM set, it will cause this. For the BOM you will need a program or editor that can identify that. Again, I would look at files added by addons first. 

- Assuming the problem is due to an addon or your installation, the quickest way might be to create a new shop and just install this addon. If it works, which it should, then you can install the other addons you use and see if it fails at some point.

That's all I can think of for now. I hope it helps find the problem.

Share this post


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

Found it and injectSiteStart is on line 36 of that file so why the problem? I am so perplexed.

The problem is that output has already started at line 26!

try editing to

public function listen_injectRedirects() {

instead.

Looks like there's a new hook for exactly this purpose


Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Hi Jack, Hi John,

Jack, thank you but this is a vanilla install of 1.0.8.9 with only Ultimate SEO installed so there is nothing else that has been modified. Do not understand how it works on yours and not mine!

John, I am not sure in which file you think I should change the public function.

Share this post


Link to post
Share on other sites

If we look at /includes/components/template_top.php:26 line 26 is:

<!DOCTYPE html>
<html<?php echo HTML_PARAMS; ?>>

If we look at /includes/classes/seo.class.php, linse 2907-2910 are 

                        case ($this->attributes['USE_SEO_REDIRECT'] == 'true'):
                                header($_SERVER['SERVER_PROTOCOL'] . " 301 Moved Permanently");
                                $url = str_replace('&amp;', '&', $url);
                                header("Location: $url"); // redirect...bye bye                
                                break;
 

Share this post


Link to post
Share on other sites
31 minutes ago, artfulweb said:

Do not understand how it works on yours and not mine!

Same here. If you have not done so after the last file change, use the uninstall option in the settings to make sure it is not a cache issue. The change John mentioned raises the insertion point a little and may help. The edit is to the sep file that you changed previously.

Share this post


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

header("Location: $url"); // redirect...bye bye                
                                break;

For the above, please change to 

               header("Location: $url"); // redirect...bye bye     
               exit;
               break;

 

Share this post


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

For the above, please change to 


               header("Location: $url"); // redirect...bye bye     
               exit;
               break;

 

Changing that breaks the site, clicking a product everything under the navbar goes blank and stll throws the same error as before. No cache issue as I uninstalled and reinstalled.

Share this post


Link to post
Share on other sites

Changed the hook file to replace the public function to  listen_injectRedirects() {

Now in the navigation bar I see the url changed but get a 404 error page.

Share this post


Link to post
Share on other sites
17 minutes ago, artfulweb said:

Changing that breaks the site,

It shouldn't be needed but was worth a try. What version of php are you using. I tried both 7.4.13 and 8.0.

Share this post


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

It shouldn't be needed but was worth a try. What version of php are you using. I tried both 7.4.13 and 8.0.

On 7.4.13, have not yet taken the plunge to 8.

Share this post


Link to post
Share on other sites

I'm sorry but I don't have an answer for you. If I could reproduce it here then I could look into it. But since it works for me there's not a lot I can do. There were a lot of updated between those two versions of php so I suppose they could have introduced and then fixed something that causes this, though it seems unlikely.  All I can think is that maybe some file got corrupted in the installation or maybe you are using a different 1.0.8.9 package that I used. So maybe download a fresh copy of that version and install again to see if that helps? If I can think of something else I will post here but, for now, I'm out of ideas. :(

Share this post


Link to post
Share on other sites

@artfulwebI was just working on a different problem that reminded me of this one. That problem was a setting on the server not being set. To check it, please go to admin->Tools->Server Info and search for "output buttering". There should be a number for it. The default is 4096. It can be something different but if it is blank that is most likely the problem. 

Share this post


Link to post
Share on other sites
On 1/4/2022 at 8:04 PM, Jack_mcs said:

@artfulwebI was just working on a different problem that reminded me of this one. That problem was a setting on the server not being set. To check it, please go to admin->Tools->Server Info and search for "output buttering". There should be a number for it. The default is 4096. It can be something different but if it is blank that is most likely the problem. 

Hi Jack,

Sorry to take so long. I created a phpinfo file to se the output_buffering (can not see all server details through the admin panel) and as it was 0 I added it to my php.ini file with the default 4096 as you stated but still no change. Ultimate SEO URL worked before on the server apparently with the buffering at 0 so that should not have been the problem but thanks anyway.

Share this post


Link to post
Share on other sites

@artfulwebPlease try changing this

$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);

to this

$string = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $string);

 

Share this post


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

@artfulwebPlease try changing this


$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);

to this


$string = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $string);

 

Excuse me, Jack, where is that?

Share this post


Link to post
Share on other sites

Then I'm out of ideas, again. :( Although I should mention that you may need to uninstall it via the setting to make sure the changes take. Those two changes were due to problems I found while installing into shops. Maybe something else will come up.

Share this post


Link to post
Share on other sites

 

@Jack_mcs, do you think you might be able to fix that issue for @artfulweb if you had access to the code so that you could see it and test it? Perhaps for a fee?

There's so much more value to actually being able to see the code and work with it, rather than guessing at a solution.

 

 


osCommerce: made for programmers, ...because store owners do not want to be programmers.

https://trends.google.com/trends/explore?date=all&amp;geo=US&amp;q=oscommerce

Share this post


Link to post
Share on other sites

Thanks @DemitryYes, for those that don't know I do work on any oscommerce problems. Anyone that is interested, please contact me.

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

×