rsanchez / json

Output ExpressionEngine data in JSON format.
http://devot-ee.com/add-ons/json/
100 stars 236 forks source link

Support for EE5 #67

Open paultz opened 4 years ago

paultz commented 4 years ago

Getting Error

Exception Caught SQLSTATE[42S22]: Column not found: 1054 Unknown column 'exp_channel_fields.group_id' in 'on clause': SELECT exp_channel_fields.*, exp_channels.channel_id FROM (exp_channel_fields) JOIN exp_channels ON exp_channel_fields.group_id = exp_channels.field_group WHERE exp_channels.site_id = 1 AND exp_channels.channel_name IN ('missions') ee/legacy/database/drivers/mysqli/mysqli_connection.php:117

Stack Trace: Please include when reporting this error

0 admin\ee\legacy\database\drivers\mysqli\mysqli_driver.php(112): CI_DB_mysqli_connection->query('SELECT `exp_cha...')

1 admin\ee\legacy\database\DB_driver.php(270): CI_DB_mysqli_driver->_execute('SELECT `exp_cha...')

2 admin\ee\legacy\database\DB_driver.php(180): CI_DB_driver->simple_query('SELECT `exp_cha...')

3 admin\ee\legacy\database\DB_active_rec.php(1138): CI_DB_driver->query('SELECT `exp_cha...')

4 admin\user\addons\json\pi.json.php(122): CI_DB_active_record->get()

5 admin\ee\legacy\libraries\Template.php(1847): Json->entries()

6 admin\ee\legacy\libraries\Template.php(1482): EE_Template->process_tags()

7 admin\ee\legacy\libraries\Template.php(578): EE_Template->tags()

8 admin\ee\legacy\libraries\Template.php(234): EE_Template->parse('{!-- ra:0000000...', false, 1, false)

9 admin\ee\legacy\libraries\Template.php(165): EE_Template->fetch_and_parse('', Array, false)

10 admin\ee\legacy\libraries\Core.php(661): EE_Template->run_template_engine('', '')

11 admin\ee\legacy\controllers\ee.php(63): EE_Core->generate_page()

12 [internal function]: EE->index()

13 admin\ee\EllisLab\ExpressionEngine\Core\Core.php(241): call_user_func_array(Array, Array)

14 admin\ee\EllisLab\ExpressionEngine\Core\Core.php(110): EllisLab\ExpressionEngine\Core\Core->runController(Array)

15 admin\ee\EllisLab\ExpressionEngine\Boot\boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))

16 index.php(173): require_once('D:\www\wamp64\w...')

16 index.php(173): require_once('D:\www\wamp64\w...')

Zignature commented 4 years ago

This is because this plugin was made for EE2. There have been database changes since then. This plugin queries database fields that aren't there anymore which results in the error message you recieved.

I got it working on EE4. You can find my solution here: Support for EE4.

There's a good chance it may work for EE5 too, which I'll be testing some time in the near future. Do some thorough testing on a develpment server before using this solution on a production/live server!

Zignature commented 4 years ago

Tested it on my local server at home on EE 5.3.2 and it works like a charm! 👍

Again, test it locally or on a development server before using it on a production/live server!

Zignature commented 3 years ago

Reworked the code:

paultz commented 3 years ago

Hi, i am testing JSON 2.0 on my localhost using EE 5.2.2, but can't seem to view/get custom fields data to work! My Code: {exp:json:entries channel="missions" custom_fields="yes" limit="1" fields="city|country"} Returns: [{"entry_id":309}] Only Entry Id without custom text fields specified ... city|country MEANWHILE Using: {exp:json:entries channel="missions" limit="1" } Returns: [{"title":"Loren Ipsum","url_title":"loren-ipsum","entry_id":309,"channel_id":11,"author_id":1,"status":"open","entry_date":1573119840000,"edit_date":null,"expiration_date":null}] without custom fields... any solution for this?

paultz commented 3 years ago

I am using JSON 2.0

Zignature commented 2 years ago

Reworked the code again because of problems with legacy custom fields: v2.5.0 JSON Output for EE4, EE5 & EE6