Undefined Index Error

Open to all! Ask other shopowners for help.
Post Reply
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Undefined Index Error

Post by radhavallabh »

Hi all;
I am trying to revamp a old module from Oscommerce 2.3 for Phoenix to make edit to my Orders-
On updating the Shipping Method to the order I get below error-
Notice: Undefined index: shipping in /xx/xx/includes/modules/order_total/ot_shipping.php on line 39

And the line 39 in the module is-

Code: Select all

$module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
Please can you guide me on how to resolve the index related error,
I tried below code still no avail I get the same error-

Code: Select all

if (!isset($module)) {
      $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
}
Help shall be deeply appreciated dear;
Thank you in advance;
Warm Regds./
radhavallabh


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Undefined Index Error

Post by ecartz »

1. Figure out how it used to set the shipping (probably as a global, $shipping ).
2. Set the $_SESSION['shipping'] using a similar approach.
3. Do stuff with order totals.
4.

Code: Select all

unset($_SESSION['shipping']);
Or just buy app.php/addons/paid_addon/order_editor
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Undefined Index Error

Post by radhavallabh »

ecartz wrote: Fri Feb 18, 2022 7:19 am 1. Figure out how it used to set the shipping (probably as a global, $shipping ).
2. Set the $_SESSION['shipping'] using a similar approach.
3. Do stuff with order totals.
4.

Code: Select all

unset($_SESSION['shipping']);
Or just buy app.php/addons/paid_addon/order_editor
Hi dear I tried another approach as well please tell me if it is fine-
I edited the ot_shipping code as below which fixed the issue and not returning any error now...... is it ok to use it? Please let me know if this could cause any other issue to the store working....

Code: Select all

  $module = substr(isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'], 0, strpos(isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'], '_'));
Thank you so much for helping me out in figuring out how to fix codes, As really trying to learn hard.... :)
Regds./
radhavallabh


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply