Closed (fixed)
Project:
e-Commerce
Version:
6.x-4.0-beta4
Component:
product
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2008 at 20:48 UTC
Updated:
1 May 2009 at 00:10 UTC
Hello,
Any time I choose a product type on a node and click the "add to store" button, I get this error message: "Validation error, please try again. If this error persists, please contact the site administrator"
Am I doing something wrong? How can I get the "add to store" functionality working properly?
Thank you!
Comments
Comment #1
gordon commentedI have tested this and I can't find the issue. Please retest this on the dev version and let me know.
Comment #2
greenbeans commentedStill happening with the dev version. Could it be a conflict with another module?
Comment #3
gordon commentedHave you triied this on a fresh install?
Usually this error occurs because the selected option is not a valid option in the list.
Comment #4
danielb commentedThis is an issue in Drupal forms api, and there is no real solution to it, since the problem is not in the code, or on the server. The problem has to do with your connection to the server and your session. If you try another computer you will find that it is fine. Some people say logging out, restarting the server, or running cron might fix this but it's not consistent and the general consensus is that this problem tends to fix itself mysteriously.
Comment #5
whitelancer commentedI am having this same issue. It seems to be that the forms API can't find a cached version of the file when you send the request to add it to your store.
The only thing I have found to bypass this is to treat the item as a product always, which is of course not really a solution at all.
I've tried different computers, different installs, and different versions of EC as well (RC2, RC3, and RC4). I'm running Drupal 6.10.
I haven't seen any other mentions of this, which is odd. I've tried using a freshly downloaded copy of Drupal with no modules aside from those requested by e-commerce. I don't get it.
This is the code in question, around line 194 in ec_product.admin.inc:
It's being triggered because form_get_cache is not finding the form. The $_POST['form_build_id'] does seem to be returning a form ID properly, so I'm not sure what the problem is. Is it possible to force the system to load the form, regardless of it's in cache or not? That is the issue here -- it isn't caching the form, so it can't find it.
Any ideas?
Comment #6
greenbeans commentedOh.... Is it possible that this bug is related to caching being disabled during development?
Comment #7
whitelancer commentedAh, no, I finally got it.
The form API cache is always on -- it's not a 'cache' per say, but more of a hidden copy of the form, so you can modify it during callback.
The problem is that I am not using the attachment module ... and that line clearly is trying to detect it.
If you change line 194 from:
if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form['#node']) || !isset($cached_form['attachments'])) {to:
if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form['#node'])) {It will work. Or I suppose you could enable the attachments mod.
Gordon, I assume that's in there for a reason -- could you clarify why you needed that attachment always set?
Comment #8
whitelancer commentedWell, maybe I spoke too soon.
It removes the error, but it doesn't seem to pick up the form entirely, and I just don't know why. =( (Missing extra plugins, like availability, and also the 'special' drop down).
It also doesn't seem to let me remove the item from the store, either. Hrmm.
Comment #9
gordon commentedThanks for pointing this out. I have fixed the initial issue of the validation error, and I also fixed the issue of the additional features not being loaded onto the page.