0

I have an event management site I am trying to build (which is using the COD framework) but I am trying to work my way around a functionality setup.

The basic principle is that an Event will be created, this will be published to the main page of my site and invite delegates to submit an Abstract for the Event in order to present their topic. The Abstracts will be scored internally and the selected ones will be marked to become actual presentations. The Event information will contain a Programme page, which is just a list of the presentations. Once the event has taken place, they want to be able to sell the video of the presentation.

What I wanted to achieve is outlined in steps:

  • Event is setup by admin, but has no programme information
  • Users submit an abstract (which has an entity reference to that Event)
  • When an abstract is chosen to be presented, the important information is copied into an 'empty' product, ie: Status is set to unavailable and price to 0, but the product display for that product becomes the Presentation
  • Programme is a list of all Presentations (product displays) for that Event
  • After the Event has finished, a price and an asset are added to the product, which is then set to available, so that it shows up in the shop

This process is already in place in my site as it is, but the client is wondering if they can effectively remove another step from this process. They are looking to automate the process so that they don't have to copy information from the Abstract, into the empty Product

My approach to this was to add a 'selected' checkbox to the Abstract content type, then create a rule which would then check every time the content was saved to see if this checkbox is set to 'approved', *then create a new product from the information already within the Abstract

My problem is I am getting stuck when it comes to where my * is, I don't even know if it's possible to copy all of the information from one content type into a new one of another. Can this be done, or am I going to have to find another way around or custom code it etc?

Kind regards

1
  • Are you looking for a module to do that? Or for custom code you'll put in your module?
    – Mołot
    Commented Jun 24, 2013 at 14:20

1 Answer 1

0

It is possible all right. In your custom module use node_load and node_save:

$abstract = node_load($abstract_id);
$event = new stdClass();
$event->type = 'event';
node_object_prepare($event);

$event->title = $abstract->title; // and so on

node_save($event);

$event_id = $event->nid;

Just wrap it in a function and expose it to the framework you are using - most of them provide good examples in their documentation.

2
  • This sounds good, after having a think I might re-address the method behind how I would make this work. Instead of automating it using rules, I might add a button on my content which will effectively pre-populate the new content with the information from the previous page filled in, I assume the code to create a new node from existing information would follow the same process? Commented Jun 25, 2013 at 11:52
  • @AndrewMorris If I understand what you mean, yes. For a button - I would make it create new node using code from my answer and then take $event_id, and redirect user to /node/$event_id/edit. But there was questions about prepopulating add form here, too, and reading old data would look the same, only difference in where you'll put it.
    – Mołot
    Commented Jun 25, 2013 at 12:01

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.