Jump to content
syscon

upgrading osCommerce 2.2 RC2 to PHP 7.3

Recommended Posts

I am working on upgrading osCommerce 2.2 RC2 to work with PHP 7.3, and I'm almost done but in Admin section: Moduels I am getting some errors:

Shipping Modules	

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/catalog/admin/modules.php on line 233

Warning: Use of undefined constant MODULE_SHIPPING_ITEM_SORT_ORDER - assumed 'MODULE_SHIPPING_ITEM_SORT_ORDER' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/item.php on line 23

Warning: Use of undefined constant MODULE_SHIPPING_ITEM_TAX_CLASS - assumed 'MODULE_SHIPPING_ITEM_TAX_CLASS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/item.php on line 25

Warning: Use of undefined constant MODULE_SHIPPING_ITEM_STATUS - assumed 'MODULE_SHIPPING_ITEM_STATUS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/item.php on line 26

Warning: Use of undefined constant MODULE_SHIPPING_TABLE_SORT_ORDER - assumed 'MODULE_SHIPPING_TABLE_SORT_ORDER' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/table.php on line 23

Warning: Use of undefined constant MODULE_SHIPPING_TABLE_TAX_CLASS - assumed 'MODULE_SHIPPING_TABLE_TAX_CLASS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/table.php on line 25

Warning: Use of undefined constant MODULE_SHIPPING_TABLE_STATUS - assumed 'MODULE_SHIPPING_TABLE_STATUS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/table.php on line 26

Warning: Use of undefined constant MODULE_SHIPPING_USPS_SORT_ORDER - assumed 'MODULE_SHIPPING_USPS_SORT_ORDER' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/usps.php on line 23

Warning: Use of undefined constant MODULE_SHIPPING_USPS_TAX_CLASS - assumed 'MODULE_SHIPPING_USPS_TAX_CLASS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/usps.php on line 25

Warning: Use of undefined constant MODULE_SHIPPING_USPS_STATUS - assumed 'MODULE_SHIPPING_USPS_STATUS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/usps.php on line 26

Warning: Use of undefined constant MODULE_SHIPPING_ZONES_SORT_ORDER - assumed 'MODULE_SHIPPING_ZONES_SORT_ORDER' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/zones.php on line 105

Warning: Use of undefined constant MODULE_SHIPPING_ZONES_TAX_CLASS - assumed 'MODULE_SHIPPING_ZONES_TAX_CLASS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/zones.php on line 107

Warning: Use of undefined constant MODULE_SHIPPING_ZONES_STATUS - assumed 'MODULE_SHIPPING_ZONES_STATUS' (this will throw an Error in a future version of PHP) in /var/www/html/catalog/includes/modules/shipping/zones.php on line 108

Any programmer that can provide any input on it?


#Joseph

Share this post


Link to post
Share on other sites

I know how to fix the deprecated errors, but I am not sure where to find the constants mentioned; they don't seem to be defined anywhere that I can find.


#Joseph

Share this post


Link to post
Share on other sites

MODULE_SHIPPING_ITEM_ would be the database configuration entries for the item shipping module.  It's basically saying that you are trying to load the module before installing it.  Which of course is what that page does.  It loads modules so that you can install them. 

You could look at older versions of CE Phoenix to see how those warnings were handled:  https://github.com/gburton/CE-Phoenix/blob/e55fc1aa13cab513b7572eb32e73386a4cbdf2bc/includes/modules/shipping/item.php

Or you could just switch to CE Phoenix and all that work would have already been done. 


Always back up before making changes.

Share this post


Link to post
Share on other sites

Thank you Matt, that is very helpful.

My osCommerce ver. 2.2 RC2 is converted almost 95% to PHP 7.3 (everything works)  I just have two issues remaining.

1.)  VISUAL VERIFY CODE

It doesn't display correctly, here is a picture from contact us: 

Screenshot.thumb.jpg.3047c0bc655ecb772559763d6a7d679b.jpg

I think the relevant code is: from: contact_us.php

//VISUAL VERIFY CODE start
require(DIR_WS_FUNCTIONS . 'visual_verify_code.php');

$code_query = tep_db_query("select code from visual_verify_code where oscsid = '" . $HTTP_GET_VARS['osCsid'] . "'");
$code_array = tep_db_fetch_array($code_query);
$code = $code_array['code'];

tep_db_query("DELETE FROM " . TABLE_VISUAL_VERIFY_CODE . " WHERE oscsid='" . $vvcode_oscsid . "'"); //remove the visual verify code associa$

$user_entered_code = $HTTP_POST_VARS['visual_verify_code'];
if (!(strcasecmp($user_entered_code, $code) == 0)) { //make the check case insensitive
$error = true;
$messageStack->add('contact', VISUAL_VERIFY_CODE_ENTRY_ERROR);
}
//VISUAL VERIFY CODE stop

and the second file:  from: includes/functions/visual_verify_code.php

<?php
/*
///////////////////////////////////////////////////
  file: visual_verify_code.php,v 1.0 26SEP03

Written for use with:
  osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com
Part of Contribution Named:
  Visual Verify Code (VVC) by William L. Peer, Jr. (wpeer@forgepower.com) for www.onlyvotives.com

[Modified By] [Date] [Mods Made]
-------------------------------------------


-------------------------------------------
*/

//////////////////////////////
/* This funtion has the responsibility of displaying the actual visual code with random results.
   It randomly picks an x and y position as well as font size for each character in the visual code
*/
function vvcode_render_code($code) {
        if (!empty($code)) {
            $imwidth=200;
            $imheight=40;
         $font_size = $imheight * 0.75;
         $font_position = $imheight * 0.30;

            Header("Content-type: image/Jpeg");
            $im = @ImageCreate ($imwidth, $imheight) or die ("Cannot Initialize new GD image stream");

            $background_color = ImageColorAllocate ($im, 255,255,255);
            $text_color = ImageColorAllocate ($im, 20,40,100);
            $border_color = ImageColorAllocate ($im, 0,0,0);
         $noise_color = ImageColorAllocate($im, 200, 200, 200);
         
         /* generate random dots in background */
            for( $n=0; $n<($imwidth*$imheight)/3; $n++ ) {
            imagefilledellipse($im, mt_rand(0,$imwidth), mt_rand(0,$imheight), 1, 1, $noise_color);
            }
         /* generate random lines in background */
            for( $n=0; $n<($imwidth*$imheight)/150; $n++ ) {
            imageline($im, mt_rand(0,$imwidth), mt_rand(0,$imheight), mt_rand(0,$imwidth), mt_rand(0,$imheight), $noise_color);
            }
      
         //strip any spaces that may have crept in
            //end-user wouldn't know to type the space! :)
            $code = str_replace(" ", "", $code);
            $x=0;

            $stringlength = strlen($code);

            for ($i = 0; $i< $stringlength; $i++) {
                 $x = $x + $font_size;
                 $y = $font_position;
             $font = ImageLoadFont("includes/fonts/automatic.gdf");
                 $single_char = substr($code, $i, 1);
                 imagechar($im, $font, $x, $y, $single_char, $text_color);
                }


            imagerectangle ($im, 0, 0, $imwidth-1, $imheight-1, $border_color);
            ImageJpeg($im);
            ImageDestroy;
        }
  }

Anybody has any idea it doesn't display anything and/or how to fix it.

 

2.)  I would like to convert the code so the "padlock" appear without an error message.  The code is a mixture of http and https on one page so users will be getting a warning message from newer browsers, like on a picture below: 

Screenshot2.jpg.7b6d7993da8257e6b17fecfa2ba0b363.jpg

I've tried changing in configure.php 

  define('HTTP_SERVER', 'http://www.sysconcept.ca');
  define('HTTP_CATALOG_SERVER', 'http://www.sysconcept.ca');

to

  define('HTTP_SERVER', 'https://www.sysconcept.ca');
  define('HTTP_CATALOG_SERVER', 'https://www.sysconcept.ca');

It does not help.  What changes are need to be made in order to show entire page in https


#Joseph

Share this post


Link to post
Share on other sites

SOLVED.

The image not showing up in VISUAL VERIFY CODE - solution.

The PHP needs to be installed (compiled) with "gd" flag.  IF that flag is missing the image will not show up in VISUAL VERIFY CODE


#Joseph

Share this post


Link to post
Share on other sites

I mean no offense by the following but I am very curious as to why you would go to all of this trouble? I think it is great that you were able to get the old code to work as it is but now that you've done that, you've basically have old code with lipstick on it. :/ Also, is your shop compatible with new addons that take into account the changes that come with Phoenix or do you plan on converting any addon you want to work with your shop?

Share this post


Link to post
Share on other sites

I'm not installing any additional addons at the moment and the module I need are missing in Phoenix.  Besides upgrading/converting to from OSC-2.2 to Phoenix would be more work than fixing requirement that are needed by PHP-7.4 


#Joseph

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

×