Invalid argument for foreach() cart.php line 1491

  • Posts: 8
  • Thank you received: 0
12 years 2 weeks ago #74551

Hello, I have this message when displaying the payment method page

Warning: Invalid argument supplied for foreach() in /home/********/administrator/components/com_hikashop/classes/cart.php on line 1491

Apparently, the variable $subs has not been initialized or is not an array.

Can you please check it ?

Thanks for your help.
-Tom

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 2 weeks ago #74563

Hi,

Can you try to replace:

				foreach($subs as $value){
					if(isset($value->recurring) && $value->recurring == '1'){
						$durations[$i] = $value->duration;
						$recurring++;
					}
					$i++;
				}

By:
			if(isset($subs) && !empty($subs)){
				foreach($subs as $value){
					if(isset($value->recurring) && $value->recurring == '1'){
						$durations[$i] = $value->duration;
						$recurring++;
					}
					$i++;
				}
			}

The following user(s) said Thank You: tommytom

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
12 years 2 weeks ago #74570

Thanks Xavier for answering fast,
That worked well. I no longer have the message now.
-Tom

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum