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

Fetch Channel Item by entry_id using the API

Development and Programming

Sam Bondareff's avatar
Sam Bondareff
23 posts
15 years ago
Sam Bondareff's avatar Sam Bondareff

Is this possible using the API? There is no method in the Api_channel_entries to do it.

What I am trying to do is to get an associative array with the fields and the data for a chanel entry with a certain entry_id.

Thanks

Sambo

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
15 years ago
John Henry Donovan's avatar John Henry Donovan

Sambo,

I am moving this thread to the Development and Programming forum for now as more appropriate there. It may help people wishing to reply if you gave a small bit of background to what you intend to do with the data or where you are trying to calling it from

       
Sam Bondareff's avatar
Sam Bondareff
23 posts
15 years ago
Sam Bondareff's avatar Sam Bondareff

Hi ,

Thanks John. I am writing an extension. What I am trying to do is a lookup from a field to another channel.

So in this channel I have say tour names and their prices. In other channel I am storing the tour type.

What I want to do is when commiting the second channel entry I am performing a lookup to the first channel to get the price adn then do some calculations with it.

Hope this makes sense.

       
evilsee's avatar
evilsee
4 posts
15 years ago
evilsee's avatar evilsee

Have a look at the channel_entries_model, although limited it might help with what your doing.

$entry_data = $this->EE->channel_entries_model->get_entry( $entry_id,$channel_id);

you have to pass a channel_id to get all the data for a entry. which you can get using the same call, but without the second parameter, like this

$query = $this->EE->channel_entries_model->get_entry( $entry_id);
$channel_id =  $query->row('channel_id');

I wonder if there is a better way to do this???

       

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.