Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6657895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:49:38+00:00 2026-05-26T01:49:38+00:00

I am working with the commerce module to create an online store. I am

  • 0

I am working with the commerce module to create an online store. I am modifying the products .install file to create a content type (as I have been told this is required) and as part of that content type, I need to create lots of fields. The list will be around 50-60 different pieces of information.

Ideally I would like to store these in a single table with the productID at the beginning and all the other information along, but this doesn’t seem to be the case; all the fields are stored in different tables.

I noticed that the “Address” module that is also used with commerce creates a field-type that has about 15 different values all stored in the same box. How is this possible? I noticed that if I set the cardinality up to 5 for example, it creates different rows. I just want a table with the following:

ID – value1 – value2 – value3 etc etc.

I also don’t need any modules/extensions as this all needs to be written in the files. I also don’t think that changing to the mongoDB ( I think ) is an option, so what are my options in this situation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:49:38+00:00Added an answer on May 26, 2026 at 1:49 am

    That’s not how the Drupal field system works I’m afraid, one field == one table (well actually 2 tables if you include the revision table for each field).

    The Address module uses hook_field_schema() to define several columns for that particular field (have a look in address.install and you’ll see what I mean).

    So if you want to put everything in one table you’ll simply have to define your own field type (see the examples module, specifically field_example for help with that).

    Bear in mind though that the number of columns you define in hook_field_schema() will be static once the module is installed, and the only way you’re going to be able to increase/decrease it is with an _update hook for your custom module.

    Also, if you’re hacking at files that are included in the Commerce module…stop!: Commerce is still very much in it’s infancy and you will likely have to update it soon…once you’ve done that your code changes will be gone and there’s a good chance your site will be in an inconsistent state.

    The whole point to Drupal is that everything is hooked/farmed out so that it can be altered by other parts of the system. There’s nothing you can change in product.install that can’t be done by implementing a Drupal hook in another module.

    If you’re unsure, post another question detailing what you’re trying to accomplish by directly editing a contrib module file and one of the Drupal gurus on SO will point you in the right direction 🙂

    EDIT

    Just to say I’ve been working with Ubercart in Drupal 7 for quite some time now and find it a very, very good solution (a lot of Commerce contributed modules are still in dev/alpha/beta; this is less so for Ubercart contributed modules). It might be worth a look.

    Some more info

    I think you’ve basically got two options here but either way you’ll need to create a custom module (excellent set of instructions here).

    Option 1: Create a custom field

    If you’re a Drupal coding beginner I’d suggest this is probably the easiest way to accomplish what you want, but it’s still not totally straight forward. Grab the field_example module from the Drupal Examples module link above and have a look in the .install file, specifically the field_example_field_schema() function. That defines the columns that will be in the table for that field. Then have a look in field_example.module…pretty much every function that’s commented with Implements hook_x is one that you’re going to want to copy into your module and tweak for your own needs.

    I think this will be easier because Drupal will handle the table/form field creation for you
    so you don’t have to mess with the database, schema or form APIs.

    Option 2: Create a custom module

    This option involves implementing your own table (like you suggest in your comment) where the primary key would be the entity ID of the product and would also contain all of your custom columns. (See the Schema API documentation for help with this).

    Then you’d implement hook_form_alter() to add the form fields necessary for a user to input the data, and then implement hook_node_insert() and hook_node_update() to persist this data to your database table. It’s quite hard to go into any more detail without actually writing code and it’s quite a bit of code!

    Hope that helps, sorry I can’t be any more specific but it’s not easy without knowing all the ins and outs of the situation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on creating a e-commerce store using Magento and I think
I have been working on a new template for a commerce site running zen
I'm trying to create a gift wrapping module for Drupal commerce. I have created
I'm working at some e-commerce website where I have a bunch of filters for
I'm working through some touches on an e-commerce site for someone and have run
I have my log file working, but I get extraneous info on each line
I'm learning C# and working on my first ASP.Net e-commerce website. I have the
I have been tasked with developing a new retail e-commerce storefront for my current
I'm working on an e-commerce type web application and need to somehow handle calculation
I am working on an e-commerce website. There is an array products in javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.