We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Relate entries that have the same id automatically

Development and Programming

jefinho's avatar
jefinho
26 posts
14 years ago
jefinho's avatar jefinho

Hi EE enthousiasts,

I need some advise on the following matter. I’m working on a gallery website with a lot of art by lots of artists. Visitors can find info about the artist, their work, and in may have the possibility to reserve a certain piece of art which they want to buy or rent.

The data is already available as xml. I have 3 xml files:

artists.xml artrwork.xml reservations.xml

I’ve found a very easy way to import those databases into EE through the DataGrab module. That works just perfectly. However, I can’t figure out a fast, easy solution to connect artists from artists.xml to specific artwork in artwork.xml

I thought about EE relationships or playa, but for as far I know, relationships have to be set manually. Since there are many artist and many different artworks this would take a long time to accomplish. Next to that, the XML-files will be updated daily.

I feel the solution lies into the unique number every artist has. This number can be found into all the XML-files.

Example Nodes in artist.xml

<row>
<artistNumber>15006</artistNumber>
<artistName>004</artistName>
etc. etc.
</row>

Example Nodes in artwork.xml

<row>
<artistNumber>15006</artistNumber>
<artWork>lovelyArt001</artWork>
</row>
<row>
<artistNumber>15006</artistNumber>
<artWork> lovelyArt002</artWork>
</row>
<row>
<artistNumber>15008</artistNumber>
<artWork> otherLovelyArtFromOtherArtist001</artWork>
</row>
etc. etc.

How can I connect a specific artist to another without doing this manually? I hope you understand my problem (not native English speaker) if there are any questions, feel free to ask them.

I hope anyone can help me out!

Thanks, Jef

[Mod Edit: Moved to the Development & Programming forum]

       
jefinho's avatar
jefinho
26 posts
14 years ago
jefinho's avatar jefinho

Let me try to put this more into EE language:

I have 2 channels: 1) Artists 2) Artworks

Both channels have one custom field containing a unique artist number. How can I automatically connect a particular ‘artist entry’ to the corresponding ‘artwork entry’?

Since there are a lot of artists, and artwork - changing daily - it would be too much work to do this manually. I thought about relationships (Playa plug-in) - but for as far I know, you have to set the relations manually in EE.

Any idea’s?

Thanks, Jef

       
Greg Salt's avatar
Greg Salt
3,988 posts
14 years ago
Greg Salt's avatar Greg Salt

Hi Jef,

There is no native way to set up relationships automatically like this. Since both sets of data (channels/XML) have the artist ID it might be possible to create a module or accessory that you could run after the import and set up the relationships in the exp_relationships DB table. Shall I move this thread to the Development & Programming forum so that you can get some community input into how this might be done?

Cheers

Greg

       
jefinho's avatar
jefinho
26 posts
14 years ago
jefinho's avatar jefinho

Hi Greg, Thanks for answering. Yes that would be great: Please move this thread to the Development & Programming forum. Lets hope I can find some answers there. Best regards, Jef

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.