[development] E-Commerce formapi question.

Gordon Heydon gordon at heydon.com.au
Thu Feb 16 11:29:41 UTC 2006


Hi,

On Wed, 2006-02-15 at 23:45 -0700, Chad Phillips -- Apartment Lines
wrote:
> gordon:
> 
> are you working through node module for the multipart form in  
> cart.module?  if so that makes things trickier, but still workable.   

I have been mainly working thought the checkout api which is a very
difficult process. At this stage I have gotten it going, and it is
working so all the other modules can be completed.

> if you're not working through node module, then it might not be too  
> hard.  in my conversion work on project module, i did some work on a  

The cart doesn't rely on the cart module, and we have completed the work
with the product module which does need the the node system.

We actually removed the old wizard system and then managed to build a
much cleaner system for creating products.

> multi-part form, and what i found was that by setting a hidden field  
> with the stage of the form, i was able to examine it in $_POST and  
> keep track of what stage i was in.  you might want to check out  
> project module's issue submission form for that (pretty sure that was  
> the form i did that on).

chx actually just posted a method that would work for this. I am still
mulling this over and I am not sure if this will work, unless I call the
_validate() and _submit() myself.

If is not so much that you are extending an existing form, but building
a completely new one.

Basically what needs to happen is that the form for the current step is
build and drupal_get_form() is called. This will then call _validate()
and _submit() which will in turn call the correct checkout api's to
validate and save.

When it returns from drupal_get_form() it basically needs to tell the
checkout process that the form has failed (?) and to do something else.
In the case of the checkout process it will build the form for the next
step.

I have problems with this in that building a form and processing it is
an expensive process. If you have steps in the checkout process that
have no form then this could get very expensive.

Thanks for the input.
Gordon.



More information about the development mailing list