6 replies [Last post]
ssherriff's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 215
Was this information Helpful?

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

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Put CCK field in 'Product information' on product edit form

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.

ssherriff's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 215
Re: Re: Put CCK field in 'Product information' on product edit f

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.

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Put CCK field in 'Product information' on product ed

I think you mean hook_form_alter, not hook_form.

--
Help directly fund development: Donate via PayPal!

ssherriff's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 215
Re: Re: Re: Re: Put CCK field in 'Product information' on produc

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

ssherriff's picture
Offline
Early adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/08/2007
Juice: 215
Re: Put CCK field in 'Product information' on product edit form

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.zip 2.43 KB
cybertoast's picture
Offline
Joined: 12/25/2008
Juice: 33
Re: Re: Put CCK field in 'Product information' on product edit f

Very useful. I've been working on doing something similar, and wish I had found your code a week back Smiling Thanks for sharing.