0

I am interested in adding a field to the 'Product' content type in Ubercart 3 / Drupal 7. I have read up on topics like field_create_field() and db_add_field() but I want my field to be stored as an additional column in the uc_products table in my database. In addition, I want my new field (qid) to be called whenever I call up the $node value. How would I go about doing this?

4
  • 2
    Altering a column in a table created by core or contrib is not a good idea unless you are very sure of what you are doing. For what purpose do you want this custom column?
    – beth
    Commented Mar 8, 2013 at 4:05
  • It's a quote field with a lot of important information about each individual product. I feel as though I have seen other contributed modules do this in the past. Commented Mar 8, 2013 at 12:23
  • 1
    Why is its place in the database important to you?
    – beth
    Commented Mar 8, 2013 at 15:28
  • Thats a good question. It's more of a housekeeping issue. I guess I should be relying on the node api to sort through my fields and load / store my added field of qid, eh? Edit: I guess if I don't like using the node / field system I shouldn't be using Drupal in the first place :-/ Commented Mar 8, 2013 at 16:06

1 Answer 1

1

This is no longer done in D7. You will want to use a proper field (which is stored in its own table and has many benefits over a simple column).

1
  • Thanks, this is what I have implemented and I now see the benefits of the field system. Commented Mar 12, 2013 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.