Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

  • 3 weeks later...
On 9/22/2021 at 3:52 AM, Jack_mcs said:

A new version has been uploaded with these changes. Tested through Phoenix 1.0.8.6 and php 8.

  • Added version for Phoenix .0.8.0 and above.
  • Changed code for php 7.4 warnings.
  • Fixed mistake with the uninstall code.
  • Replaced HTTP/1.x protocol checks with $_SERVER['SERVER_PROTOCOL'].

 

Hi dear; is it possible we have the multi language urls with the lanuage folder name in url prior to the actual product name instead like below?

https://www.xxx.com/de/yy-yy-130.html

Link to comment
Share on other sites

9 hours ago, radhavallabh said:

is it possible we have the multi language urls with the lanuage folder name in url prior to the actual product name

There's nothing in the code that would allow that. It should be possible to insert the language anywhere in the code where a link is created though I've never tried it. 

 

8 hours ago, radhavallabh said:

Undefined index: QUERY_STRING

That's strange. While none of the SERVER variables are guaranteed to be present, there is a standard that lists items that should be present and that is one of them. I can only think it is something specific to your server since it has never come up before. To prevent it, you can change this line

$this->real_uri = ltrim( basename($_SERVER['SCRIPT_NAME']) . '?' . $_SERVER['QUERY_STRING'], '/' );

to this

$this->real_uri = ltrim( basename($_SERVER['SCRIPT_NAME']) . ( isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''), '/' );

 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

13 hours ago, Jack_mcs said:

There's nothing in the code that would allow that. It should be possible to insert the language anywhere in the code where a link is created though I've never tried it. 

 

That's strange. While none of the SERVER variables are guaranteed to be present, there is a standard that lists items that should be present and that is one of them. I can only think it is something specific to your server since it has never come up before. To prevent it, you can change this line


$this->real_uri = ltrim( basename($_SERVER['SCRIPT_NAME']) . '?' . $_SERVER['QUERY_STRING'], '/' );

to this


$this->real_uri = ltrim( basename($_SERVER['SCRIPT_NAME']) . ( isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''), '/' );

 

Hi thank you for the reply dear;

I used the code you gave and the error disappeared.

But dear when I click the product link on shopping cart page it redirects to the index page instead;

Please can you help me understand and fix the issue...

Thank you so much in advance;

Warm Regds./

radhavallabh

Link to comment
Share on other sites

4 hours ago, radhavallabh said:

Hi thank you for the reply dear;

I used the code you gave and the error disappeared.

But dear when I click the product link on shopping cart page it redirects to the index page instead;

Please can you help me understand and fix the issue...

Thank you so much in advance;

Warm Regds./

radhavallabh

Fixed it dear.. it was a curly braces issue from server.

Link to comment
Share on other sites

  • 5 weeks later...
5 hours ago, radhavallabh said:

It seems that it has stopped working on 1.0.8.7

Have you installed the latest version and applied the fix mentioned in this thread?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

11 hours ago, Jack_mcs said:

Have you installed the latest version and applied the fix mentioned in this thread?

Yes dear I installed the latest version and updated the seo.class.php as well;

It worked on 1.0.8.6 but ever since I updated to 1.0.8.7 the addon has stopped functioning dear.

Your help and guidance shall be deeply appreciated dear;

regds./

radhavallabh

Link to comment
Share on other sites

@radhavallabhIt is working here for that version and others has it working in their shops so it must be something in your installation. Maybe you overwrote the href_link.php file with the upgrade? If that isn't it, are you getting any errors? Do the settings show up in admin?

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

16 hours ago, Jack_mcs said:

@radhavallabhIt is working here for that version and others has it working in their shops so it must be something in your installation. Maybe you overwrote the href_link.php file with the upgrade? If that isn't it, are you getting any errors? Do the settings show up in admin?

Hi dear;

No I am using the same file as provided for the href_link.php,

I just checked dear in most place the tep_href_link function has been replaced with $GLOBALS['Linker']->build ....... Is that the issue ??

I checked more thoroughly on the store  for debugging.....the New Arrivals box on my Index page has the old code with tep_href_link function so those links are displaying the SEO URLS correctly...

The Error console is not showing any error for now.

Settings do show up in the admin properly.

Please guide me on how to proceed;

Regds./

radhavallabh

Edited by radhavallabh
Link to comment
Share on other sites

12 hours ago, radhavallabh said:

No I am using the same file as provided for the href_link.php,

This is not clear to me. Are you using the file from the addon package or from the Phoenix package?

I just compared a .87 shop I have it installed in with the files from the Phoenix package and they are the same, except for what this addon changes, and the urls are working fine in it so I can't think of any reason why it is failing for you.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

On 11/24/2021 at 12:40 AM, Jack_mcs said:

This is not clear to me. Are you using the file from the addon package or from the Phoenix package?

I just compared a .87 shop I have it installed in with the files from the Phoenix package and they are the same, except for what this addon changes, and the urls are working fine in it so I can't think of any reason why it is failing for you.

Using the addon file dear.. but still am not able to understand why does my site fail to work...

Link to comment
Share on other sites

@radhavallabhSince it works in other shops but not yours, it must be something unique to yours. If you turn the addon off in admin do all of the urls work correctly? If it does, try using the Uninstall setting and then reload the shop side. Does that fix it? If not, try turning off all cache options in the settings and try again. If it still fails then the only thing I can think to do is to install it into a new, basic, shop. That should work since it works here. Then you can try it with your database and if it fails, then it is something there that is causing the problem.  

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 5 weeks later...
On 11/25/2021 at 4:03 PM, Jack_mcs said:

@radhavallabhSince it works in other shops but not yours, it must be something unique to yours. If you turn the addon off in admin do all of the urls work correctly? If it does, try using the Uninstall setting and then reload the shop side. Does that fix it? If not, try turning off all cache options in the settings and try again. If it still fails then the only thing I can think to do is to install it into a new, basic, shop. That should work since it works here. Then you can try it with your database and if it fails, then it is something there that is causing the problem.  

Hello Jack and happy holidays,

I too have the same problem. Tried it on a vanilla installation of Phoenix 1.0.8.7 as well as a modified version that already had it installed and working before upgrading to 1.0.8.7 and it does not rewrite. In my logs on both sites I am getting :

=============

 PHP Warning:  Cannot modify header information - headers already sent by (output started at /xxx/xx/xx/xx/templates/default/includes/components/template_top.php:26) in /xx/xx/xx/xx/includes/classes/seo.class.php on line 2908
PHP Warning:  Cannot modify header information - headers already sent by (output started at /xx/xx/xx/xx/templates/default/includes/components/template_top.php:26) in /xx/xx/xx/xx/includes/classes/seo.class.php on line 2910

=============

Have cleared all caches, rechecked my htacces file, uninstalled, reinstalled and still no rewrite. As the vanilla install has no modifications I just do not understand.

 

Thanks
 

Link to comment
Share on other sites

OOOOOOHHHHH.... think I see the problem but do not know how to fix it. In the error it is calling template_top.php which existed prior to 1.0.8.6

headers already sent by (output started at /xx/xx/xx/xx/templates/default/includes/components/template_top.php:26) i

whereas it is now templates/override/includes/componets/template.php

so where is that called and how to modify it please?

Link to comment
Share on other sites

@artfulwebI can see the failure in the latest version but don't have a fix at the moment. It is due, as I'm sure you know, to something being displayed before the code in question. So something must have changed in this version in the display or maybe php 8 is doing something different. I will look into it but I can't say when that will be.

Regarding the template.php file, that is just present to  allow installing addons without changing the core code. It has been there for many versions so I don't think it is involved in the error.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I wonder if $seo_urls isn't getting instantiated until the first call to href_link and that is now after the page output has started in template_top.

Try editing catalog/includes/hooks/shop/siteWide/seoUrl.php and changing

  public function listen_injectinjectAppTop() {

to

  public function listen_injectAppTop() {

and see if that helps

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

Link to comment
Share on other sites

@BrockleyJohnGood catch. It appears they have removed injectinjectAppTop completely. 

@artfulwebIn the hook file change this line 

public function listen_injectinjectAppTop() {

to this

public function listen_injectSiteStart() {

I made the change here and it ran without errors.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

22 hours ago, Jack_mcs said:

@BrockleyJohnGood catch. It appears they have removed injectinjectAppTop completely. 

@artfulwebIn the hook file change this line 


public function listen_injectinjectAppTop() {

to this


public function listen_injectSiteStart() {

I made the change here and it ran without errors.

Hi Jack,

Made the change and still no change. Still getting the error

PHP Warning:  Cannot modify header information - headers already sent by (output started at /XXX/XX/XX/XX/templates/default/includes/components/template_top.php:26) in /XX/XX/XX/X/includes/classes/seo.class.php on line 2908

and line 2910
 

Link to comment
Share on other sites

1 hour ago, artfulweb said:

/templates/default/includes/components/template_top.php:26)

Please check that file to see that "injectSiteStart" is in it. You can try uninstalling this addon (using that setting) though I wouldn't think that would be needed.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

3 hours ago, Jack_mcs said:

Please check that file to see that "injectSiteStart" is in it. You can try uninstalling this addon (using that setting) though I wouldn't think that would be needed.

Jack, there is no more template_top.php in 1.0.8.9, it is template.php.

Link to comment
Share on other sites

13 hours ago, artfulweb said:

Jack, there is no more template_top.php in 1.0.8.9, it is template.php.

The template.php file is in 

templates/default/includes/ and templates/override/includes/.

The templates_top.php file is in 

templates/default/includes/components/ and maybe templates/override/includes/components/.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

On 12/31/2021 at 8:00 PM, Jack_mcs said:

Please check that file to see that "injectSiteStart" is in it. You can try uninstalling this addon (using that setting) though I wouldn't think that would be needed.

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...