Warning message

  • Posts: 4
  • Thank you received: 1
13 years 4 months ago #76616

Goodday,

After updating to 2.0 (essential) I have a warning message at the frontend of some articles/products.
the warning says:

Warning: Invalid argument supplied for foreach() in /home/sites/www.bloklandvw.nl/web/components/com_hikashop/views/product/view.html.php on line 1407

Here is a link
to a page with this problem..

Can you help me solve this problem...


Thanks..

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

  • Posts: 13201
  • Thank you received: 2322
13 years 4 months ago #76736

Hi,

Can you add a var_dump($element->variants); before the foreach and tell us what is the result ?

Try to add a:

if(!is_array($element->variants)) $element->variants = (array)$element->variants;

After:
if(!empty($element->variants)){
near the line 1348.

Last edit: 13 years 4 months ago by Xavier.

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

  • Posts: 4
  • Thank you received: 1
13 years 4 months ago #76930

I added the line in view.html.php but after that the website crashes..
So I removed it.

I have attached the file, so you can take a look at it..

Thank you..

Sietse

This message has an attachment file.
Please log in or register to see it.

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

  • Posts: 13201
  • Thank you received: 2322
13 years 4 months ago #77002

Hi,

The error is based on "$element->characteristics" not on the variants, my apologize.

Can you try to replace the code:

				foreach($element->characteristics as $k2 => $characteristic2){
					if(!empty($variant->characteristics)){
						foreach($variant->characteristics as $k3 => $characteristic3){
							if($k2==$k3){
								$temp[$k3]=$characteristic3;
								break;
							}
						}
					}
				}
To:
                          if(is_array($element->characteristics){
				foreach($element->characteristics as $k2 => $characteristic2){
					if(!empty($variant->characteristics)){
						foreach($variant->characteristics as $k3 => $characteristic3){
							if($k2==$k3){
								$temp[$k3]=$characteristic3;
								break;
							}
						}
					}
				}
                        }

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

Time to create page: 0.068 seconds
Powered by Kunena Forum