Skip to main content

Warning message

More
13 years 10 months ago #76616 by blokland
Warning message was created by blokland
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.

More
13 years 10 months ago - 13 years 10 months ago #76736 by Xavier
Replied by Xavier on topic Warning message
Hi,

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

Try to add a:
Code:
if(!is_array($element->variants)) $element->variants = (array)$element->variants;

After:
Code:
if(!empty($element->variants)){
near the line 1348.
Last edit: 13 years 10 months ago by Xavier.

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

More
13 years 10 months ago #76930 by blokland
Replied by blokland on topic Warning message
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

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

More
13 years 10 months ago #77002 by Xavier
Replied by Xavier on topic Warning message
Hi,

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

Can you try to replace the code:
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:
Code:
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.171 seconds
Powered by Kunena Forum