Jump to content
Latest News: (loading..)
spidometrs

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

Recommended Posts

6 hours ago, BrockleyJohn said:

It comes from a shop that sells DJ equipment, filters 2 letter words, and excludes 'DJ'

If I'm understanding you correctly, you are saying that "DJ controller" would just show "controller". If that is correct, I think it would hurt the results a little since "controller" can be applied to many things other than DJ equipment. Of course, it is only in the url so it won't make a big difference but I would consider it.

Share this post


Link to post
Share on other sites
5 hours ago, mhsuffolk said:

DVD Volume 1  DVD Volume 2  DVD Volume 3 and so forth

I have to change these to One, Two, Three etc.

Or you could lower the short word setting.

Share this post


Link to post
Share on other sites

Noticed a small typo in docs/index.html file(I assume):

 // Ultimate SEO URLs v2.2d
 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);
   }
 }
 

Share this post


Link to post
Share on other sites

Can't find a full Package for a clean install.

While some of the most recent updates say "This is a Full package." or "Full package" they only contain couple of updated files.

Can anyone please share the link to download the Full Package? 

Thanks in advance.

Share this post


Link to post
Share on other sites
4 hours ago, edo.script said:

Noticed a small typo in docs/index.html file(I assume):

What is the typo?

Al of my updates are full packages. What is it you are looking for in the last package that isn't in it?

Share this post


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

What is the typo?

Al of my updates are full packages. What is it you are looking for in the last package that isn't in it?

Hello Jack and thanks for the quick reply. The typo is not very important, it is within the docs/index.html file and it looks like the "?" mark within "if ( ! (isset($seo_urls) && is_object(?$seo_urls)) ){condition is extra. Instead I guess it should be "if ( isset($seo_urls) && !is_object($seo_urls) ){" or maybe I am missing something.

As to my request for a link to the full package, maybe I am missing something. However, I have downloaded the files from Ultimate SEO 2-2.2d-17a (1st January 2019), where I can see 3 folders (docs, Upgrade and upload). In docs folder I noticed documents, which frankly I didn't look into assuming that those are documentation for changes down the road. In Upgrade folder there is only the  Upgrade_from_V_16 text file. In upload folder I can see 2 more files, which are admin/includes/reset_seo_cache.php and includes/classes/seo.class.php

And what I am looking for is the full package to install the Ultimate SEO from scratch.

Thanks again.

Share this post


Link to post
Share on other sites
10 hours ago, edo.script said:

The typo is not very important, it is within the docs/index.html file and it looks like the "?"

Thank you for pointing out this mistake. It could be very important to many that install the addon. I will make that change in the next version.

This addon is a little different than most of the others in that it installs itself, if needed. So what you have is the full package. If there are changes needed for an existing installation, as in this case, then the changes will be in upgrade file. Otherwise you just install it following the instructions in the installation file, except for the mistake you found, of course. :)

 

Share this post


Link to post
Share on other sites
6 hours ago, Jack_mcs said:

This addon is a little different than most of the others in that it installs itself, if needed. So what you have is the full package. If there are changes needed for an existing installation, as in this case, then the changes will be in upgrade file. Otherwise you just install it following the instructions in the installation file, except for the mistake you found, of course. :)

 

Thanks for the update. I will try it again.

Share this post


Link to post
Share on other sites
8 hours ago, Jack_mcs said:

Thank you for pointing out this mistake. It could be very important to many that install the addon. I will make that change in the next version.

This addon is a little different than most of the others in that it installs itself, if needed. So what you have is the full package. If there are changes needed for an existing installation, as in this case, then the changes will be in upgrade file. Otherwise you just install it following the instructions in the installation file, except for the mistake you found, of course. :)

 

Well I tried again. After all the changes I get the following Error:

Fatal error: Call to undefined method SEO_DataBase::ConnectDB() in /home/.../public_html/includes/classes/seo.class.php on line 78

line 78 is the $this->ConnectDB(); within function __construct($host, $user, $db, $pass){

then we have the function ConnectDB() and ConnectDB_Legacy() as follows, but I don't see how is ConnectDB_Legacy() called.

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
        

I checked and see that all four DB variables ($host, $user, $db, $pass) are properly passed. 

I am not sure what am I missing and would appreciate your feedback.

Thanks in advance.

Share this post


Link to post
Share on other sites
2 hours ago, edo.script said:

I don't see how is ConnectDB_Legacy() called.

It's not called. That function was just changed with the last update and the old one was left in in case there were problems. Try changing the code so the functions are renamed like this:

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

function ConnectDB(){

You also can uninstall the database changes with the setting for this addon to see if that helps. After doing that, visit the shop and the database changes will be made again.

Share this post


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

It's not called. That function was just changed with the last update and the old one was left in in case there were problems. Try changing the code so the functions are renamed like this:


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

function ConnectDB(){

You also can uninstall the database changes with the setting for this addon to see if that helps. After doing that, visit the shop and the database changes will be made again.

Great! The previous function actually works fine. Thank you.

One more question, based on the instruction I should have the Configuration => SEO URLs within my admin, however, I don't see it. Is this changed too. I just realized it and I haven't looked into the coding yet.

Thanks again. 

Share this post


Link to post
Share on other sites

Yes, that's correct. There should be a section with settings in admin. I recall someone else had this problem very recently but I don't recall if it was fixed or not, though I think it was. It wasn't that long ago so if you look back through the last 2 - 4 pages you should be able to find it. The database changes not being added indicates a problem with the code and the php or MySQL versions being used.  What version of php does your shop use (see admin->Tools->Server Info). What version of oscommerce are you using?

Share this post


Link to post
Share on other sites
5 hours ago, Jack_mcs said:

Yes, that's correct. There should be a section with settings in admin. I recall someone else had this problem very recently but I don't recall if it was fixed or not, though I think it was. It wasn't that long ago so if you look back through the last 2 - 4 pages you should be able to find it. The database changes not being added indicates a problem with the code and the php or MySQL versions being used.  What version of php does your shop use (see admin->Tools->Server Info). What version of oscommerce are you using?

Yes, I fill like something is not right but didn't have a chance to look into the details. 

I am using the osC version 2.3.4 with PHP Version: 5.6.30 (Zend: 2.6.0). Meanwhile, I will look at the recent pages  to see if I can find your mentioned post and the solution.

Thank you.

Share this post


Link to post
Share on other sites

@Jack_mcs   Thanks for your feedback.

Interestingly enough, I changed the functions names from what you suggested:

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

function ConnectDB(){

 

back to the original:

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

function ConnectDB_Legacy(){

and I don't get the Fatal Error (Fatal error: Call to undefined method SEO_DataBase::ConnectDB() in /home/.../public_html/includes/classes/seo.class.php on line 78) anymore.

 

However, I still couldn't understand why the SEO settings are not showing in admin. In other words the class SEO_URL_INSTALLER{ is not triggered and the function __construct(){ is not executed. Therefore the  SEO records are not being inserted into the configuration table and same applies to the other MySQL entries.

I would much appreciate if someone can give me a hint.

Thanks in advance.

Share this post


Link to post
Share on other sites

This addon is used in many shops and the problem you are having has only been mentioned the one time. Were you able to find that post? I suggest installing an older version, like -15 or even -14a, to see if the database changes show up. To install it, you just need to upload the one file in classes. If it works, there is something in the code that is not compatible with your server.

Share this post


Link to post
Share on other sites
12 hours ago, edo.script said:

@Jack_mcs   Thanks for your feedback.

Interestingly enough, I changed the functions names from what you suggested:


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

function ConnectDB(){

 

back to the original:


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

function ConnectDB_Legacy(){

and I don't get the Fatal Error (Fatal error: Call to undefined method SEO_DataBase::ConnectDB() in /home/.../public_html/includes/classes/seo.class.php on line 78) anymore.

 

However, I still couldn't understand why the SEO settings are not showing in admin. In other words the class SEO_URL_INSTALLER{ is not triggered and the function __construct(){ is not executed. Therefore the  SEO records are not being inserted into the configuration table and same applies to the other MySQL entries.

I would much appreciate if someone can give me a hint.

Thanks in advance.

 

I had the same issue and it turned out to be an invisible U+FEFF UTF-8 character in the ConnectDB function. I deleted this character and it works as expected.

 


The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Share this post


Link to post
Share on other sites
On 1/9/2019 at 7:02 AM, Jack_mcs said:

This addon is used in many shops and the problem you are having has only been mentioned the one time. Were you able to find that post? I suggest installing an older version, like -15 or even -14a, to see if the database changes show up. To install it, you just need to upload the one file in classes. If it works, there is something in the code that is not compatible with your server.

Well using the seo.class.php from Ultimate SEO 2-2.2d-14a was a quick fix. It created the necessary database tables and inserted the required configuration records, then as soon as I restore the latest version of the seo.class.php, and click on any link on the website, the "SEO URLs" link disappears from Admin>Configuration. So apparently the database records are being erased too.

One more thing that I noticed, I set the Enable SEO URLs to False from admin, then as soon as I click on any link on the website the Enable SEO URLs is set back to True again. Or when I change the Filter Short Words value from the default 3 to any other number and click on any link on the website then seo.class.php  changes the value back to the default 3. So this means the settings cannot be edited since the seo.class.php  resets all the settings anytime it is triggered. 

Not sure what's going on yet

Share this post


Link to post
Share on other sites

I hope this will help others who are experiencing the same problem I was facing. 

In function __construct(){ replace all '' values for configuration_id with NULL 

in other words replace:

'QUERY' => "INSERT INTO `configuration` VALUES ('', 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");

with

'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
 

Here is the edited version:

 

        function __construct(){
                
                $this->attributes = array();
                
                $x = 0;
                $this->default_config = array();
                $this->default_config['SEO_ENABLED'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_ADD_CID_TO_PRODUCT_URLS'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Add cPath to product URLs?', 'SEO_ADD_CID_TO_PRODUCT_URLS', 'false', 'This setting will append the cPath to the end of product URLs (i.e. - some-product-p-1.html?cPath=xx).', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_ADD_CPATH_TO_PRODUCT_URLS'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Add category parent to product URLs?', 'SEO_ADD_CPATH_TO_PRODUCT_URLS', 'false', 'This setting will append the category parent(s) name to the product URLs (i.e. - parent-some-product-p-1.html).', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_ADD_CAT_PARENT'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Add category parent to begining of URLs?', 'SEO_ADD_CAT_PARENT', 'false', 'This setting will add the category parent(s) name to the beginning of the category URLs (i.e. - parent-category-c-1.html).', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_URLS_FILTER_SHORT_WORDS'] = array('DEFAULT' => '3',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Filter Short Words', 'SEO_URLS_FILTER_SHORT_WORDS', '3', 'This setting will filter words less than or equal to the value from the URL.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, NULL)");
                $x++;
                $this->default_config['SEO_URLS_USE_W3C_VALID'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Output W3C valid URLs (parameter string)?', 'SEO_URLS_USE_W3C_VALID', 'true', 'This setting will output W3C valid URLs.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_GLOBAL'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable SEO cache to save queries?', 'USE_SEO_CACHE_GLOBAL', 'true', 'This is a global setting and will turn off caching completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_PRODUCTS'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable product cache?', 'USE_SEO_CACHE_PRODUCTS', 'true', 'This will turn off caching for the products.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_CATEGORIES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable categories cache?', 'USE_SEO_CACHE_CATEGORIES', 'true', 'This will turn off caching for the categories.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_MANUFACTURERS'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable manufacturers cache?', 'USE_SEO_CACHE_MANUFACTURERS', 'true', 'This will turn off caching for the manufacturers.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_ARTICLES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Articles Manager Articles cache?', 'USE_SEO_CACHE_ARTICLES', 'false', 'This will turn off caching for the Articles Manager articles.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_TOPICS'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Articles Manager Topics cache?', 'USE_SEO_CACHE_TOPICS', 'false', 'This will turn off caching for the Articles Manager topics.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_FAQDESK_CATEGORIES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable FAQDesk Categories cache?', 'USE_SEO_CACHE_FAQDESK_CATEGORIES', 'false', 'This will turn off caching for the FAQDesk Category pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_INFO_PAGES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Information Pages cache?', 'USE_SEO_CACHE_INFO_PAGES', 'false', 'This will turn off caching for Information Pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_LINKS'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Links Manager cache?', 'USE_SEO_CACHE_LINKS', 'false', 'This will turn off caching for the Links Manager category pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_NEWSDESK_ARTICLES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable NewsDesk Articles cache?', 'USE_SEO_CACHE_NEWSDESK_ARTICLES', 'false', 'This will turn off caching for the NewsDesk Article pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_NEWSDESK_CATEGORIES'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable NewsDesk Categories cache?', 'USE_SEO_CACHE_NEWSDESK_CATEGORIES', 'false', 'This will turn off caching for the NewsDesk Category pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_POLLBOOTH'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Pollbooth cache?', 'USE_SEO_CACHE_POLLBOOTH', 'false', 'This will turn off caching for Pollbooth.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_CACHE_PAGE_EDITOR'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable Page Editor cache?', 'USE_SEO_CACHE_PAGE_EDITOR', 'false', 'This will turn off caching for the Page Editor pages.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_REDIRECT'] = array('DEFAULT' => 'true',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable automatic redirects?', 'USE_SEO_REDIRECT', 'true', 'This will activate the automatic redirect code and send 301 headers for old to new URLs.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_HEADER_TAGS'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable use Header Tags SEO as name?', 'USE_SEO_HEADER_TAGS', 'false', 'This will cause the title set in Header Tags SEO to be used instead of the categories or products name.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['USE_SEO_PERFORMANCE_CHECK'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enable performance checker?', 'USE_SEO_PERFORMANCE_CHECK', 'false', 'This will cause the code to track all database queries so that its affect on the speed of the page can be determined. Enabling it will cause a small speed loss.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_REWRITE_TYPE'] = array('DEFAULT' => 'Rewrite',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Choose URL Rewrite Type', 'SEO_REWRITE_TYPE', 'Rewrite', 'Choose which SEO URL format to use.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''Rewrite''),')");
                $x++;
                $this->default_config['SEO_CHAR_CONVERT_SET'] = array('DEFAULT' => '',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Enter special character conversions', 'SEO_CHAR_CONVERT_SET', '', 'This setting will convert characters.<br><br>The format <b>MUST</b> be in the form: <b>char=>conv,char2=>conv2</b>', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, NULL)");
                $x++;
                $this->default_config['SEO_REMOVE_ALL_SPEC_CHARS'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Remove all non-alphanumeric characters?', 'SEO_REMOVE_ALL_SPEC_CHARS', 'false', 'This will remove all non-letters and non-numbers.  This should be handy to remove all special characters with 1 setting.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");
                $x++;
                $this->default_config['SEO_URLS_CACHE_RESET'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Reset SEO URLs Cache', 'SEO_URLS_CACHE_RESET', 'false', 'This will reset the cache data for SEO', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), 'tep_reset_cache_data_seo_urls', 'tep_cfg_select_option(array(''reset'', ''false''),')");
                $x++;
                $this->default_config['SEO_URLS_UNINSTALL'] = array('DEFAULT' => 'false',
                                      'QUERY' => "INSERT INTO `configuration` VALUES (NULL, 'Uninstall Ultimate SEO', 'SEO_URLS_DB_UNINSTALL', 'false', 'This will delete all of the entries in the configuration table for SEO', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), 'tep_reset_cache_data_seo_urls', 'tep_cfg_select_option(array(''uninstall'', ''false''),')");
                $this->init();
        } # end class constructor
 

 

 

 

Similarly, in function install_settings(){  replace the '' value for configuration_group_id with NULL 

in other words replace:

                $insert_group = "INSERT INTO `configuration_group` VALUES ('', 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '".$next_sort."', '1')";

with

                $insert_group = "INSERT INTO `configuration_group` VALUES (NULL, 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '".$next_sort."', '1')";
 

Here is the edited version:

 

        function install_settings(){
                $this->uninstall_settings();
                $sort_order_query = "SELECT MAX(sort_order) as max_sort FROM `configuration_group`";
                $sort = $this->DB->FetchArray( $this->DB->Query($sort_order_query) );
                $next_sort = $sort['max_sort'] + 1;
                $insert_group = "INSERT INTO `configuration_group` VALUES (NULL, 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '".$next_sort."', '1')";
                $this->DB->Query($insert_group);
                $group_id = $this->DB->InsertID();

                foreach ($this->default_config as $key => $value){
                        $sql = str_replace('GROUP_INSERT_ID', $group_id, $value['QUERY']);
                        $this->DB->Query($sql);
                }

                $insert_cache_table = "CREATE TABLE `cache` (
                  `cache_id` varchar(32) NOT NULL default '',
                  `cache_language_id` tinyint(1) NOT NULL default '0',
                  `cache_name` varchar(255) NOT NULL default '',
                  `cache_data` mediumtext NOT NULL,
                  `cache_global` tinyint(1) NOT NULL default '1',
                  `cache_gzip` tinyint(1) NOT NULL default '1',
                  `cache_method` varchar(20) NOT NULL default 'RETURN',
                  `cache_date` datetime NOT NULL,
                  `cache_expires` datetime NOT NULL,
                  PRIMARY KEY  (`cache_id`,`cache_language_id`),
                  KEY `cache_id` (`cache_id`),
                  KEY `cache_language_id` (`cache_language_id`),
                  KEY `cache_global` (`cache_global`)
                ) ;";
                $this->DB->Query($insert_cache_table);
        } # end function        
 

Otherwise it is a great module/app. Thanks.

Edited by edo.script

Share this post


Link to post
Share on other sites

@edo.script sounds like your database structure is iffy. configuration_id and configuration_group_id should not have default values, they should be auto_increment

Something else worth checking is that you don't have a conflict with any other customisation. SEO_URLs check for whether it needs to reinstall is a bit crude and looks for config vars that start SEO_ and USE_SEO_ so if some other addon creates one named like that you get issues.

If the number of these doesn't match what it thinks they should be, SEO_URLs deletes them all and reinstalls itself. Then it will be stable for a while unless/until the other customisation recreates another variable starting like that and then it starts all over again.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/Responsive-osCommerce/archive/2341-Frozen.zip

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

@edo.script sounds like your database structure is iffy. configuration_id and configuration_group_id should not have default values, they should be auto_increment

Something else worth checking is that you don't have a conflict with any other customisation. SEO_URLs check for whether it needs to reinstall is a bit crude and looks for config vars that start SEO_ and USE_SEO_ so if some other addon creates one named like that you get issues.

If the number of these doesn't match what it thinks they should be, SEO_URLs deletes them all and reinstalls itself. Then it will be stable for a while unless/until the other customisation recreates another variable starting like that and then it starts all over again.

Well, the configuration_id and configuration_group_id are set to AUTO_INCREMENT.

And I did see the line:

 $this->DB->Query("DELETE FROM `configuration` WHERE configuration_group_id = '" . $cfgID['ID'] . "' OR configuration_key LIKE 'SEO_%' OR configuration_key LIKE 'USE_SEO_%'");

There are no other records LIKE 'SEO_%'.

After I changed the blank('') values to NULL it started functioning without any issues. All the changes are saved properly. The SEO URLs Enable/Disable works fine. All the changed values are saved and so on. Unless, there is something I haven't noticed yet. 

Share this post


Link to post
Share on other sites

@edo.script I'm curious why, if your diagnosis is right, you're the only one to hit the issue. Are you on mysql or mariadb, and what version?


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/Responsive-osCommerce/archive/2341-Frozen.zip

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
6 hours ago, BrockleyJohn said:

@edo.script I'm curious why, if your diagnosis is right, you're the only one to hit the issue. Are you on mysql or mariadb, and what version?

@BrockleyJohn That's a good question and frankly I had the same question in mind. And even now when everything works fine at my end I am not sure if that was the main reason. I am suspicious that something else is the main reason. Something that I haven't yet noticed, like a custom setting in MySQL or... 

I am using:

Database: MySQL 5.6.41

with

PHP Version: 5.6.30 (Zend: 2.6.0)

 

And this is how I came to that decision. I installed older versions until I found out that Ultimate SEO 2-2.2d-14a properly inserted the SEO URL records into the configuration table and added the SEO URLs link under Admin>Configuration. So I started looking into the SQL query differences and I noticed that in  Ultimate SEO 2-2.2d-14a the query is:

 'QUERY' => "INSERT INTO `".TABLE_CONFIGURATION."` VALUES (NULL, 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");

and in version Ultimate SEO 2-2.2d-17a, of course with other major changes in scripting, the query is changed to 

'QUERY' => "INSERT INTO `configuration` VALUES ('', 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')");

So i decided to manually try both queries in my PHP MyAdmin. The query: 

"INSERT INTO `configuration` VALUES ('', 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', 46, 0, NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')"

returned and error:

SQL query: 

INSERT INTO `configuration` VALUES ('', 'Enable SEO URLs111?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs?  This is a global setting and will turn them off completely.', 46, 0, NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')

MySQL said: 

#1366 - Incorrect integer value: '' for column 'configuration_id' at row 1

 

And when I replaced the quotes with NULL the query was executed.

So far that's where I am and i would much appreciate a good advise here.

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

×