Put CCK field in 'Product information' on product edit form

Posts: 59
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

I like how the product information is laid out in the product edit form. My problem is I created a product class with a couple of extra fields that are closely related to the product, so I'd like to group them in that 'product information' field group. I've had a go at it using hooks, but I just can't seem to figure out how to get it in that field group, is it possible? I've had to just put it in my own field group below the product information called 'Extra information'.

Anyone a bit more experience with forms got any hints? I was able to remove my cck added field from it's original position, but I just couldn't get it to show up in the 'Product Information' area.

Cheers,
Steph

Posts: 1920
Joined: 08/07/2007
AdministratoreLiTe!

CCK can only add fields to the base level of the form, or to its own field groups. The product information is set by the product module, so CCK has no idea what it looks like.

It's possible to override the form's theme function so you can put the fields anywhere you like.

Posts: 59
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

Yeah, I know CCK through the browser doesn't know anything about it, but I'm trying to use hook_form to take that CCK field and move it to a new place. It just occured to me that maybe it would be better just to create the fields in the hook_form function. If I'm going to have to do work on it anyway, might as well just create it there.

Ok, I'll see if doing it that works.

Posts: 1013
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

I think you mean hook_form_alter, not hook_form.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 59
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

yeah, I had that typed, then I had a brain fart.

Posts: 59
Joined: 08/08/2007
Early adopter... addicted to alphas.Getting busy with the Ubercode.

Ok, I'm not sure if anyone else has any need for this information, but I thought I would share how I ended up doing it. I created my own custom module for the site, and did a hook_form_alter. Then I had to use hook_nodeapi to save all the information and retrieve it when necessary. Of course I also had to create a database to hold the information. Anyway, if anyone wanted to have a look I've attached the files instead of just copying and pasting the code here.

Cheers,
Steph

AttachmentSize
zoozeemod.zip2.43 KB