Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

Getting the following errors with the latest version (with the two fixes).

[11-Sep-2018 12:05:52 UTC] PHP Warning:  Use of undefined constant SEO_ENABLED - assumed 'SEO_ENABLED' (this will throw an Error in a future version of PHP) in /home/xxx/public_html/rl/includes/application_top.php on line 298
[11-Sep-2018 12:05:52 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function iconv() in /home/xxx/public_html/rl/includes/classes/seo.class.php:1835
Stack trace:
#0 /home/xxx/public_html/rl/includes/classes/seo.class.php(2036): SEO_URL->strip('Longest Product Na...')
#1 /home/xxx/public_html/rl/includes/classes/seo.class.php(675): SEO_URL->generate_products_cache()
#2 /home/xxx/public_html/rl/includes/application_top.php(301): SEO_URL->__construct('1')
#3 /home/xxx/public_html/rl/index.php(13): require('/home/furwinter...')
#4 {main}
  thrown in /home/xxx/public_html/rl/includes/classes/seo.class.php on line 1835

Any idea how to fix this?

Link to comment
Share on other sites

It's failing because it can't find the iconv function. Iconv is a php extension so, apparently, that has not been enabled in your php. If your control panel allows you to change extensions you can do it there. Otherwise you will need to ask your host to enable it.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@Jack_mcs Thank you. Solved that part instantly. The following persists though.

[11-Sep-2018 17:18:15 UTC] PHP Warning:  Use of undefined constant SEO_ENABLED - assumed 'SEO_ENABLED' (this will throw an Error in a future version of PHP) in /home/xxx/public_html/rl/includes/application_top.php on line 298

This is basically because the module has not been installed correctly. There are no admin settings for it. Previous version did install without any issues. Any ideas what recent change could be causing this?

Link to comment
Share on other sites

Since you were missing the iconv function I assume your version of php was recently changed. Later versions of php display more warnings than previous ones so that is probably why you are seeing it now. Are you seeing it all of the time or only on the first run?  The following may fix it. Find at the line mentioned in the failure

 if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {

and change it to

 if ((!defined('SEO_ENABLED')) || (SEO_ENABLED == 'true')) {

 

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@Jack_mcs The server environment has not changed. We just added the PHP extension. The current issue is that the latest version has not installed correctly, i.e. there is no SEO URLs link under Configuration in admin. The settings were there when the previous version was installed. What could be the cause?

The suggested change does fix the undefined constant error. Thank you for that! Need to figure out how to have the module settings back now.

Edited by rulegacy
Link to comment
Share on other sites

I can't think of a reason why the options are not showing in admin. Are the url's being rewritten? If you know how to do it, please take a look at the database configuration_group and configuration tables to see if there are entries in either for this addon.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The database changes are in the includes/classes/seo.class.php file starting at "function SEO_URL_INSTALLER" so you would need to dig them out. But even if you do that, whatever is stopping it from working will probably prevent future upgrades. I don't have a fix for you so I'm just letting you know to be aware of it.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@Jack_mcs Has v16 install been tested on CE? Just tried installing v15. All database tables got added correctly and admin settings are visible. However, the Header Tags SEO and character conversions don't stay in place when selected. Looks like changes to the function that manages DB entries (below) are the cause of our issues with v16. We'd keep v15 but it doesn't work fully either.

                  foreach(array_keys($data) as $columns) {
                    $query .= '`' . $columns . '`, ';
                  }
                  $query = substr($query, 0, -2) . ') values (';
							   
                    foreach($data as $value) {
                      switch ((string)$value) {
                          case 'now()':
                                $query .= 'now(), ';
                                break;
                          case 'null':
                                $query .= 'null, ';
                                break;
                          default:
                                $query .= "'" . $this->Slashes($value) . "', ";
                                break;
                        }
                  }
                  $query = substr($query, 0, -2) . ')';
                } elseif ($action == 'update') {
                  $query = 'UPDATE `' . $table . '` SET ';
                  foreach($data as $columns => $value) {

 

Link to comment
Share on other sites

Yes, it works fine in CE. I have installed it in many of them though I can't recall if any are running php 7, which I assume you are. If you are and you are able to switch php to version 5.6 it might be worth doing so to isolate the problem. Although @raiwaprovided the updated class file to make it 7.0 compatible and I assume he tested it in a shop running that version first.

Are you seeing any errors in the error_log file or in your control panel? It might be due to some other extension missing from php, though I can't think of which that might be at the moment.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

53 minutes ago, Jack_mcs said:

Yes, it works fine in CE. I have installed it in many of them though I can't recall if any are running php 7, which I assume you are. If you are and you are able to switch php to version 5.6 it might be worth doing so to isolate the problem. Although @raiwaprovided the updated class file to make it 7.0 compatible and I assume he tested it in a shop running that version first.

Are you seeing any errors in the error_log file or in your control panel? It might be due to some other extension missing from php, though I can't think of which that might be at the moment.

Running this on CE with php 7.2. 

Shopside showing seo urls.

No shop admin side issues

In the error log I see:

 PHP Warning:  Use of undefined constant CHARSET - assumed 'CHARSET' (this will throw an Error in a future version of PHP) in /home/UserName/public_html/includes/classes/seo.class.php on line 1834
 
 That code is:
 
         function strip($string){
                if (CHARSET == 'utf-8') {
                   $string =  iconv("ISO-8859-1", "UTF-8//TRANSLIT", $string);
                }

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Changing if (CHARSET == 'utf-8') { to if ('CHARSET' == 'utf-8') { should fix it. The ability to use defined names without apostrophes is being removed in php 8 so they are warning about it in 7 to allow time to change the code.

Please post the result of the change here in case others run across this.

Edited by Jack_mcs

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

3 hours ago, Jack_mcs said:

Changing if (CHARSET == 'utf-8') { to if ('CHARSET' == 'utf-8') { should fix it. The ability to use defined names without apostrophes is being removed in php 8 so they are warning about it in 7 to allow time to change the code.

Please post the result of the change here in case others run across this.

I beg to differ. This means you don't have the setting for CHARSET which should be in your language file.

It's telling you the constant isn't defined. If you need to cater for its not being defined, the code would be

if (defined('CHARSET') && CHARSET == 'utf-8') { 

but I don't think that's likely your fix here. Check your language file!

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

14 hours ago, rulegacy said:

PHP 7.2.9 with clean error logs. Admin settings (filter short words, header tags SEO, special characters) keep on getting reset for some reason.

 @altoid What PHP extensions are you running?

I do not have header tags seo installed.  

regarding extensions, my server into page has a lot of info,  what specifically were you interested in?

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

@altoid Just trying to figure out whether a missing PHP extension is the cause of our issue with the latest add-on version. We are running the following: cli, curl, gd, iconv, mbstring, mysqlnd, posix, xml. This should cover every possible need but who knows...

As for Header Tags SEO, it has been part of core code for a while now. Why not use it?

Link to comment
Share on other sites

56 minutes ago, rulegacy said:

As for Header Tags SEO, it has been part of core code for a while now. Why not use it?

Just to clarify, Header Tags SEO Reloaded is part of the core code. Not Header Tags SEO. They are different.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

On 9/13/2018 at 10:28 AM, Jack_mcs said:

Changing if (CHARSET == 'utf-8') { to if ('CHARSET' == 'utf-8') { should fix it. The ability to use defined names without apostrophes is being removed in php 8 so they are warning about it in 7 to allow time to change the code.

Please post the result of the change here in case others run across this.

Hi Jack, I am today getting around to this.  I just made the change you suggested.  I'll monitor the error log for a few days and get back to you.

But I wanted to mention a couple of things.

The error log only showed this warning on one day, 12 Sept.   Why not before and after I don't know.

Secondly, then on 13 Sept I see several PHP notices for this same file.  Only on that day, not before or after.  I don't want to mix issues so I'll list those notices in a separate post once we see what happens over the next few days with issue one.

Thx

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

On 9/14/2018 at 1:32 PM, rulegacy said:

@altoid Just trying to figure out whether a missing PHP extension is the cause of our issue with the latest add-on version. We are running the following: cli, curl, gd, iconv, mbstring, mysqlnd, posix, xml. This should cover every possible need but who knows...

As for Header Tags SEO, it has been part of core code for a while now. Why not use it?

Working with these extensions is beyond my technical knowledge.  However scanning through my server info, I have those running it seems.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

47 minutes ago, altoid said:

The error log only showed this warning on one day, 12 Sept.   Why not before and after I don't know.

Secondly, then on 13 Sept I see several PHP notices for this same file.  Only on that day, not before or after.  I don't want to mix issues so I'll list those notices in a separate post once we see what happens over the next few days with issue one.

Maybe it is due to the caching in this addon? You can clear the cache via the settings and see if that makes a difference In the reporting.

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

23 minutes ago, Jack_mcs said:

Maybe it is due to the caching in this addon? You can clear the cache via the settings and see if that makes a difference In the reporting.

OK...I cleared the cache.  I'll watch the error log and see what happens.  Thx.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

33 minutes ago, rulegacy said:

How could we modify the SEO URLs add-on to pull product names from Header Tags SEO Reloaded?

I don't use Header Tags SEO Reloaded so I can't explain how to do that. There is an option for it in Header Tags SEO so you could look up the code I used and change it to load the Reloaded text. 

Support Links:

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

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

2 hours ago, rulegacy said:

@Jack_mcs How could we modify the SEO URLs add-on to pull product names from Header Tags SEO Reloaded?

@altoid Are you running any other PHP extensions?

sorry, not sure.  There's a lot off info on my server_info page but more than I can sort out the meaning of.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Jack, according to the error log so far so good for the undefined constant fix.

Here are the other php notices I see now in the log.

PHP Notice:  Undefined index: path in /home/barkav5/public_html/includes/classes/seo.class.php on line 2605

                if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '.html') !== FALSE) {
                    $u1 = $this->attributes['SEO_REDIRECT']['URI_PARSED']['path'];

PHP Notice:  Undefined index: path in /home/barkav5/public_html/includes/classes/seo.class.php on line 2642

                if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '.html') !== FALSE) {
                    $u1 = $this->attributes['SEO_REDIRECT']['URI_PARSED']['path'];
                    
PHP Notice:  Undefined index: path in /home/barkav5/public_html/includes/classes/seo.class.php on line 2713

                if (strpos($this->attributes['SEO_REDIRECT']['URI_PARSED']['path'], '.html') !== FALSE) {
                    $u1 = $this->attributes['SEO_REDIRECT']['URI_PARSED']['path'];
                    
PHP Notice:  Undefined index: path in /home/barkav5/public_html/includes/classes/seo.class.php on line 2743

                                                               else if (($pStart = strpos($this->uri_parsed['path'], "-c-")) !== FALSE) {

 

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

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...