Back button

Lots of errors from this addon - Back button

Lots of errors from this addon

by 14Steve14 » Mon Jun 17, 2024 8:32 am

I have this installed on version 1.9.0. and I am getting lots of errors. Here is the error
[17-Jun-2024 09:26:51 Europe/London] PHP Warning: Undefined array key -1 in /####/####/####/includes/modules/pi/product_info/pi_back_button.php on line 38
[17-Jun-2024 09:26:51 Europe/London] PHP Warning: Trying to access array offset on value of type null in /####/####/####/includes/modules/pi/product_info/pi_back_button.php on line 38
[17-Jun-2024 09:26:51 Europe/London] PHP Warning: foreach() argument must be of type array|object, null given in /####/####/####/includes/modules/pi/product_info/pi_back_button.php on line 38
Here is line 38

Code: Select all

      foreach ($_SESSION['navigation']->path[$back]['get'] as $key => $value ) {
Is there a cure for this problem.
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Contact:

Re: Lots of errors from this addon

by Omar_one » Mon Jun 17, 2024 4:15 pm

Hello Steve,
I don't have version 1.9.0 full installed.
can you please try to
change the lines 34-40

Code: Select all

    public function getOutput() {
		global  $navigation;
		$back = sizeof($_SESSION['navigation']->path)-2;
                $back_path = '';
                foreach ($_SESSION['navigation']->path[$back]['get'] as $key => $value ) {
                $back_path = $key . '=' . $value;
                }
to this

Code: Select all

 public function getOutput() {
		global  $navigation;
		$back = sizeof($_SESSION['navigation']->path)-2;
                $back_path = '';
	        if (isset($_SESSION['navigation']->path[$back]['get']) && is_array($_SESSION['navigation']->path[$back]['get']))
		  { 
	  foreach ($_SESSION['navigation']->path[$back]['get'] as $key => $value){
		$back_path.= $key. '='. $value. '&'; 
                //$back_path = $key . '=' . $value;
		} 
		$back_path = rtrim($back_path, '&');
      }
let me know if it's working
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Contact:

Re: Lots of errors from this addon

by Omar_one » Wed Jun 19, 2024 7:25 pm

did this changes fix the issue ?? @14Steve14
if you let me know so I can update the module
Br
Omar
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Contact:

Re: Lots of errors from this addon

by 14Steve14 » Sat Jun 22, 2024 11:30 am

Omar_one wrote:did this changes fix the issue ?? @14Steve14
if you let me know so I can update the module
Br
Omar
That code is exactly the same as the code I was using so made no difference.
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Contact:

Re: Lots of errors from this addon

by Omar_one » Sat Jun 22, 2024 5:16 pm

test it on 1.0.9.3 (PHP 8.2 ) with my changing working fine without any error,
But it's not same code on the module ,, Did you tried my change.
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Contact:

does this work in 1.0.8.19?

by martindavinci » Fri Jan 17, 2025 6:46 pm

I did get it working in 1.0.8.17 but, for unknown reason, i can't get it working in 1.0.8.19 (php 8.0). Perhaps I made a mistake somewhere, so I would like to know. Thanks in advance, grts, Martin
User avatar
martindavinci
Member
Posts: 38
Joined: Mon Mar 08, 2021 8:33 am
Phoenix Version: 1.1.0.5
Contact:

Re: Lots of errors from this addon

by Omar_one » Fri Jan 17, 2025 8:01 pm

martindavinci wrote:I did get it working in 1.0.8.17 but, for unknown reason, i can't get it working in 1.0.8.19 (php 8.0). Perhaps I made a mistake somewhere, so I would like to know. Thanks in advance, grts, Martin
is there any error ? I have it working on 1.0.8.16 and just test it on 1.0.9.3 and 1.0.9.9 and it's working fine
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Contact:

Re: Lots of errors from this addon

by martindavinci » Sun Jan 19, 2025 11:40 am

Hello Omar
I don't get to see a back button in the product page. Also no mention in the page source of the word ‘back’ in the page except that of 'back to top'.
The sort order is different; php8.0; 1.0.8.19
User avatar
martindavinci
Member
Posts: 38
Joined: Mon Mar 08, 2021 8:33 am
Phoenix Version: 1.1.0.5
Contact:

Re: Lots of errors from this addon

by Omar_one » Sun Jan 19, 2025 1:06 pm

Did you installed the module?
Omar_one
Senior Contributor
Posts: 677
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Contact:

Re: Lots of errors from this addon

by martindavinci » Sun Jan 19, 2025 5:30 pm

of course
User avatar
martindavinci
Member
Posts: 38
Joined: Mon Mar 08, 2021 8:33 am
Phoenix Version: 1.1.0.5
Contact: