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
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | uc_multiprice-611348.patch | 1.82 KB | Anonymous (not verified) |
Comments
Comment #1
aries commentedAs a hotfix, put this right before the foreach line:
Comment #2
rowzee commentedi'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.
Comment #3
rowzee commentedhelp? anyone? pretty please. :)
Comment #4
rowzee commentedok...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!
Comment #5
rowzee commentedi deleted the product that wasn't working and replaced it, and now everything's working, so please ignore my previous posts.
Comment #6
aries commentedCan we say that my hotfix solves the problem?
Comment #7
rowzee commentedyes, i believe it does. thank you! :)
Comment #8
plasticlax commenteddeleting 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.
Comment #9
Anonymous (not verified) commentedI have noticed that the $countries array in hook_form_alter in uc_multiprice.module is passed to the $form array even when it is empty, i.e. when all countries had a entered a price and therefore no more country to be selected in the dropdown select box.
Attached patch checks the array before it goes and add the empty dropdown select box, and causes form.inc to complain.
Comment #10
Docc commentedClosing. This is fixed in 2.x branch