Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

  • 1 month later...

A new version has been uploaded. Itjust fixes the problem with the ConnectDB introduced in the last version. If you have applied the fix mentioned in this thread, you don't need the update. But if you want to apply it, just upload the includes/classes/seo.class.php file.

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

12 hours ago, Jack_mcs said:

A new version has been uploaded. Itjust fixes the problem with the ConnectDB introduced in the last version. If you have applied the fix mentioned in this thread, you don't need the update. But if you want to apply it, just upload the includes/classes/seo.class.php file.

Jack, I am two versions back on this.  Can I just install the latest or should I install each version incrementally?

I am currently at Version 2.2d-16

Thank you

Edited by altoid

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

1 hour ago, altoid said:

Can I just install the latest or should I install each version incrementally?

You should be able to just upload the seo.class.php file. There is a change to the code in the application_top.php file, which you found, that needs to be made to prevent warnings with php 7 but no other changes are needed.

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 2/22/2019 at 11:54 AM, Jack_mcs said:

You should be able to just upload the seo.class.php file. There is a change to the code in the application_top.php file, which you found, that needs to be made to prevent warnings with php 7 but no other changes are needed.

OK  thanks..for application_top.php the change was from

 if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
   include_once('includes/classes/seo.class.php');
   if ( ! (isset($seo_urls) && is_object($seo_urls)) ){
     $seo_urls = new SEO_URL($languages_id);
   }
 }

to

if ((!defined('SEO_ENABLED')) || (SEO_ENABLED == 'true')) {
  include_once('includes/classes/seo.class.php');
  if ( isset($seo_urls) && !is_object($seo_urls) ){
    $seo_urls = new SEO_URL($languages_id);
  }
}

if I have that correct.

Otherwise with the  new seo.class.php uploaded should be up to date then.

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

hi Jack,

I modified my product_reviews.php file in my BS Edge install to also display individual reviews,.. same as product_reviews_info.php file did in the older osC versions, before it was dropped for whatever reason.

The htaccess rewrite rules for the product_reviews.php file does not recognize any query in the url beyond products_id. Therefore, an individual review in that file with a url like this:

../product_reviews.php?products_id=19&reviews_id=3

…will ignore the last part and return the same product_reviews.php page showing all of the reviews for that product.

I tried finding a solution using an htaccess RewriteRule and cannot seem to get one to work properly. I’m doing this with the assumption that I don’t need to add code in the seo.class.php class file, though I may be wrong on that.

Do you or anyone else here know how to structure that RewriteRule for it to read the second part of that url query string?

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

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

Link to comment
Share on other sites

23 minutes ago, Demitry said:

@Jack_mcs

hi Jack,

I modified my product_reviews.php file in my BS Edge install to also display individual reviews,.. same as product_reviews_info.php file did in the older osC versions, before it was dropped for whatever reason.

 

The htaccess rewrite rules for the product_reviews.php file does not recognize any query in the url beyond products_id. Therefore, an individual review in that file with a url like this:

 

../product_reviews.php?products_id=19&reviews_id=3

 

…will ignore the last part and return the same product_reviews.php page showing all of the reviews for that product.

 

I tried finding a solution using an htaccess RewriteRule and cannot seem to get one to work properly. I’m doing this with the assumption that I don’t need to add code in the seo.class.php class file, though I may be wrong on that.

 

Do you or anyone else here know how to structure that RewriteRule for it to read the second part of that url query string?

 

I can't see why you want both parameters - surely it's one or the other? If so, then you need to express which parameter uniquely in the url by changing code in the class, so as well as pr representing the product id parameter on the reviews page, something like rr might represent the reviews page with a review id parameter. Then you have an extra rewrite rule to pick up the extra format.

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

Quote

I can't see why you want both parameters - surely it's one or the other?

Thanks John, I had not thought of that. I figured it needed both and it works with both. I'll take a look and try restructuring the file to use one parameter (products_id) for all reviews and the reviews_id for the single review. The easiest way is probably to just scrap the split file and leave it as it was and then add in the product_reviews_info.php file. The SEO URLs code is already set up for it in the class file.

Edited by Demitry

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

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

Link to comment
Share on other sites

I don't have a shop setup that uses more than English and is running with php 7 so I've no way to test this. You don't say what "its not working" means or what version of this addon you are using so I can only guess at things to try. The following are all I can think of:

- After you enter in the conversion string and save it, is the string still there and correct when you open that setting again?

- Have you cleared your browsers cache?

- Try turning off all of the cache settings for this addon to see if that makes a difference.

- Run the Tools->Database Tables script to convert all tables to utf8.

- Replace the conversion string with something like a=>b and refresh the shop side. If the a's are not changed to b's, then the problem is with the code, as opposed to type of character.

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 3/14/2019 at 1:20 AM, Jack_mcs said:

I don't have a shop setup that uses more than English and is running with php 7 so I've no way to test this. You don't say what "its not working" means or what version of this addon you are using so I can only guess at things to try. The following are all I can think of:

Im using this version:

/**
 * updated for 2.3.4.1. CE Frozen and PHP 7.2
 * Rainer Schmied
 * @raiwa
 * [email protected]
 * www.oscaddons.com
 */
/**
 * Ultimate SEO URLs Contribution - osCommerce MS-2.2

 

On 3/14/2019 at 1:20 AM, Jack_mcs said:

- After you enter in the conversion string and save it, is the string still there and correct when you open that setting again?

Yes.. the string remains there as it was supposed to.

On 3/14/2019 at 1:20 AM, Jack_mcs said:

- Have you cleared your browsers cache?

Yes, Have tried it in sevral machines cross-browsers

On 3/14/2019 at 1:20 AM, Jack_mcs said:

- Try turning off all of the cache settings for this addon to see if that makes a difference.

nothing changes

On 3/14/2019 at 1:20 AM, Jack_mcs said:

- Run the Tools->Database Tables script to convert all tables to utf8.

All tables are in utf8mb4

On 3/14/2019 at 1:20 AM, Jack_mcs said:

- Replace the conversion string with something like a=>b and refresh the shop side. If the a's are not changed to b's, then the problem is with the code, as opposed to type of character.

That works. changing a=>b does work fine. Its just not the fancy letters that doesnt.

This is very annoying if you have several language packs.

 

Link to comment
Share on other sites

Just found the problem. its in your DB fix.

Changed in the classes/seo.class.php:

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

function ConnectDB_Legacy(){
  $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());
  }
} # end function

back to:

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());
}
        } # end function

 

and now it is working again.

Link to comment
Share on other sites

Thanks for posting the fix. I tested it in a shop that is using 5.6 and a second language and it does fail with the new function in 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

1 hour ago, Jack_mcs said:

Thanks for posting the fix. I tested it in a shop that is using 5.6 and a second language and it does fail with the new function in it.

hmmm... the only difference I can think of between the two versions of db connection is that osc's db connection has the sql_mode reset to avoid the group_by issue in mysql 5.7, here in functions/database.php

    @mysqli_query($$link, 'set session sql_mode=""');

Perhaps this resets something else that's needed for the multi-language store to handle characters properly. It would be a good idea to check that the seo_class doesn't start throwing mysql errors on 5.7 on a server with the default settings (not usual on shared hosting but common on vps)

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

  • 3 weeks later...

i installed the plugin

and it works, but is there a way to rewrite the URLs other than having just the product id in the url?

for example this is the product url

the url is www.mystore.com/store/--p-52.html

how to get the product name or category in there?

is it done in the .htaccess file?

ive set show category parent to true but only get the product id showing in url, no category name or product name

 

Edited by vampirehunter
Link to comment
Share on other sites

17 minutes ago, vampirehunter said:

how to get the product name or category in there?

It should be there automatically. That could happen if you have Header Tags SEO installed and didn't run Fill Tags. If you don't have that installed, look for some other addon that changes the names.

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

28 minutes ago, Jack_mcs said:

It should be there automatically. That could happen if you have Header Tags SEO installed and didn't run Fill Tags. If you don't have that installed, look for some other addon that changes the names.

i have a Edge installation and header tags SEO modules are installed in admin as default.

where is the fill tags part of it?

 

or do i need to install the seperate header tags seo plugin?

 

Edited by vampirehunter
Link to comment
Share on other sites

1 hour ago, vampirehunter said:

i have a Edge installation and header tags SEO modules are installed in admin as default.

The code in Edge is "Header Tags SEO Reloaded" - a completely different set of code from HTS. For that one, make sure the title modules in admin->Modules->Header Tags are installed. I don't know if they are needed for Ultimate SEO to work but they should be enabled anyway.  Also, be sure the "Enable use Header Tags SEO as name?" option is off in the settings 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

2 hours ago, Jack_mcs said:

The code in Edge is "Header Tags SEO Reloaded" - a completely different set of code from HTS. For that one, make sure the title modules in admin->Modules->Header Tags are installed. I don't know if they are needed for Ultimate SEO to work but they should be enabled anyway.  Also, be sure the "Enable use Header Tags SEO as name?" option is off in the settings for this addon.

i checked everything and all is installed as it should. all the options in header tags seem ok.

but still not getting the category or product name in the URL.

just get this

mystore.com/store/--p-65.html

not sure why that is

is there any error checking script to see what is causing it

 

 

2 hours ago, Jack_mcs said:

The code in Edge is "Header Tags SEO Reloaded" - a completely different set of code from HTS. For that one, make sure the title modules in admin->Modules->Header Tags are installed. I don't know if they are needed for Ultimate SEO to work but they should be enabled anyway.  Also, be sure the "Enable use Header Tags SEO as name?" option is off in the settings for this addon.

 

Link to comment
Share on other sites

2 hours ago, Jack_mcs said:

The code in Edge is "Header Tags SEO Reloaded" - a completely different set of code from HTS. For that one, make sure the title modules in admin->Modules->Header Tags are installed. I don't know if they are needed for Ultimate SEO to work but they should be enabled anyway.  Also, be sure the "Enable use Header Tags SEO as name?" option is off in the settings for this addon.

i did error log check and it says this

PHP Warning:  mysql_fetch_array() expects parameter 2 to be long, string given in /home/test/mysite.com/store/includes/functions/database.php on line 225
Link to comment
Share on other sites

@vampirehunterA php warning shouldn't cause this but when all else fails it is a place to start. Although that message doesn't mean it is caused by this addon. Try turning this one off and see if the error still occurs. If it does, it's not due to this addon.

Also look at the source of the page and see what is in <title></title>. Do that with this addon on and off to see if there is a difference.

Also, does the name of the product appear on the page? You may need to install the page title module.

Also, what version of php are  you using? This addon will work with 7.0 and probably 7.1.  If you are running above that, try lowering it to see if it  makes a difference.

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

22 minutes ago, Jack_mcs said:

@vampirehunterA php warning shouldn't cause this but when all else fails it is a place to start. Although that message doesn't mean it is caused by this addon. Try turning this one off and see if the error still occurs. If it does, it's not due to this addon.

Also look at the source of the page and see what is in <title></title>. Do that with this addon on and off to see if there is a difference.

Also, does the name of the product appear on the page? You may need to install the page title module.

Also, what version of php are  you using? This addon will work with 7.0 and probably 7.1.  If you are running above that, try lowering it to see if it  makes a difference.

product title and category appear fine in the title, and on the breadcrumbs

the error log shows i only got the error after installing the seo urls.

i did the same install on another edge site and getting same issue

so it looks like something from the addon maybe is causing the error in log

 

 

 

Edited by vampirehunter
Link to comment
Share on other sites

1 hour ago, Jack_mcs said:

@vampirehunterA php warning shouldn't cause this but when all else fails it is a place to start. Although that message doesn't mean it is caused by this addon. Try turning this one off and see if the error still occurs. If it does, it's not due to this addon.

Also look at the source of the page and see what is in <title></title>. Do that with this addon on and off to see if there is a difference.

Also, does the name of the product appear on the page? You may need to install the page title module.

Also, what version of php are  you using? This addon will work with 7.0 and probably 7.1.  If you are running above that, try lowering it to see if it  makes a difference.

Everything is fine in title and in admin. Page title and category title modules are installed and set to true.

Everything shows perfect in breadcrumbs etc.

The php is 5.6 something running on the hosting.

 

For some reason, the seo urls just arent showing the category and the product names.

I followed the installation exactly and double checked. All code was added as specified and the 2 files uploaded also.

 

 

 

 

 

 

Edited by vampirehunter
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...