65 Posts
Wissner
4 years ago
3
Topic

hi,

I created a form with which Events are saved and displayed.
Now some events will be repeated at different dates.

My customer would  like to enter these events only once, and enter all dates for this Event in a fieldx Field or by using a groupx group.

If I use  this i will get one content item with multiple Dates.
Is it also possible to get  multiple content items with one date each? So that, if such an event has 3 different dates, it will be displayed 3 times in my search List?

Trank you

Wolfgang

Get a Book for SEBLOD
1283 Posts
Bucklash
4 years ago
0
Level 1

my way would be to create a map of date and event.

Have a free content type called event_date_map

in afterstore of event item loop through dates in fieldx, create a date item if not already created for that date and then map event id with date id.

In searches use search join to link up mapped data

I have a plugin that does this if interested.

otherwise there is probably an easier way :)

also, does date work with fieldx?

4 years ago
1
Level 1

Hello Wolfgang,

and thanks Bucklash.  

I would say, no need to create an other content type for that.

In your Event Content Type, add your fieldX (Date) with no storage (with restriction Workflow => only in Add mode).

Then in the afterstore event, create all events that you have in your fieldX by using the JCcContent

The Only think that will change between different event is the date so you can:  

  • Load the first Event created with JCckContent
    $content = JCckContent::getInstance( $config['pk'] );
    	

  • Get all data: 
    $data =  $content->getData();
    	

  • Now, in a loop, change the date in
    $data['my_date'] = $new_date;
    	

  • Store:
    $content->create( 'content_typee_name', $data );
    	


Regards.

65 Posts
Wissner
4 years ago
0
Level 2

Thank you Lionel and Bucklash,

sorry that I did not respond to your help. I am under great pressure in another project, for the next 4 weeks.

I am happy about your tips and I will try them as soon as my schedule will allow to spare the time for it.

Merry christmas and a Happy New Year

Wolfgang

Get a VIP membership