Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

Quote
  • Enable automatic redirects?
  • Default Setting: true
  • This setting enables/disables the automatic 301 header redirect logic. This sends a moved permanent header for all old URLs to the new ones. This setting is highly recommended for stores that have already been indexed by spiders.

I currently use SEO-G urls.  I'm interested in removing it and going with Ultimate SEO URLs instead.  

Installed it in my test site and it works great. 

My concern is having to manually issue redirects for 6,000 urls.  Will the Enable Automatic Redirects setting take care of that problem?  Or does that logic only apply to the stock urls that come with a new install of osCommerce?

- Andrea

 

Link to comment
Share on other sites

On ‎9‎/‎18‎/‎2018 at 12:18 PM, altoid said:

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

Those are due to the field not being declared for the array before it is used. The fix is to declare the field before it is used. But, at a quick glance, that doesn't appear to be a quick fix. For now, I suggest changing the error_reporting line in includes/application_top.php to the following:

  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);
  ini_set('display_errors','0'); 

 

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

52 minutes ago, puggybelle said:

My concern is having to manually issue redirects for 6,000 urls.  Will the Enable Automatic Redirects setting take care of that problem?  Or does that logic only apply to the stock urls that come with a new install of osCommerce?

It only applies to the stock urls.  I think if SEO-G is no longer used, the stock url is provided and that would then be rewritten. But I'm only guessing here so don't rely on that. If not and if the SEO-G urls are consistent in their format, which I think they are, then a general redirect could be added to handle all of them.

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 only difference between my current SEO-G urls and Ultimate SEO urls would be the addition of the product number extension on the end of the url. 

name-of-product.html will become name-of-product-p-123.html

So, I suppose I would have to issue 6,000 redirects.  Product 1, Product 2, Product 3 and so on. 

Bummer.  Unless you have a better idea?  I hope!

- Andrea

 

Link to comment
Share on other sites

In that case I don't think there is a way to do a redirect just using the .htaccess file since the ID isn't in the url. It could be done with code in the application_top file or by using the .htaccess to redirect to a file, where a lookup is done using the rewritten name.  I don't know how SEO-G handles that lookup so I can't help with that exactly but the code flow would be something like:

if (an seo-g url)

  get the product ID for it

  create the stock url

  redirect to that location

}

I can't help with how to determine if it is a SEO-G link and then how to look it up since those would be specific to SEO-G. Have you searched the forums for a way to redirect SEO-G url's? That addon has not been actively supported for years, ignoring the recent re-release of it, so there may have been posts about redirecting it at one point.

 

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

Just updated my 2.3.4 store to BS CE Frozen and whilst I was experimenting I accidentality clicked "Uninstall Ultimate SEO" The shop still produces the SEO URLs but the admin entry in Configuration is missing so I have no control. The configuration table has just 4 rows relating to the addon, if I delete them just those 4 return after clicking on a shop item. This worked perfectly on the old shop. Could the new shop, which has the same database as the old one with the exception of the configuration tables, be using a cache for the URLs so in fact it is not doing anything new?

Live shop Phoenix 1.0.8.4 on PHP 7.4 Working my way up the versions.

Link to comment
Share on other sites

When you use the uninstall option in admin, it just removes the database entries. As soon as a page is refreshed on the shop side, the database changes will be added back in. So, normally, it is safe to use that option as long as you know the settings may have to be adjusted to your site.

But that doesn't seem to be the case in your shop. I'm wondering if you are running php 7. Someone on the previous page mentioned this same problem but I can't reproduce it. His problem appeared to be related to the php version though others run it successfully. If you are using V 7 and are able to change that to 5.6, please try that to see if the problem goes away. You might also want to try the version of this addon before the most recent one (just replace the seo.class.php file). Maybe something was changed in It 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.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I have it on 5.6 before I launch into 7. I think I had an error in my configuration table. I have recopied it from my test store and I have my settings back but I tried uninstalling it again and the same thing happened. In myPHPadmin, when displaying the configuration table I get this " Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available." Could this be the issue? I have reloaded the configuration table again and it is working OK (I think) and I can amend the settings. I will stay clear of uninstall!

Live shop Phoenix 1.0.8.4 on PHP 7.4 Working my way up the versions.

Link to comment
Share on other sites

I rermember that I had a similar issue when the configuration table was corrupted and auto increment was not set for configuration id. Same for the configuration group table.

Link to comment
Share on other sites

@mhsuffolk That message is due to there not being a primary key for that table. The key is part of the stock database so it seems it has either been deleted or that tales is corrupted, as @raiwa mentioned. 

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

I had not taken the option when I exported the data from my test site to include "  PRIMARY KEY (`configuration_group_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1510 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

All working now, I can install and uninstall to my hearts content, and that message has gone from myphpadmin.

I have an issue with Site Monitor but I will leave that until tomorrow and another forum.

Live shop Phoenix 1.0.8.4 on PHP 7.4 Working my way up the versions.

Link to comment
Share on other sites

On 9/25/2018 at 11:56 AM, Jack_mcs said:

Those are due to the field not being declared for the array before it is used. The fix is to declare the field before it is used. But, at a quick glance, that doesn't appear to be a quick fix. For now, I suggest changing the error_reporting line in includes/application_top.php to the following:


  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);
  ini_set('display_errors','0'); 

 

Hi Jack, for clarification,  I am not having problems with SEO URLs working shopside.  The URLs are generating as they should.

I am only letting you know what showed up in the error log as an FYI.

I use php.ini for my settings rather than change application_top.php.  I've been considering disabling notices and may eventually do so as they are not critical at this point.

But if I understand how this works, eventually a notice could turn into a warning with a future php release.  Then an even later release the warning could lead to a fatal error. So just long term thinking here is all.

Thanks  SK

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_mcs  I rolled back to a 7.1 php version in that my 7.2 version may be causing some of these notices in the php error log.  I'll advise later what I observe.  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

  • 3 weeks later...

Testing my CE upgrade site which has this SEO URL addon working. PHP 7.

I just noticed that if I use the buy now button on the product_info page the continue shopping ( in the cart) returns ok as expected,

However,when adding a product (called widget1) from the product listing page the continue shopping button in the Cart returns to the product listing page, but all products' buy now links on the this product listing page now have the same products_id.  So if I click on another products'  (called widget2) buy now button I add to the cart the previous  product called widget1.

So I disabled the seo URL addon and the continue shopping button works as normal.

This is the code in the shopping cart button

<div class="col-sm-<?php echo $content_width; ?> sc-continue-shopping-button">
  <?php
  echo tep_draw_button(MODULE_CONTENT_SHOPPING_CART_BACK_BUTTON_PUBLIC_TITLE, $button_icons, tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']), 'primary', null, $button_style);
  ?>
</div>

so what causes this problem when the seo URL module is switched on?

These are the SEO URL setting

Enable SEO URLs? true icon_arrow_right.gif 
Add cPath to product URLs? false Info 
Add category parent to product URLs? false Info 
Add category parent to begining of URLs? false Info 
Filter Short Words 3 Info 
Output W3C valid URLs (parameter string)? true Info 
Enable SEO cache to save queries? true Info 
Enable product cache? true Info 
Enable categories cache? true Info 
Enable manufacturers cache? true Info 
Enable Articles Manager Articles cache? false Info 
Enable Articles Manager Topics cache? false Info 
Enable FAQDesk Categories cache? false Info 
Enable Information Pages cache? false Info 
Enable Links Manager cache? false Info 
Enable NewsDesk Articles cache? false Info 
Enable NewsDesk Categories cache? false Info 
Enable Pollbooth cache? false Info 
Enable Page Editor cache? false Info 
Enable automatic redirects? true Info 
Enable use Header Tags SEO as name? false Info 
Enable performance checker? false Info 
Choose URL Rewrite Type Rewrite Info 
Enter special character conversions   Info 
Remove all non-alphanumeric characters? false Info 
Reset SEO URLs Cache false Info 
Uninstall Ultimate SEO false Info 

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Link to comment
Share on other sites

It looks fine to me though maybe the backlink is not correctly formed. But even if it isn't, each url is rewritten as the page load so it would seem something is not right with the continue shopping code. If you add something to the cart and then click on a category, are all of the category links correct? If so, then it is the continue shopping code causing the issue for some reason. You can try disabling all of the cache settings to see if that helps.

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

it would appear, with or without  SEO URLS switched on, that the breadcrumb set of links is incorrect.

If I start in new products the breadcrumb shows:

Catalog - New Products

I add a product (Fence Paint) in the shopping cart and then click the continue shopping button, the breadcrumb shows

Catalog - Gardening Products - Garden Maintenance - Fence Paint - New Products

Why is 'New Products' tagged on to the end of the breadcrumb?

This only happens after I've added a product to the cart.  The breadcrumb seems to behave itself all other times.

 

 

osC CE live - developing osC Phoenix adding modules with no core changes(awesome and easy!)

Link to comment
Share on other sites

Hi Jack...I am getting this type warning in my error log:

[10-Oct-2018 02:37:26 America/New_York] PHP Warning:  mysqli_connect(): (HY000/1203): User barkav5_osc1 already has more than 'max_user_connections' active connections in /home/UserName/public_html/includes/classes/seo.class.php on line 86

Here's what I see about in that location:

        function ConnectDB(){
			    $this->link_id = mysqli_connect($this->host, $this->user, $this->pass, $this->db);
	    if (!$this->link_id) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
		    . mysqli_connect_error());

Any ideas? 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

@altoidThat is probably a server issue. It can be caused by this addon if you have a very large number of products, the cache set in the settings and your site is busy. But it is usually a server issue.

The problem is that the server has a setting for the number of calls allowed for the database in a certain period. When that limit is reached, you see that error. Once the connections fall back down, the page will then load. You can ask your host if they will increase the max user connections limit. But even if they do, it just allows for more connections and once that new limit is reached the same error will occur.

If you have View Counter installed, check for data skimmers since they can cause the connections to increase dramatically and that increases the likelihood of this error.

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 minutes ago, Jack_mcs said:

@altoidThat is probably a server issue. It can be caused by this addon if you have a very large number of products, the cache set in the settings and your site is busy. But it is usually a server issue.

The problem is that the server has a setting for the number of calls allowed for the database in a certain period. When that limit is reached, you see that error. Once the connections fall back down, the page will then load. You can ask your host if they will increase the max user connections limit. But even if they do, it just allows for more connections and once that new limit is reached the same error will occur.

If you have View Counter installed, check for data skimmers since they can cause the connections to increase dramatically and that increases the likelihood of this error.

thanks Jack.  I did contact my host and they said since I'm on a shared plan they can't do anything on the setting.  This AM I manually blocked the IP for a China source.

I may try the view counter to help root these out.  Is it CE and PHP 7 good to go?

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

@altoid you can reduce the number of connections required with a simple edit, in the file seo.class.php, in the database handling class at the top, edit the function ConnectDB so that it is simply:

function ConnectDB(){
	global $db_link;
	$this->link_id = $db_link;
}

This makes the class reuse the connection that you already made with tep_db_connect, so each page request only needs a single connection.

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

20 minutes ago, BrockleyJohn said:

@altoid you can reduce the number of connections required with a simple edit, in the file seo.class.php, in the database handling class at the top, edit the function ConnectDB so that it is simply:


function ConnectDB(){
	global $db_link;
	$this->link_id = $db_link;
}

This makes the class reuse the connection that you already made with tep_db_connect, so each page request only needs a single connection.

Thx John. Will work on this upon return to workstation. Question, does this have anything to do with what my host asked of me...which is "does you code close it's database connection when it completes it's action"..or whatever. I am clueless on this topic?

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

2 hours ago, altoid said:

I may try the view counter to help root these out.  Is it CE and PHP 7 good to go?

Yes, it is compatible as far as I know. At least with 7.0. Maybe not with 7.2.

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

5 minutes ago, Jack_mcs said:

Yes, it is compatible as far as I know. At least with 7.0. Maybe not with 7.2.

Thx Jack. I will give it a go.

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

36 minutes ago, altoid said:

Thx John. Will work on this upon return to workstation. Question, does this have anything to do with what my host asked of me...which is "does you code close it's database connection when it completes it's action"..or whatever. I am clueless on this topic?

Actually, now that you/they bring it up, I've a feeling that Chemo's class doesn't close the connection (while of course the core db functions do that via application_bottom). So you have a double saving - one connection instead of two and nothing left hanging around after the page is built.

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

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