json icon indicating copy to clipboard operation
json copied to clipboard

Support for EE5

Open paultz opened this issue 5 years ago • 6 comments

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...')

paultz avatar Apr 16 '20 12:04 paultz

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 avatar May 07 '20 18:05 Zignature

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 avatar May 07 '20 23:05 Zignature

Reworked the code:

Zignature avatar Jan 18 '21 13:01 Zignature

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 avatar Apr 22 '21 18:04 paultz

I am using JSON 2.0

paultz avatar Apr 22 '21 18:04 paultz

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

Zignature avatar Nov 04 '21 15:11 Zignature