Page 1 of 1

Undefined Index Error

Posted: Fri Feb 18, 2022 6:28 am
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

Re: Undefined Index Error

Posted: Fri Feb 18, 2022 7:19 am
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

Re: Undefined Index Error

Posted: Fri Feb 18, 2022 10:02 am
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