Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

2.2 MS2 shop update to PHP 5.4


mo-osc

Recommended Posts

It is time for us to move up php versions, as most of you must do as well. But I have a decade old oscommerce install.. too many modifications, features, security, database customizations with other scripts, etc.. to just easily throw away or rewrite. So I started by experimenting with an update. As you will read I am ALMOST done.. but I may need some of your help.. and maybe along the way this will be useful to someone else.

 

Most people will just say upgrade.. but I am close to a working shop and even if my time already spent increases several fold, I think I am still only expending a fraction of the time I would if I were to install the newest version and try to move over my custom updates! So here it is..

 

OK, so old php is 5.2.17, new version is 5.4.27. I have OSC 2.2 MS2 (the original) with TONS of mods. First step was to update to fix register globals.. I used the following

 

http://addons.oscommerce.com/info/2097

 

There is a lot of stuff there.. I used "1.5 - 5 Sept 2006 (either the tar or zip version - they are identical)" by CMOTD

and I followed the manual instructions to patch all the files

 

After that I went ahead and started converting the site to work with php 5.4 by hand, making modifications as I tested the site. The resulting *brief and crudely* written text file is attached. Mainly a lot of ereg and split to explode changes.

 

All now appears to work well.. the store even seems to run more snappier!! But one big issue remains.. It will not run credit cards when checking out.. no errors.. it just appears to work as usual.. but no credit card transaction takes place with the processor. One clue I have is no cc information is in the html source in the checkout confirmation page.. A normal one is as follows..

 

<td align="right" class="main">

<form name="checkout_confirmation" action="https://www.mysite.com/store/checkout_process.php" method="post" onsubmit="return check_agree(this);"><input type="hidden" name="cc_owner" value="name on card"><input type="hidden" name="cc_expires" value="0117"><input type="hidden" name="cc_type" value="Visa"><input type="hidden" name="cc_number" value="12312312312313"><input type="hidden" name="cc_cvv" value="123"><input type="hidden" name="osCsid" value="lots of gibberish here removed"><table width="100%" class="infobox" border="0" style="border-collapse: collapse"><tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse">

<tr class="infoBoxContents">

 

BUT INSTEAD I just get something like...

 

<td align="right" class="main">

<form name="checkout_confirmation" action="https://www.mysite.com/store/checkout_process.php" method="post" onsubmit="return check_agree(this);"><table width="100%" class="infobox" border="0" style="border-collapse: collapse"><tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse">

<tr class="infoBoxContents">

 

At first I tried changing things like..

'cc_type' => $order->info['cc_type'],

to

'cc_type' => $_POST['cc_type']

 

but that didn't work.

 

Anyone have any ideas on where to look or a possible fix? Almost there!

 

Thank you!

 

Regards,

-Moses

osc-to-php-5.4-trials.txt

Link to comment
Share on other sites

What you've done is basically fork osCommerce for your own use. By not basing your shop on the current osC version, you have taken on full responsibility for continued maintenance. Over time it's going to be harder and harder to find people here who can work on 2.2. It's a bit like driving a '57 Chevy -- you're going to have a hard time finding a mechanic who knows a carburetor or how to diagnose problems without an ODB-2 port, and you'll probably end up doing a lot of it yourself. Plus, you'll still have a car that will kill you in even a relatively minor accident.

 

I would strongly suggest making a list of what you've done to the base 2.2 product (including add-ons used and all custom code). Then install a test osC 2.3.3.4 system and see what add-ons and custom code you need to make it functionally the same as your current shop. Maybe you'll be pleasantly surprised at how little you have to do! Plus, by keeping an up-to-date list of modifications, you'll be ready for the next major osC upgrade.

Link to comment
Share on other sites

Phil,

 

I completely understand what you mean.. but I like my 57 chevy! :)

 

I would like to get this going to at least buy me a few months of time to attempt the upgrade to a more modern 2.3.x.x. I could not possibly afford any paid help, (or really at any point in the past, or any point in the near future), so its mostly been done by myself. But I get the point where even the free help.. forums, postings, etc.. is going to decrease.

 

I have been keeping good records since first install (a long long time ago!).. lets see.. 39 contributions, some fully installed some partial. And custom code notes (NOTES ONLY, NOT CODE) is 70 pages long. I would say the fork started on the second day of installation! :)

 

I estimate an upgrade to a more modern version will be at least 100 hours at this point, probably a LOT more. I only have a few hours into this mod, so I would like to get it working.. Sooner or later I am expecting our hosting provider to have some technical issue where they cannot compile php 5.2 anymore.

 

Thanks!

 

Regards,

-Moses

Link to comment
Share on other sites

After some searching I found a fix to this *particular* issue..

 

in includes/classes/payment.php

I added the $PHP_SELF assignment below after the global in the payment function..

============

function payment($module = '') {

global $payment, $language, $PHP_SELF;

$PHP_SELF=$_SERVER[php_SELF]; // MODS FOR PHP5.4

============

 

Now credit cards actually process. This may be a good fix for this or it may not be, I do not claim to be an expert at this!!! And there was a few more ereg changes in includes/classes/cc_validation.php that cropped up after this fix.

 

Like Phil said, it's best to upgrade. But if time is an issue like it is for me, you can try this in the meantime. There is still a high potential for more problems.. and I am sure they will surface, so if you do this yourself you should be prepared to fix things yourself! Just sharing my experiences. Maybe in a few days or weeks I'll post on any other issues I had.

 

It is BEST to UPGRADE! but if you do attempt running 2.2 on php 5.4, I would be interested in your experiences.Thanks everyone!

 

Regards,

-Moses

Link to comment
Share on other sites

I Had exactly the same dilemma last year. Take a look at this thread: http://www.oscommerce.com/forums/topic/395359-modding-up-a-new-2334-install-documented/

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Now credit cards actually process. This may be a good fix for this or it may not be,

 

Just make sure your credit card processing routines are up to date, and NOT based on the old cc.php module. That was not PCI-DSS compliant, and to continue using it risks heavy fines.

Link to comment
Share on other sites

Thanks Heather, interesting read your thread. Everyone says upgrade! but some people don't realize how big of a job a revision change/upgrade is for some people.. when you have several dozen contributions installed and even more custom code.. the upgrade takes several weeks (if not months!), not several days.

 

Hi Phil. Yes, we never used cc.php, so we are good there.

 

The update is well and live in case anyone was interested. A little bit more modification was needed. But I am now trying to track down a very annoying problem with password_forgotten.php, on successive attempts it will alternate working and not working! Annoying! I've even went as far as dumping all the variables using phpinfo and comparing two sessions, one working and one not working, and only see the normal google tracking urls things being incremented. Nothing else seems to change to make this not work! The page just kicks you back to login.php without the green confirmation bar that your password was reset (and the password never gets reset). I'm thinking it may be session related.. not sure. If anyone has a clue as to where to look, I would appreciate it. I am not sure if this was caused by 5.4 or was there prior (should test this). Always something!

 

Regards,

-Moses

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...