If this is your first visit, check our documentation. To post, register or login.
Forums / Upgrading Your Zen Cart / Upgrading to 2.x.x / 2.01 log file question

2.01 log file question

Started by foghead on 1 Sep 2024, 12:12 AM · Views: 2,258

Results 1 to 20 of 26
1 Sep 2024, 12:12 AM
#1
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #1 by foghead

I am very close to uploading to the live server. This is what ths log file is showing now.
Once again I have no idea what this means.

[31-Aug-2024 17:45:16 UTC] PHP Fatal error: Uncaught Error: Undefined constant "CHARSET" in /includes/init_includes/init_templates.php:114
Stack trace:
#0 /includes/autoload_func.php(40): require_once()
#1 /includes/application_top.php(253): require('/home/fyf2bpn91...')
#2 /index.php(25): require('/home/fyf2bpn91...')
#3 {main}
thrown in /includes/init_includes/init_templates.php on line 114

[31-Aug-2024 17:45:16 UTC] Request URI: /index.php?main_page=contact_us, IP address: 52.167.144.185
--> PHP Fatal error: Uncaught Error: Undefined constant "CHARSET" in /includes/init_includes/init_templates.php:114
Stack trace:
#0 /includes/autoload_func.php(40): require_once()
#1 /includes/application_top.php(253): require('/home/fyf2bpn91...')
#2 /index.php(25): require('/home/fyf2bpn91...')
#3 {main}
thrown in /includes/init_includes/init_templates.php on line 114.

[31-Aug-2024 17:45:16 UTC] Request URI: /index.php?main_page=contact_us, IP address: 52.167.144.185
--> PHP Fatal error: Uncaught Error: Undefined constant "CHARSET" in /includes/init_includes/init_templates.php:114
Stack trace:
#0 /includes/autoload_func.php(40): require_once()
#1 /includes/application_top.php(253): require('/home/fyf2bpn91...')
#2 /index.php(25): require('/home/fyf2bpn91...')
#3 {main}
thrown in /includes/init_includes/init_templates.php on line 114.

1 Sep 2024, 1:54 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #2 by lat9

The CHARSET definition is present in the as-shipped version of /includes/languages/lang.english.php (line 94):

    'CHARSET' => 'utf-8',

If that constant isn't present, I'd expect to see a ton of additional logs, since that value is supplied whenever the PHP function htmlspecialchars is used (and it's used a lot).

1 Sep 2024, 6:17 PM
#3
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #3 by foghead

lat9:

The CHARSET definition is present in the as-shipped version of /includes/languages/lang.english.php (line 94):

'CHARSET' => 'utf-8',
> 
> If that constant isn't present, I'd expect to see a ton of additional logs, since that value is supplied whenever the PHP function [htmlspecialchars](https://www.php.net/manual/en/function.htmlspecialchars.php) is used (and it's used a lot).

I do see that in /includes/languages/lang.english.php although it is on line 91. Still not sure what I need to do to reslove issue.
1 Sep 2024, 6:56 PM
#4
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Post #4 by gothstone

Check /includes/language/name-of-your-template/lang.english.php
And see if CHARSET is undefined or set to something silly like 'CHARSET' => ' ',

Also check for a /includes/language/name-of-your-template/english.php in the old language define format since you are comming from 1.5.7

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

1 Sep 2024, 7:53 PM
#5
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #5 by foghead

gothstone:

Check /includes/language/name-of-your-template/lang.english.php
And see if CHARSET is undefined or set to something silly like 'CHARSET' => ' ',
Also check for a /includes/language/name-of-your-template/english.php in the old language define format since you are comming from 1.5.7

CHARSET does not appear in /includes/language/responsive_classic/lang.english.php which is the template I am using. There isn't an english.php in that folder as well.

1 Sep 2024, 8:14 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Post #6 by swguy

includes/language/responsive_classic/lang.english.php is not part of the build. You have to check it against the base file from the build - includes/language/lang.english.php - and add whatever is needed.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

3 Sep 2024, 6:41 PM
#7
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #7 by foghead

swguy:

includes/language/responsive_classic/lang.english.php is not part of the build. You have to check it against the base file from the build - includes/language/lang.english.php - and add whatever is needed.

As usual I'm a bit confused. In includes/language/english/responsive_classic I have lang.index.php. What file do I add to?

3 Sep 2024, 6:58 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Post #8 by swguy

includes/language/english/YOUR_TEMPLATE is for per page files.

includes/languages/YOUR_TEMPLATE is where the master language file goes.

You want to modify the file in the second folder.

includes/language/responsive_classic/lang.english.php

Start with what's in the base file:
includes/language/lang.english.php

and add your customizations.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

3 Sep 2024, 7:18 PM
#9
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #9 by foghead

Under includes/languages the only folders there are english and classic along with lang_english.php

3 Sep 2024, 7:25 PM
#10
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Post #10 by swguy

Create a responsive_classic folder under includes/languages.

Copy includes/languages/lang.english.php into that folder.

Now you have includes/languages/responsive_classic/lang.english.php

Customize to taste.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

3 Sep 2024, 7:53 PM
#11
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #11 by foghead

That got rid of the errors in the above log. Now when I login in as a customer and add items to the cart i get the errors below.
I feel like I am very close to wrapping this up but still just cant' get there. I really appreciate all the help.

[03-Sep-2024 19:46:23 UTC] Request URI: /index.php?main_page=checkout_shipping, IP address: 152.42.24.4, Language id 1
#0 /includes/modules/shipping/table.php(166): zen_debug_error_handler()
#1 /includes/classes/shipping.php(245): table->quote()
#2 /includes/modules/pages/checkout_shipping/header_php.php(160): shipping->quote()
#3 /index.php(35): require('/home/fyf2bpn91...')
--> PHP Warning: A non-numeric value encountered in /includes/modules/shipping/table.php on line 166.

3 Sep 2024, 8:05 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #12 by lat9

Check the configuration for the 'Table' shipping module; that's where that non-numeric value is coming from.

3 Sep 2024, 8:20 PM
#13
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #13 by foghead

I looked there and had no idea what should be there. Here is what I have in includes/modules/shipping/table.php
Line 160 - 169

$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
  if (round($order_total,9) <= $table_cost[$i]) {
    if (strstr($table_cost[$i+1], '%')) {
      $shipping = ($table_cost[$i+1]/100) * $order_total_amount;
    } else {
      $shipping = $table_cost[$i+1];
    }
    break;
3 Sep 2024, 9:53 PM
#14
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #14 by lat9

Foghead:

I looked there and had no idea what should be there. Here is what I have in includes/modules/shipping/table.php
Line 160 - 169

$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
  if (round($order_total,9) <= $table_cost[$i]) {
    if (strstr($table_cost[$i+1], '%')) {
      $shipping = ($table_cost[$i+1]/100) * $order_total_amount;
    } else {
      $shipping = $table_cost[$i+1];
    }
    break;

I'm not talking about the code. The error that's being triggered is based on invalid data being set for the shipping-modules rates-table. See the admin's Modules :: Shipping :: Table Rates.

3 Sep 2024, 10:48 PM
#15
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #15 by foghead

I did understand that you meant Admin Shipping Modules. I looked at that and everything seemed to be correct. The only modules I have installed
are store pickup and table rate. Here are the settings.

Table Rate
Enable Table Method
True
Shipping Table
100000:15%
Table Method
price
Handling Fee
0
Handling Per Order or Per Box
Order
Tax Class
--none--
Tax Basis
Shipping
Shipping Zone
--none--
Sort Order
0

Customer In Store Pick-up
Enable Store Pickup Shipping
True
Pickup Locations
Walk In
Shipping Cost
0.00
Tax Class
--none--
Tax Basis
Shipping
Shipping Zone
--none--
Sort Order
0

4 Sep 2024, 12:24 AM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #16 by lat9

Foghead:

I did understand that you meant Admin Shipping Modules. I looked at that and everything seemed to be correct. The only modules I have installed
are store pickup and table rate. Here are the settings.

Table Rate
Enable Table Method
True
Shipping Table
100000:15%
Table Method
price
Handling Fee
0
Handling Per Order or Per Box
Order
Tax Class
--none--
Tax Basis
Shipping
Shipping Zone
--none--
Sort Order
0

Customer In Store Pick-up
Enable Store Pickup Shipping
True
Pickup Locations
Walk In
Shipping Cost
0.00
Tax Class
--none--
Tax Basis
Shipping
Shipping Zone
--none--
Sort Order
0

Thanks for that!  With those settings, I've replicated your issue on the zc210-alpha2 build.  I'll post back when I've found the correction; thanks for your patience.
4 Sep 2024, 12:41 AM
#17
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #17 by lat9

The 'full' correction for zc210 is posted in this PR: https://github.com/zencart/zencart/pull/6725

Changing line 126 of your table.php file to the following "should" correct the issue:

                    $shipping = ([B]rtrim([/B]$table_cost[$i + 1][B], '%')[/B] / 100) * $order_total_amount;
4 Sep 2024, 1:07 AM
#18
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #18 by foghead

Thanks very much for your time and expertise. You are greatly appreciated.
I will make the changes right now.

4 Sep 2024, 1:19 AM
#19
foghead avatar

foghead

New Zenner

Join Date:
Dec 2021
Location:
Tennessee
Posts:
43
Plugin Contributions:
0

Post #19 by foghead

I added that code to table.php. I still get the same errors in the log file.
Not 100% I added it correctly. Below is my edited code lines 121 - 133.

    $check->MoveNext();
  }

  if ($check_flag == false) {
    $this->enabled = false;
  } $shipping = (rtrim($table_cost[$i + 1], '%') / 100) * $order_total_amount;
}

if ($this->enabled) { 
    // -----
    // Give a watching observer the opportunity to disable the overall shipping module.
    //
    $this->notify('NOTIFY_SHIPPING_TABLE_UPDATE_STATUS', [], $this->enabled);
4 Sep 2024, 2:26 AM
#20
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #20 by lat9

Foghead:

I added that code to table.php. I still get the same errors in the log file.
Not 100% I added it correctly. Below is my edited code lines 121 - 133.

    $check->MoveNext();
  }

  if ($check_flag == false) {
    $this->enabled = false;
  } $shipping = (rtrim($table_cost[$i + 1], '%') / 100) * $order_total_amount;
}

if ($this->enabled) { 
    // -----
    // Give a watching observer the opportunity to disable the overall shipping module.
    //
    $this->notify('NOTIFY_SHIPPING_TABLE_UPDATE_STATUS', [], $this->enabled);

Nope, back that out. That was my bad; the replacement should have been on line 166, highlighted below.

    $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
    $size = sizeof($table_cost);
    $shipping = 0; 
    for ($i=0, $n=$size; $i<$n; $i+=2) {
      if (round($order_total,9) <= $table_cost[$i]) {
        if (strstr($table_cost[$i+1], '%')) {
          $shipping = ([B]rtrim([/B]$table_cost[$i+1][B], '%')[/B]/100) * $order_total_amount;  //- This is line 166 in the as-shipped zc201 version of the file
        } else {
          $shipping = $table_cost[$i+1];
        }
        break;
      }
    }