Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: SQL Error “Exception Caught” when tying to switch language
Status | Resolved |
Add-on / Version | Publisher 2.6.5 |
Severity | |
EE Version | 3.5.11 |
pixiwooh
Oct 11, 2017
Hi Brian,
I hope the EE conference is going well.
Unfortunately I’m back with another issue. I got SQL error when I try to switch language on my entries.
I used this code :
[exp:publisher:languages entry_id="{embed:id_de_lentree}"]
<div ><a href="{switch_language_url}" title="{long_name}">{short_name}</a></div>
[/exp:publisher:languages]
and I got this :
Exception Caught
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY c.group_id, c.parent_id, c.cat_order' at line 7:
SELECT c.cat_name, c.cat_url_title, c.cat_id, c.cat_image, c.cat_description, c.parent_id, p.cat_id, p.entry_id, c.group_id , cg.field_html_formatting, fd.* FROM (exp_categories AS c, exp_category_posts AS p) LEFT JOIN exp_category_field_data AS fd ON fd.cat_id = c.cat_id LEFT JOIN exp_category_groups AS cg ON cg.group_id = c.group_id WHERE c.cat_id = p.cat_id AND p.entry_id IN ) ORDER BY c.group_id, c.parent_id, c.cat_order
ee/legacy/database/drivers/mysqli/mysqli_connection.php:122
Thanks in advance.
BoldMinded (Brian)
My guess is that {embed:id_de_lentree} is not being parsed. Put it outside the tag like this to see what the value is.
BoldMinded (Brian)
Either its not parsed, or the value is blank.
pixi
no I already tried it before opening the ticket and the embed variable is well being parsed…
BoldMinded (Brian)
And its a valid entry_id?
pixi
of course 😉 It is the real id of this entry.
BoldMinded (Brian)
Are you positive that error comes from the publisher:languages tag? Did you strip out all other code from a template except for that tag and were able to produce that sql error? I added just this to a template in my local dev environment and it works fine.
Can you login to demo.boldminded.com and try to replicate this issue please? Thanks.
pixi
Comment has been marked private.
BoldMinded (Brian)
There are some additional parameters for the entries tag but they are not required http://docs.boldminded.com/publisher/template-tags
pixi
Hi Brian,
does it possible the issue has to do with embeded templates that have {exp:channel:entries} with dynamic=”no” parameter ?
BoldMinded (Brian)
I don’t see how that would cause an SQL error. The templates are just a facade for all the deeper functionality, and any number of things could be triggered or changed based on the template tags.
BoldMinded (Brian)
Comment has been marked private.
pixi
Hi Brian,
I tried this build but it didn’t change anything.
I think the issue is really about the dynamic=”no” parameter in an embed template. I displayed a exp:channel loop in a blank template. When I add
there is no problem, I can swith between the languages of the entry.
But… as soon as I add
with the exp:publisher:languages tag in it and a exp:channel loop with dynamic=”no”, it gives the SQL error. If I only delete the dynamic=”no” parameter or just set it at “yes” there is no error.
Obviously setting it to YES is not an option for me as I need the embeded entries not to be affected by the URL.
BoldMinded (Brian)
That sounds like dynamic=”no” means its not finding an entry, thus the entry_id is not getting to the languages tag. Did you ever try to replicate the issue on demo.boldminded.com?
pixi
I tried to replicate the issue on demo site but as soon as I created a new template group I always get Exception Caught No such method filter. Manager.php:143
BoldMinded (Brian)
I’m unable to replicate. Can you please include the entire error message? Are you trying to create a new template group or just a template?
BoldMinded (Brian)
nevermind, I see it now. For now just use the test/index template.
BoldMinded (Brian)
Ugh. Its not even loading template groups. I’ll see if I can figure this out.
pixi
To respond to your message number #13 :
In fact the languages tag is not in the exp:channel tag that has the dynamic=”no” parameter but is only in the same embeded template. To schematize I have :
My entry’s template with :
and the embed template with :
pixi
Hi Brian,
have you some good news for me? :D
BoldMinded (Brian)
I put your template code on the demo site, and it does not create an error: http://demo.boldminded.com/en/test
BoldMinded (Brian)
Also, there should be a full stack trace error with that query error you originally reported. Can you share the stack trace please?
pixi
But as I see, in the demo website, you forgot to put these lines in the embed template, I think : {exp:channel:entries channel=”the_name_of_one_of_your_channels” dynamic=”no” limit=”1”} {the_custom_field_you_want} {/exp:channel:entries}
Yes, sure! There it is the stack trace:
0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(137): CI_DB_mysqli_connection->query(‘SELECT c.cat_na…’)
1 ee/legacy/database/DB_driver.php(297): CI_DB_mysqli_driver->_execute(‘SELECT c.cat_na…’)
2 ee/legacy/database/DB_driver.php(203): CI_DB_driver->simple_query(‘SELECT c.cat_na…’)
3 ee/EllisLab/Addons/channel/mod.channel.php(467): CI_DB_driver->query(‘SELECT c.cat_na…’)
4 user/addons/publisher/ext.publisher.php(617): Channel->fetch_categories()
5 ee/legacy/libraries/Extensions.php(243): Publisher_ext->channel_entries_query_result(Object(Channel), Array)
6 ee/legacy/libraries/Extensions.php(138): EE_Extensions->call_class(‘Publisher_ext’, ‘channel_entries…’, Array, Array)
7 ee/EllisLab/Addons/channel/mod.channel.php(2397): EE_Extensions->call(‘channel_entries…’, Object(Channel), Array)
8 ee/EllisLab/Addons/channel/mod.channel.php(297): Channel->parse_channel_entries()
9 ee/legacy/libraries/Template.php(1712): Channel->entries()
10 ee/legacy/libraries/Template.php(1349): EE_Template->process_tags()
11 ee/legacy/libraries/Template.php(553): EE_Template->tags()
12 ee/legacy/libraries/Template.php(239): EE_Template->parse(‘{!– ra:0000000…’, true, 1, false)
13 ee/legacy/libraries/Template.php(996): EE_Template->fetch_and_parse(‘includes’, ‘_utiles’, true, 1)
14 ee/legacy/libraries/Template.php(601): EE_Template->process_sub_templates(‘{!– ra:0000000…’)
15 ee/legacy/libraries/Template.php(239): EE_Template->parse(‘{!– ra:0000000…’, false, 1, false)
16 ee/legacy/libraries/Template.php(170): EE_Template->fetch_and_parse(‘assurances’, Array, false)
17 ee/legacy/libraries/Core.php(681): EE_Template->run_template_engine(‘assurances’, ‘index_debug2’)
18 ee/legacy/controllers/ee.php(68): EE_Core->generate_page()
19 [internal function]: EE->index(‘index_debug2’, ‘eigenschap’)
20 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
21 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
22 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
23 index.php(175): require_once(‘…’)
23 index.php(175): require_once(‘…’)
BoldMinded (Brian)
The query isn’t related to the language switcher at all, its failing trying to do a categories query. Have you tried this on multiple pages or is it only on this one page that it fails?
pixi
Yes it is the same on every pages.
But on the initial lanuage viewed there is no problem… it only when I try to switch. I am losing all my hair over that.
BoldMinded (Brian)
Since I can’t replicate this locally the only way for me to debug and fix it is if you can re-create this on a development server and provide CP and FTP access for me. Create a template with only the code necessary to replicate the problem, no superfluous styles or template tags, just the bare minimum, and point me to the URL to go that causes the issue. You can edit this ticket to add the CP and FTP info securely. When this ticket is closed that info will be deleted from the database.
pixi
Hi Brian,
Thank you for your proposition. I tried to edit the ticket to add the CP and FTP access but got this error :
BoldMinded (Brian)
Try it again.
pixi
I fill in the infos.
pixi
Comment has been marked private.
BoldMinded (Brian)
I got the info and can login, but I need access to EE’s files, not just Publisher since the error is happening in an EE file.
pixi
Oh sorry, I just corrected.
BoldMinded (Brian)
What is “eigenschap”? Is that an entry? If so what is the ID?
pixi
“eigenschap” is the dutch verion of the entry “biens”.
BoldMinded (Brian)
I don’t have permission to access the Publisher module. Can you make me super admin on that site?
BoldMinded (Brian)
What template is that page using?
BoldMinded (Brian)
I fixed the error, but I’m not 100% sure if the page is rendering content as you expect it to b/c I don’t know what it should render. Does it look correct now?
pixi
Sorry for the delay.
Yeah the error is gone! Thank you very much!! What was the cause of it? One thing left weird : the {path=’template_group/template’} tag isn’t parsed properly on the translated version of the entry. (it is replaced by {base_url}/template_group/template ). In the doc it is mentionned that path tag is supported so maybe it is a bug? I put a link (named “lien”) in the template to let you see by yourself.
I made you Super Admin, if you need.
BoldMinded (Brian)
The cause was it was trying to do a categories query when it shouldn’t have, so I just added a check to prevent it from querying. That fix will be in the next release of Publisher. Do you need a new build or can you grab the files from your dev server?
The {path} parsing sounds like it should be a separate ticket 😊
BoldMinded (Brian)
Comment has been marked private.
BoldMinded (Brian)
Comment has been marked private.
pixi
The path variable parsing is ok now! Cool! Thank you for this build.
Can I ask you to erase the $config[‘base_path’] from the ticket on #39 please? Or mark the post as private? Thanks
BoldMinded (Brian)
I made it private. Glad everything is working 😊 I’m going to close this ticket now.
pixi
Sorry, I’m back (I can open a new ticket for this if you want?).
In fact the parsing of path variable doens’t work perfectly, sorry. I thought it did. The language segment is missing in it (only when you’re viewing the other language version of entry).
On the examle page I sent you, on FR version, the path=’template_group/template’ is parsed as ……/fr/template_group/template and when I switch on the NL version, the path=’template_group/template’ is parsed as ……/template_group/template.
BoldMinded (Brian)
Yeah, lets do a new ticket for this if you don’t mind. Thanks.