Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Joomla Virtuemart Template - DarkMart (SKU# FLEX-00011)

TOPIC: Warning: Invalid argument supplied for foreach()

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3590

Hello,
had the following warning:
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/myshop.nl/httpdocs/templates/flexible_darkmart/html/com_virtuemart/category/default.php on line 418.

I'm using VM 2.0.20b, Joomla 2.5.9, Darkmart 1.2

The warning apears in the productsdetailpage..

thanx,
Hennie
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3596

Hi Hennie,

it's just a warning - not an error - so indicates your reporting is set too high -
but to get rid of it try this

change from line 416
if ($params->get('category_addtocart_list',1)) {
	$customFieldCheck = 1;
		foreach ($product->customfieldsCart as $field) {
			if (($field->field_type == "E") || ($field->field_type == "A")) {
				 $customFieldCheck = 0;
			}
		}
 

to
 
if ($params->get('category_addtocart_list',1)) {
 
		$customFieldCheck = 1;
                    if($product->customfieldsCart){//added for if check
			foreach ($product->customfieldsCart as $field) {
				if (($field->field_type == "E") || ($field->field_type == "A")) {
				      $customFieldCheck = 0;
				}
			}
		}//added for if
 
Last Edit: 10 years 10 months ago by John.
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3631

Hi John,

thank you for your reply .. I added the line into the default.php but got a 404 page... and opening the shop again in the category page the next error was showing "Parse error: syntax error, unexpected T_ELSEIF in /var/www/vhosts/myhop.nl/httpdocs/templates/flexible_darkmart/html/com_virtuemart/category/default.php on line 1258

best regards, Hennie
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3633

Triple check your code addition - if you have a parse error you have made a mistake..

you are adding 2 extra lines

if($product->customfieldsCart){//added for if check

and

}//added for if


Cheers
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3636

Hi John,
I have to admit I don't have any clue from PHp so I now just copied and paste the lines in your response.. :-)
but.. got the follow error:
Parse error: syntax error, unexpected '}' in /var/www/vhosts/shop.nl/httpdocs/templates/flexible_darkmart/html/com_virtuemart/category/default.php on line 550


kind regards,
Hennie
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3640

if you send your ftp details to This email address is being protected from spambots. You need JavaScript enabled to view it. (put the post subject in the subject) I can do it for you
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3644

I've send you the details, thx Hennie
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 3 weeks ago #3651

Done but I have no way to check - your site has no menus etc

cheers
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 1 week ago #3982

John, you can close this topic.. problem solved :-) Thanks
The topic has been locked.

Warning: Invalid argument supplied for foreach() 11 years 1 week ago #3994

Thanks for letting us know..
cheers

topic solved
The topic has been locked.
Time to create page: 0.136 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo