warning: Invalid argument supplied for foreach() in form.inc on line 1428
afestein - October 22, 2009 - 05:05
| Project: | UC Multiprice |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi all,
The multiprice module works nicely with my site. However after creating a product and successfully entering the price details, if I go back and edit the product I get the error message:
warning: Invalid argument supplied for foreach() in /var/www/vhosts/clientwebsite.com/httpdocs/includes/form.inc on line 1428
The country drop down list is now blank with no options to select.
The offending line is the start of a foreach:
foreach ($choices as $key => $choice) {
Any ideas?
A

#1
As a hotfix, put this right before the foreach line:
<?phpif (!is_array($choices)) {
$choices = array();
}
?>
#2
i'm having the same issue. since i'm pretty much a noob, i'd just like to clarify: does that hotfix go in the form.inc file? because when i add it there, i still get the same error.
thanks in advance.
#3
help? anyone? pretty please. :)
#4
ok...i've experimented a bit. if i place this (sans the php tags):
if (!is_array($choices)) {
$choices = array();
}
before this:
foreach ($choices as $key => $choice) {
it fixes the error -- but i still don't have a country pull down.
thanks!
#5
i deleted the product that wasn't working and replaced it, and now everything's working, so please ignore my previous posts.
#6
Can we say that my hotfix solves the problem?
#7
yes, i believe it does. thank you! :)
#8
deleting one of the overrides also works to remove the error. i am only setting 2 of the available countries because of the bug which won't let you set just one override. but then you have to delete the other one to if you want to set the one you deleted again. i think this relates to the idea that the select box should be on "Please select" rather than a default country.
also i noticed that if you hit ENTER in the override form, you lose the image and the category assignments. i also don't think changing these overrides creates a new revision.