4

Is there a way by which I can programmatically update a select options list of LineItems?

I am trying to create Line Items from data provided by site administrators.

If you refer to http://178.79.128.76/coronet/node/78, you will see 4 types of data: The Viewing date, The Viewing options, Add to cart button and Show Times.

The Show Times data is unique for each product. Each entry consists of a date and one or more time(s).

The Viewing Options is a line item and I am trying to populate it with data extracted from the Show Times field in the following format:

  • Viewing Date 1 + ShowTime 1
  • Viewing Date 1 + ShowTime 2
  • Viewing Date 2 + ShowTime 1

Just for demonstrating my objective, I populated the example data above in my Viewing Options Line Item using hook_form_alter - they don't actually work when you select and attempt to add the product to.

halfer
  • 19,824
  • 17
  • 99
  • 186
sisko
  • 9,604
  • 20
  • 67
  • 139

1 Answers1

1

You can have your tables set up with LineItem table, a ViewDate table and a ShowTimes table. That will allow you to have a ViewDate collection with a foreign key to the LineItem, and a ShowTimes collection with a foreign key to the ViewDate.

nocturns2
  • 663
  • 10
  • 17
  • Care to ellaborate on your answer? I don't know what you mean by a LineItem table and the logic behind your suggestion – sisko Jun 06 '13 at 00:04
  • That's fair. I used the term 'LineItem' table to refer to the underlying product table and the relationship to the other table entities that contained collections necessary to compile the data to use for displaying selection options and eventually in the carts line item. I suggest that the database structure be created in a way that the queries can be written against and produce the desired data. – nocturns2 Jun 06 '13 at 21:19
  • Also, by have a collection of the items (i.e., ShowTimes), each parent item (i.e., ViewDate), can have as many child items (i.e., ShowTimes) as needed. – nocturns2 Jun 06 '13 at 21:33