Jump to content
abcdefg

Oscommerce 2.3.4 PHP 7 Real Upgrade (not Hotfix)

Recommended Posts

4 minutes ago, Tsimi said:

You also running EDGE or FROZEN?
I am using an older EDGE version from April with a few commits applied to it.

I'm referring to CE Frozen.

Share this post


Link to post
Share on other sites

@abcdefg

Please don't mind me. You are doing fine with the latest Frozen version.
I used an older Edge version because this is a project that took longer than expected and I simply didn't find the time and will to redo everything again.
It is my version that is somewhat obsolete. I just went through the commits on github and I applied the code changes to the admin/modules.php file from commit #664 and now all is good. Working like a charm again on PHP version 7.2.8

Sorry that I hijacked your thread here.

Edited by Tsimi

Share this post


Link to post
Share on other sites

@abcdefg

Just to re-emphasize a point ...

There are NO version number differences in all of the different Edge versions, nor in Frozen. They will ALL say that they are version 2.3.4.1. You have to look at the date of the package (and files) to determine which version you have. Frozen (the last released version) will have a date of Aug 31, 2018. Anything earlier than that is not Frozen.

M


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites
15 minutes ago, Tsimi said:

@abcdefg

Please don't mind me. You are doing fine with the latest Frozen version.
I used an older Edge version because this is a project that took longer than expected and I simply didn't find the time and will to redo everything again.
It is my version that is somewhat obsolete. I just went through the commits on github and I applied the code changes to the admin/modules.php file from commit #664 and now all is good. Working like a charm again on PHP version 7.2.8

Sorry that I hijacked your thread here.

No problem at all. I am learning the ropes here so it is great to see any form of questions and answers along with comments and opinions.

I think for me it would have been problematic to first find the link and then go through each commit on Github so I am better of using the version that Raiwa kindly provided the link for but if you have something that works for you then that is the most important thing.

Share this post


Link to post
Share on other sites

Thank you all for your great contributions and awesome FREE product!!.

Not sure this is the right place to ask this.. so forgive me for barging in.   I installed 2.3.4 Edge several years ago and love it.   Where can I get the updates for edge?  I have done some modifications to my site since the install and need to update the checkout_shipping page as it's not compatible with PHP 7.2.  Godaddy has a funny way.. in regards to PHP releases... for hosted websites like mine.  So I figure I would move to 7.2 instead of 7.1.  All of my pages work fine except the checkout_shipping page.  Just note the page doesn't work with PHP 7.1 either.   Since I haven't updated the code in years (yes that is how rock solid it is).  Where can I go to download the latest EDGE,  and where can I get the latest code each month.  I don't see any references to Edge on GBurton's github repository although I believe one of those is edge just not named edge?)  

Thanks in advance,
Dave

Share this post


Link to post
Share on other sites

There is no update package. You need to install the latest "Edge" version and re-do any customizations you had done. I wouldn't try to update just one small part -- do the whole thing to do it right. I'm not sure if Edge is fully PHP 7.2 compatible -- it may be. Frozen is 7.1 compatible, and definitely has some problems on 7.2. See my signature for links to Frozen and Edge. "Edge" is labeled "master" on GitHub, which may be why you couldn't find it. Be aware that Edge is under constant development, and may not be stable enough for a production store, while Frozen is quite stable (although I would apply the various fixes listed in the thread). No one knows if Gary plans to release an updated Frozen, or just a stable version of Edge to eventually replace it.

Share this post


Link to post
Share on other sites

Thank you.  I will download and get started.  I am able to flip a switch between PHP 5.3 and 7.2 at Godaddy to check out the entire purchasing process.  If a page fails on 7.2 I flip the switch back to 5.3 so that's how I figured I only have one page to update.  But I would rather be completely up--to-date.  

Thanks again!

Dave

Share this post


Link to post
Share on other sites

Only 5.3 and 7.2 are available? That's a pretty pathetic selection. PHP 5.3 is long, long obsolete, and I'm not sure that either Frozen or Edge will successfully run on it. PHP 7.2, while the mainstream PHP release at the moment, is pretty advanced for most software out there that site owners have installed. As I said, Frozen won't run on it, and Edge may have trouble. Are you sure that PHP 5.6, 7.0, or (best) 7.1 aren't available to you?

Share this post


Link to post
Share on other sites

@videod

A couple of points ...

1) PHP v7.2 is MUCH more strict than v7.0 or v7.1. Most of the 'errors' people are reporting are not actually errors, but are 'warnings'. These can be suppressed, if desired, but will most likely need to be addressed when PHP is upgraded again.

While I do not have any experience with GoDaddy, most reputable hosts will not force you to use PHP v7.2. They should offer v7.0 or v7.1. Either of these should be fine for a production store. Or, as @MrPhil just said, v5.6 can be used too.

2) The 'Edge' you downloaded years ago is quite different that 'Edge' is today. It is in a constant degree of change. Burt (the lead person developing the Community Edition) has publicly stated that 'Edge' is his playground, and should not be used for a production store. He may add something to test one week, and take it out the next. He has also stated that he has moved 'Edge' from Bootstrap 3 to Bootstrap 4, so a lot of the code will be different. This also means that many of the popular add-ons may not work with the 'current' version of Edge. This is why it is recommended that you use 'Frozen' instead of the current 'Edge.'

'Frozen' is a stable version, and is quite suitable for a production store. That said, as with all software, there are some bugs in 'Frozen.' There is a thread here in the forum just for people to report bugs and the fixes. Please be sure to read it.

So, you've got a couple of options ...

A ) Drop back to PHP v5.6 (or v7.0). (quick fix)

B ) As @MrPhil mentioned, download 'Frozen' (a link is in my signature below), migrate your data over, and (if needed) re-apply the modifications you did before (you kept good notes, didn't you?). (probably your best option)

C ) Download 'Frozen', and use a file compare program (I use WinMerge) to compare your shop's code with the code in Frozen. Apply any changes you see necessary for your shop. (Honestly, though, I do not recommend this)

HTH

M

 


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

Just to clarify.  Godaddy hosting does provide 5.6 and 7.1 PHP.  I just want to get ahead of the curve with 7.2...  if I am going to revamp my website.   Thanks for all of the suggestions as they will help me in the decision process.  It's good to see folks actively taking part in keeping OSCommerce alive.  Thanks for breaking down the options and pointing out where Edge lives on Github.  There is a lot of good to be said about this product, and I see some frustration in the lack of the owner of OSCommerce not passing the baton.  I believe there is an awesome product sitting in the minds of the coders who have taken so much of their time (countless hours really) to think/create the product(s).   OSCommerce beats so many products in the pocketbook that it's silly more people don't catch on.   Magento, Prestashop, and WooCommerce are just a few of options I have entertained, but at the end of the day they don't fit my micro business model.  

Thank you again,

Dave

Edited by videod

Share this post


Link to post
Share on other sites
Posted (edited)
On 10/1/2018 at 3:42 PM, raiwa said:

Doesn't happen to me, works ok under PHP 7.29

@raiwa

Hi,
Under PHP 7.2, I encountered strange errors just after shipping method step (see screenshot) :

Warning: Illegal string offset 'title' in D:\wamp\www\includes\classes\order.php on line 255
Warning: Illegal string offset 'cost' in D:\wamp\www\includes\classes\order.php on line 256
Warning: A non-numeric value encountered in D:\wamp\www\includes\classes\order.php on line 405
Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\includes\classes\order.php:405) in D:\wamp\www\includes\functions\general.php on line 49

Rainer, could you test this for me with your updated script ? :
1. Add products into your basket and modify quantity of any of them from "shopping_cart.php", the most important is to reset selected delivery method.
2. Go forward to "checkout_shipping.php" by clicking the "Order" button and now choose the expected shipping method (no matter which one).
3. Go forward by "checkout_payment.php" clicking the "Continue" button.


Do you have multiple errors at screen like me ?!?
Thanks for your help.

NB: If necessary, re-do the process.

php7.x_osc_illegal_string_offset_errors.jpg

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites
On 10/3/2019 at 6:30 AM, milerwan said:

Warning: Illegal string offset 'title' in D:\wamp\www\includes\classes\order.php on line 255
Warning: Illegal string offset 'cost' in D:\wamp\www\includes\classes\order.php on line 256

This generally means that you are mixing two versions of osCommerce.  At one time, a variable was a simple string.  Later it was changed to be an array.  You are trying to access the string as if it were an array and this makes PHP unhappy.  This often happens as part of a contribution install.  Code either gets downgraded or upgraded as the contribution code is integrated. 

Unfortunately, the problem is where it is set as a string not where the error shows.  Ideally you'd modify that to set it as an array. 

The third warning (non-numeric) is less clear but may be related to this (perhaps it is trying use the cost result). 

The fourth warning (headers already sent) is just saying that there were already warnings.  If you get rid of the first three, it will go away. 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@milerwan you don't say what version of oscommerce you're running


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

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

@milerwan you don't say what version of oscommerce you're running

V2.3.4BS Master/Edge.


Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

The standard order class has only 342 lines of code so yours is clearly customised and none of the numbers line up.

However, my best guess is that the error's being thrown in the method that loads the order from the cart.

The errors are just telling you that the global $shipping does not have keys title and cost set.

The normal behaviour of osc is not to reset the shipping method when you go back to the cart. I would expect that a change in the cart followed by pressing checkout would take you to the shipping page with the same module selected as was selected the first time (but the quote changed if appropriate).

If you have something that's supposed to reset the shipping, it looks like it's emptying the array but not unregistering the session variable.

This isn't directly php7-related. It's a bug in your code but you're only seeing the error messages because php7 complains if you try to use array keys that aren't set. The actual error is that the array isn't set when it should be.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

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
Posted (edited)

@BrockleyJohn

Actually I have a bunch of modified files...

I did several tests and the errors appear when :
I add a product and click button to order + checkout shipping validation
- I use the refresh button on "shopping_cart.php" and click button to order + checkout shipping validation

When the errors appeared, If I don't re-do the same top actions, no more errors during checkout. 

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

I suggest putting in debugging displays (into html comments) so you can see what's happening to the shipping session variable


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

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
Posted (edited)
13 hours ago, BrockleyJohn said:

I suggest putting in debugging displays (into html comments) so you can see what's happening to the shipping session variable

A priori it is a missing session creation and I fix it temporarily by adding this at the place of choice of delivery modes :

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

I will try to understand where and how the session could be "un_registered".
Thank you for your help. :)

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites
Posted (edited)

@BrockleyJohn

I found the script causing the problem but it is not changed :

// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
  if (!tep_session_is_registered('cartID')) {
    tep_session_register('cartID');
  } elseif (($cartID != $cart->cartID) && tep_session_is_registered('shipping')) {
    tep_session_unregister('shipping');
  }

In my case the "tep_session_unregistrerd('shipping')" function is activated (if I comment it, no more errors).

So the problem seems to come from this condition :

elseif (($cartID != $cart->cartID) && tep_session_is_registered('shipping'))

Do you have an idea of what can be problematic?

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

I can only guess.

Step 1 - identify which order method is throwing these

Step 2 - check when it's executed

Step 3 - if shipping is supposed not to be set, fix the order class. If it is supposed to be set, fix checkout_shipping


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

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
Posted (edited)
3 hours ago, BrockleyJohn said:

I can only guess.

Step 1 - identify which order method is throwing these

Step 2 - check when it's executed

Step 3 - if shipping is supposed not to be set, fix the order class. If it is supposed to be set, fix checkout_shipping

Ok I have found, instead of this original code :

  if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

I have modified like this :

  if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) )
  // cheapest or neutral START
//  $shipping = $shipping_modules->cheapest();
  if (DEFAULT_SHIPPING == 'neutral') {
    $shipping = $shipping_modules->neutral();
  } else {
    $shipping = $shipping_modules->cheapest();
  }
  // cheapest or neutral END


It seems the comments + the return to the line did not allow for taking into account the added lines that followed the condition... 😓

Writing like this, it works now :

  if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) {
  // cheapest or neutral START
//  $shipping = $shipping_modules->cheapest();
  if (DEFAULT_SHIPPING == 'neutral') {
    $shipping = $shipping_modules->neutral();
  } else {
    $shipping = $shipping_modules->cheapest();
  }
  // cheapest or neutral END
  }

Many thanks for your time and your help @BrockleyJohn

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

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

×