Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Compatibility Core Change


Recommended Posts

@@Dan Cole,

 

HT or Hooks will not produce 100% compatibility with all add-ons. Hooks are called at the end of application_top.php, HT are included in template_top.php.

There are important add-ons adding code or including files in application_top.php (SEO URLs, security add-ons etc)

Core change, but I had no better idea.

So I decided to apply Jacks suggestion to add the include at the beginning of application_top.php just below the compatibility layer.

For simplicity I added the directory definitions to filenames. (forgive for the unclean solution, but easier installation)

I also added optional support when database_table definitions will be removed in future.

 

Add-On Compatibility for 2.3.4 EDGE newest version:
http://addons.oscommerce.com/info/9506

 

rgds

Rainer

Link to comment
Share on other sites

burt without@,

 

I just tried to do what has been suggested by you:

http://www.oscommerce.com/forums/topic/396152-bootstrap-3-in-234-responsive-from-the-get-go/?p=1747817

"something else"

 

If i'm not on the level, I'm sorry, but at least I did something.

 

Meanwhile I parked one of my add-on updates for doing this and of course I will continue updating my add-ons. :)

 

rgds

Rainer

Link to comment
Share on other sites

@@raiwa Rainer I applaud your efforts....you're trying to help and move things forward and I for one, appreciate that.  Based on Garys response I'm guessing there is a better way to do this or he is implying that we shouldn't go down this path at all.   In either case I assume he'll let us know so we can all start working from the same song book.

 

Dan

Link to comment
Share on other sites

I've only experimented with this a little, but I was looking for ways to use a regex to replace the old with new.  I tried it on a few files in my test site and it seems to work on the tables.  Using Regex Buddy http://www.regexbuddy.com/index.html which is a companion to EditPad Pro I came up with this for tables. 

Regex to find tables

"\s?\.\s?TABLE_([A-Z_]+)\s?\.\s?"

replace with

\L1

This regex finds the old style of tables in files and replaces them with the lower cased actual table name given that table defines were used correctly.  I tested this on a hanful of files and it seems to work.  I think we could do this with filenames also, but i haven't tried it.  Regex Buddy has a 30 day trial and is not very expensive.  While I use Netbeans for most of what i do, I find EditPad and Regexbuddy helpful.  RegexBuddy is very helpful on experimenting with regex.  Of course, all software has a learning curve and I still really suck at Git.

 

Did I explain this well? 

 

I'm not really a dog.

Link to comment
Share on other sites

@@Dan Cole - this has been explained numerous times (including very eloquently by your self) ... 

 

Options;

 

1.  create some type of non-core-intrusive module or hook

2.  update addons manually

3.  advise shopowners to use Gold 

 

There is a real nice piece of code from Kymation that automates files into constant names.  

That could have been the basis of a non core intrusive addon.

 

All;

If forward movement is not wanted or cannot be handled, develop (developers) or use (shopowners) 2.3.4 or the Gold Responsive.  It's really that simple.  Everytime I include/exclude something in/out the Core I ask for discussion and comments and testing.  If nothing comes of that request, don't belatedly moan and groan...that'll achieve less than zero.   

Link to comment
Share on other sites

The add-on is public, if anyone creates a better solution, feel free to add it.

Link to comment
Share on other sites

Coming back to this in a more positive frame of mind.

 

If it has to be a replacement in core code, could it be in the compatiblity function file?  This file is far far far less likely to be updated in future versions of osc and I don't think I have ever seen an addon that asks for this file to be changed (whereas there are many that ask for app_top to be changed).

 

Thoughts ?

 

I still prefer the idea of doing it outside of core, but if no-one makes it...that's not going to happen.

Link to comment
Share on other sites

Thanks to @@raiwa for taking a shot at this. This will remove a lot of the barrier to using older (2.3.x) Addons.

 

The code that Gary mentioned is here if anybody wants to look at it or use it. It does modify application_top.php as that was the only way to make it work when I wrote the code. Of course that modification could be in another file, such as the compatibility function file that Gary mentioned, or in a hook.

 

I don't want to start another flame war, but I think that a hook in application_top.php would be good enough for 99% of the old Addons. The exceptions are probably too complex and invasive to work with the new code, so they will have to be modified before they can be used. I'm fine with covering the majority with a simple compatibility Addon. If that means I have to write some code, I'll do that.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I'll give it a try with Jims @kymations example. Shall the directory constant definitions be just placed in compatibility.php or a class created like for filenames and tablenames. I believe it is not needed, directory defs are not altered by add-ons?

 

WIll do it asap and upload here the new package for testing and aproval.

Link to comment
Share on other sites

Here the new version based on @@kymation 's files.

 

I had to tweek around one issue:

compatibility.php is included before functions/database.php and tep_db_connect and Jims database class needs db connection.

 

I hardcoded the sql connection and queries therefore in the database_table class:

    public function get_tables() {
    	$conn = mysqli_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die(mysql_error());// connect to db
      $tables_query_raw = "show tables";
      $tables_query = mysqli_query($conn, $tables_query_raw );
      while( $tables_array = mysqli_fetch_array( $tables_query ) ) {
        // There is only one value in the array, so get the current value
        $table_names[] = current( $tables_array );
      }
      mysqli_close($conn); 
      return $table_names;
    }

Any better ideas??

Otherwise the order would need to be changed in application_top.php => again core change!!

 

Please give it a try.

 

 

rgds

Rainer

Link to comment
Share on other sites

Some thoughts about the auto filename and database table name version:

- I do not like the raw database connection and queries

- some add-ons do not respect the database table and filename naming convention => will not work for them (we do not care for add-ons which do not respect the naming convention)

- some store owners rename the files for localization purposes => will not work for them ( doing so, they'll find a way around)

 

Most important:

- why shall we promote old add-ons giving them the advantage to auto define filename and database table constants? We just want the opposite: motivate store owners and devs to update their add-ons with hardcoded filenames etc. Let them continue to do the additional manual installation steps.

- I understand that the intent and sense of the auto scripts would have been to include them into core. Decided to make life easier with hardcoded solution, itdoesn't make sense to use them as a compatibility glue.

- Anyway the add-ons will need to be updated for OSC 2.4 (sql queries, file structure etc.)

 

So my proposal: version 1.1:

1. Based on uploaded version with old filename.php (incl. paths) and database_table.php

2. Move inclusion lines from application_top.php to compatibility.php

 

Thoughts??

 

Best regards

Rainer

Link to comment
Share on other sites

@@raiwa Rainer I just see this as a temporary fix.  The add ons will need updating for various reasons and I think all this will do/should do is buy a little time for those addons that don't need extensive changes.   

 

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...