Page 1 of 1
Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Tue Jul 09, 2013 2:43 am
by CamaroSS
Hi,
I have experience coding PHP as well as many other languages. I am a user of OpenCart and was thinking about trying to contribute to the project.
Currently, the code is somewhat deprecated and does not use PHP Data Objects.
If I wanted to rewrite some of the base code using PDO can someone give me some ideas if this would be appreciated?
Also, what files need the most work and which files can remain untouched? Please email me with any suggestions.
Best,
Julian
juliansvinyl@gmail.com
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Wed Jul 10, 2013 11:45 pm
by CamaroSS
hello is there anyone on here?
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Tue Aug 27, 2013 5:01 am
by blindjoedeath
Hi, CamaroSS - I can't help you directly, but if you weren't aware, there's an extension with a lot of comments that is trying to do the same thing.
http://www.opencart.com/index.php?route ... on_id=3913. You may want to take a look at it for ideas.
Good luck!
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Wed Aug 28, 2013 5:08 am
by Qphoria
PDO is a more sizable rewrite.
But this may help as a starting point
http://www.sitepoint.com/migrate-from-t ... on-to-pdo/
also, the mysql extension may be deprecated but mysqli is the likely replacement we'll see in opencart
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Wed Oct 23, 2013 5:40 pm
by igorko82
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Oct 25, 2013 4:42 pm
by dfumagalli
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Thu Nov 07, 2013 6:26 pm
by timparnell
Interesting choice - The link you recommend suggests skipping mysqli and going straight to PDO. It's logic being that as mysql has been deprecated then maybe at sometime mysqli may be deprecated. So if you are doing the work to change then change straight to PDO. Kind of like upgrading 1.0 to 1.5 when 2.0 is already available.
(Well 2.1, if you remember the rule to "never upgrade to anything with a "0" on the end of it!!!.)
Tim
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Nov 08, 2013 1:18 am
by rph
I wouldn't worry too much. The reason mysql_* functions were deprecated in PHP 5.5 is because:
1) They can be difficult for novices to use safely and correctly (mainly because of a bunch of horrible old tutorials floating around the net), and
2) It's simpler to maintain one function set when they both do the same thing.
In OpenCart all you have to do is update your config files to start using MySQLi. A similar PDO driver could be made but what most developers are going to be looking for is prepared statements which would require a major rewrite of the model. With a job that big you really want to weigh all the pros/cons beyond "MySQLi might be deprecated some day". (For instance, PDO benchmarks tend to show it running around 10% slower than MySQLi.)
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Nov 08, 2013 1:36 am
by timparnell
OK. Thanks. Like the OP I'd love to contribute to OpenCart as a coder, but I don't think at my current level of skill would add anything useful. (Probably the opposite).

Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Nov 08, 2013 1:45 am
by Qphoria
Seems 2.0 will have pdo and mysqli choices in the installer already
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Nov 08, 2013 1:55 am
by rph
I thought so too but for whatever reason the database directory has disappeared completely from the master repo.
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Fri Nov 08, 2013 2:06 am
by timparnell
Cool beans. So everyone's happy. Now I need to unpick all my modifications into vQmods - in preparation for upgrades.
Thanks.
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Mon Nov 11, 2013 12:33 pm
by Qphoria
timparnell wrote:
Interesting choice - The link you recommend suggests skipping mysqli and going straight to PDO. It's logic being that as mysql has been deprecated then maybe at sometime mysqli may be deprecated. So if you are doing the work to change then change straight to PDO. Kind of like upgrading 1.0 to 1.5 when 2.0 is already available.
(Well 2.1, if you remember the rule to "never upgrade to anything with a "0" on the end of it!!!.)
Tim
http://net.tutsplus.com/tutorials/php/p ... d-you-use/
Another point:
http://net.tutsplus.com/tutorials/php/p ... d-you-use/
PDO wins because it supports multiple databases... but we only care about one so there is really no major benefit
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Mon Nov 11, 2013 4:45 pm
by rph
You'd really have to be drinking the Kool-Aid to find a 6.5% hit on prepared statements acceptable.
Re: Rewrite OpenCart for PHP 5.5 using PDO...
Posted: Mon Nov 11, 2013 7:26 pm
by timparnell
If myslqi will do the job then I'm happy.
I'm still learning so probably I don't appreciate all the factors involved.
I shall read the link and try to understand.
Tim