Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upgrading osCommerce 2.2 RC2a to PHP 5.6


dr_lucas

Recommended Posts

  • 6 months later...

wrong final_price (rounded) due to faulty locale setting

I just switched my shop to utf-8 and.. well, i made a tricky mistake.
I took the locale setting from my 2.3.4BS language file. The followup problem made me search quite a while until i realised that the locale setting in my language file was causing the problem.

After switching to utf-8 i found my final_price was not calculated correctly anymore. in the orders_products table it looked like the last 4 digits where 0 always on final_price. all caused by a wrong locale setting. see below.

this was causing the problems on 2.2RC2a

@setlocale(LC_ALL, array('de_DE.UTF-8', 'de_DE.UTF8', 'deu_deu'));

this was working just as expected again for 2.2RC2a

@setlocale(LC_TIME, 'de_DE.UTF-8');

so, take care what you use as locale setting. it does matter quite alot ;) Hope this helps someone else.

Stephan
 

 

 

Link to comment
Share on other sites

Shell Script to convert files to UTF-8
(i ran this on my debian linux server / you need to be root i guess)

 

# Convert PHP, HTML, HTM, TXT, CSS and JS Files to UTF-8
# -skip when US-ASCII is detected, as this is a subset of UTF-8 / ISO-8859-1
# -skip already UTF-8 files
# -skip 0byte Files
# -skip when detection returns an empty string only

# SETTING --Start------------------------------------------------------

# standard charset if charset is detected as unknown-8bit
# change this to your local charset (example: windows-1252 for Germany)
    sc1="windows-1252"

# folder to convert
    folder="/var/www/vhosts/domain.com/"

# SETTING --End--------------------------------------------------------

# clear screen
    clear

# wait for Input of y to continue
    while true; do
        read -p "Convert content of $folder to UTF-8 (y/n)?" yn
        case $yn in
            [Yy]* ) echo "lets go!"; break;;
            [Nn]* ) exit;;
            * ) echo "Please answer yes or no.";;
        esac
    done

# start a loop that goes thru all php file within the given folder
    find "$folder" -type f ! -size 0 -and \( -iname "*.php" -or -iname "*.html" -or -iname "*.htm" -or -iname "*.txt" -or -iname "*.css" -or -iname "*.js" \) | while r$

# get owner, group & permission from the file
    owner=`ls -l "$x" | awk '{ print $3 }'`
    group=`ls -l "$x" | awk '{ print $4 }'`
    octalpermission=$( stat --format=%a "$x" )

	# detect charset
    cs="$(file -bi $x|awk -F "=" '{print $2}')"

# change charset to utf-8 when us-ascii is detected
       if [ "$cs" = "us-ascii" ]; then
       cs="utf-8"
       fi

# conversion starts here if charset is other then utf-8
  if [ "$cs" != "utf-8" ] && [ "$cs" != "binary" ] && [ "$cs" != "" ]; then

# change charset to $sc1 (see settings for standard charset on top)
       if [ "$cs" = "unknown-8bit" ]; then
         cs="$sc1"
       fi

# convert the file using $cs charset detected
    echo "$cs converting $x"
    iconv -f "$cs" -t UTF-8 "$x" > "$x.utf8"

	# remove the original file and replace it with the converted file
    rm "$x"
    mv "$x.utf8" "$x"

# apply original owner,group & permission to the file again
    chown $owner:$group "$x"
    chmod $octalpermission "$x"
  else
  echo "$cs -------skipped conversion of $x";
  fi
done

- this is made for linux systems with you having root access
- set the two parameter lines (sc1= and folder=) to your needs (original charset and folder)
- the files will be processed recursive, so all files in subfolders within the given folder are processed
- save / edit the script with nano texteditor for example
- it is going to process php, html, htm, txt, css and js files (you can change that in line 32)
- run it on a testfolder first to see if everything works as expected
- backup everything before running on your shop files!
- run like ./scriptname.sh or sudo ./scriptname.sh

i hope this is useful for somebody :)

Regards,
Stephan

convert2utf8.sh

 

 

Link to comment
Share on other sites

PHP 5.6 support is finish on 31.12.2018. So it's highly recommanded to Upgrade. The next problems will come without any Upgrade.

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

2 hours ago, mcmannehan said:

PHP 5.6 support is finish on 31.12.2018. So it's highly recommanded to Upgrade. The next problems will come without any Upgrade.

and if you want to go past 5.6 and are not on 5.6 already, you might want to go to 5.6 first. so i was very thankful for this thread, helping me to take that needed steps. to prepare for 5.6 and later. your warnings realy don't help anyone (found those in other threads already). i guess most people searching for update/ upgrade forum threads already know that they run into problems and therefor looking for upgrade paths and help to do so. So in my oppinion, what helps is to guide those people that are no pro coders and cannot afford to hire pro coders to somehow make the needed upgrades and basicly get more time to switch to a different shop vesion etc. Sure thats not the best way to go, but everyone might have their reasons.

in my case i have to get more time to develop the new 2.3.4BS to do everything my old 2.2RC2a can do. So i have 2 linux dist upgrades in front of me, changes of php versions and switch to maria db.

again, i was so glad to finally have found this thread, realy helping with the problems you have when you can't easily switch to a new shopversion.
 

So, if a can contribute and tell the people in this forum how i managed to make necessary changes even if i am not a pro coder, i will continue to do so. i think that might help others who search the forum for help and not for things they already know (that they are behind the recent shop/software development).

No offense meant!
Stephan
 

 

 

Link to comment
Share on other sites

  • 3 months later...

Could I ask a question here also?

I have setup an XAMPP server running PHP 5.6.33.

I have setup a clean install of 2.2 RC2a. Then I edited all files containg depreciations - etc.

The reason for doing this is because I need to migrate my shop to 5.6 befone moving to a newer shop version (it's all a matter of available time)

I have it all running, except for not being able to login in the admin area. No error messages, just the login screen returning directliy, having empty fields.

This problem was mentioned there before, but a have not seen a working solution.

Does anyone have a hint where to look?

This is not a live shop but if I can't get it running i'm ..... :-)

 

Link to comment
Share on other sites

What php version are you upgrading from?  You might be hitting problems with "session.bug_compat_42".   This might help you

https://stackoverflow.com/questions/3575180/what-are-session-bug-compat-42-and-session-bug-compat-warn

Even if it's not this, you probably are running into some kind of session problem.  If you are good with something like Beyond Compare you can upgrade some of the files that will deal with this. 

You are probably much better served upgarding to a new current version.  It won't be much more time consuming and not too hard. 

I'm not really a dog.

Link to comment
Share on other sites

@honda4

 

2 hours ago, honda4 said:

The reason for doing this is because I need to migrate my shop to 5.6 before moving to a newer shop version (it's all a matter of available time)

Can you get your host to keep you on a lower version of PHP for a little while longer? If so, the 'available time' spent on getting your 2.2 RC2a shop running on PHP 5.6 could be better spent on moving your whole store up to osC Edge. It just seems like you are putting a lot of effort for a very short-term fix.

Malcolm

Link to comment
Share on other sites

You should consider this:

 

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

9 hours ago, ArtcoInc said:

@honda4

 

Can you get your host to keep you on a lower version of PHP for a little while longer? If so, the 'available time' spent on getting your 2.2 RC2a shop running on PHP 5.6 could be better spent on moving your whole store up to osC Edge. It just seems like you are putting a lot of effort for a very short-term fix.

Malcolm

Malcolm, yes, I will need the provider to do that indeed.

I am currently assassing what the impact is. I have a shop with over 3000 articles, and around 1000 catagories. Also the products are crosslinked over the catagories. You can imagine the time I would need to build a new shop......

 

Link to comment
Share on other sites

39 minutes ago, honda4 said:

I am currently assassing what the impact is. I have a shop with over 3000 articles, and around 1000 catagories. Also the products are crosslinked over the catagories. You can imagine the time I would need to build a new shop......

The existing database can be migrated to 2.3.4BS without loosing products, categories, customer and order data:

https://apps.oscommerce.com/2qqbU&sql-upgrades-from-2-2ms-to-2-3-3

the newest version includes the upgrade up to 2.3.4.1 BS community reponsive

Link to comment
Share on other sites

It's very clear, use the BS version, it's the only recommended.

Link to comment
Share on other sites

28 minutes ago, honda4 said:

Thanks Rainer! I will definetely test that!. 

 

I am still confused about the best version I should download.

Going to oscommerce.com and download the latest, or the BS version that is on Github?

It is extremely confusing.

 

Its up to you what version you use. Do you want something that is responsive and has new addons being made for it, or do you want something that is old fashioned and very few new addons being made for. If you want modern use the community bootstrap version from Github. If you want old fashioned use the official outdated version available from here.

In my view the decision is really easy and something should be done to remove the confusion you are having.  Its a shame that those in charge seem to make promises and do nothing which is frustrating, but its their bat and their ball and they can do what they like.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

3 hours ago, honda4 said:

Manfred, I know. But security fixes are supported up to 31/12/2021, so I can run 5.6 for another 3 years. ;-)

 

@honda4 Sorry, thats not correct, the support is finish 31.12.2018, this includes the security fixes to.

Please read here: http://php.net/supported-versions.php

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...