Be sure to checkout our newest add-on Reading Time Pro!

Compatibility updates:

  • Publisher is EE5 compatible, but it does not currently support the Fluid field (it's in the works).

Ticket: On a category page, the channel entries tag found nothing

Status Resolved
Add-on / Version Publisher 2.10.6
Severity
EE Version 5.1.2

Service Desk

Feb 25, 2019

Hi There,

We notice that when we are on a category page, the channel entries tag does not found anything.

We notice that in a query the channel_id was not given, instead the whole channel name

SELECT `ct`.*, `t`.*, `d`.*, `channel_title`, `c`.`channel_name`, `c`.`channel_url`, `c`.`comment_url`, `c`.`comment_moderate`, `c`.`channel_html_formatting`, `c`.`channel_allow_img_urls`, `c`.`channel_auto_link_urls`, `c`.`comment_system_enabled`, `username`, `m`.`email`, `m`.`screen_name`, `m`.`signature`, `m`.`sig_img_filename`, `m`.`sig_img_width`, `m`.`sig_img_height`, `m`.`avatar_filename`, `m`.`avatar_width`, `m`.`avatar_height`, `m`.`photo_filename`, `m`.`photo_width`, `m`.`photo_height`, `m`.`group_id`, `m`.`member_id`, `ct`.`url_title` AS default_url_title, `ct`.`status` AS status, `t`.`title` AS title, `t`.`site_id` AS entry_site_id
FROM (`exp_publisher_titles` AS t)
JOIN `exp_publisher_data` AS d ON `t`.`entry_id` = `d`.`entry_id` AND t.lang_id = d.lang_id AND t.status = d.status
JOIN `exp_channel_titles` AS ct ON `ct`.`entry_id` = `t`.`entry_id`
JOIN `exp_channels` AS c ON `c`.`channel_id` = `t`.`channel_id`
JOIN `exp_publisher_category_posts` AS cp ON `cp`.`entry_id` = `t`.`entry_id` AND cp.lang_id = t.lang_id AND cp.status = t.status AND cp.cat_id IN (1)
JOIN `exp_members` AS m ON `m`.`member_id` = `t`.`author_id`
WHERE `t`.`status` =  ‘open’
AND `t`.`lang_id` =  2
AND `t`.`entry_id` IN (338)
AND `t`.`channel_id` IN (‘options’)

however, when we run this in PHPMyAdmin, and remove the ‘AND `t`.`channel_id` IN (‘options’)’ we still found nothing. Checking the publisher tables for entry ‘338’, it seems the entry is there!

This page http://shop.maisondelabonnevie.nl.duniqueserver.nl/over-ons has a footer and this page (category) http://shop.maisondelabonnevie.nl.duniqueserver.nl/store/category/woonaccessoires/1 does not.

Any idea what is going on.

Best,
Rein

#1

BoldMinded (Brian)

Feb 25, 2019

Comment has been marked private.

#2

BoldMinded (Brian)

Feb 25, 2019

What is AND `t`.`channel_id` IN (‘options’)? Is Options a channel name?

#3

BoldMinded (Brian)

Feb 25, 2019

If that query isn’t finding anything it is probably b/c a JOIN is failing, most likely this one

JOIN `exp_publisher_category_posts` AS cp ON `cp`.`entry_id` = `t`.`entry_id` AND cp.lang_id = t.lang_id AND cp.status = t.status AND cp.cat_id IN (1)

Are you sure there is an entry in that table for the cat_id and entry_id?

#4

Service Desk

Feb 25, 2019

Hi Brain,

Trying your new build right now, but it seems not to fixed the issue.

‘Options’ is a channel, with just some default footer values. It has noting to do with the category. Its just static content.

>>Are you sure there is an entry in that table for the cat_id and entry_id?
the ‘option’ entry is not related to this category, as its just static content from a channel.

 

#5

BoldMinded (Brian)

Feb 25, 2019

>>Are you sure there is an entry in that table for the cat_id and entry_id?
the ‘option’ entry is not related to this category, as its just static content from a channel.

I realize that, but that isn’t answering my question. Does the entry_id have a row in the exp_publisher_category_posts table for the cat_id that you are expecting? It is probably failing on that JOIN if it does not match an assigned category post.

I asked about the “options” value b/c I’m wondering why it is even added to the channel_id` IN (‘options’) part of the query, where it should be an entry_id. Just an observation and something else I need to look into maybe fixing, but lets ignore that part for right now since the query still doesn’t work without that line.

 

 

#6

Service Desk

Feb 25, 2019

Does the entry_id have a row in the exp_publisher_category_posts table for the cat_id that you are expecting? It is probably failing on that JOIN if it does not match an assigned category post.

No, there is no record for that entry in that table.

I asked about the “options” value b/c I’m wondering why it is even added to the channel_id` IN (‘options’) part of the query, where it should be an entry_id. Just an observation and something else I need to look into maybe fixing, but lets ignore that part for right now since the query still doesn’t work without that line.

yeah same here, ok will ignore it for now.

#7

BoldMinded (Brian)

Feb 25, 2019

If there is no record in the category_posts table then that is most likely why it isn’t finding the entry. The entry needs to be assigned to the category first.

#8

Service Desk

Feb 25, 2019

I don`t get it… As you can see we have products that are related to the categories. We also have a channel “options” with some default data that is loaded in the footer. That entry is not related to a category and should not related though.

So why is it needed that this entry should related to a category. Is it possible to avoid this check?

#9

BoldMinded (Brian)

Feb 25, 2019

What does the entries tag look like that is calling this query?

#10

BoldMinded (Brian)

Feb 25, 2019

Can you do me a favor, since you provided FTP info. Create a test template with _only_ an exp:channel:entries tag in it and nothing else… just enough to re-create the query error. That way I can debug it easier (https://dev.to/litzinger/debugging-in-expressionengine-20d)

#11

Service Desk

Feb 26, 2019

Hi Brian,

I update the current template “cms/system/user/templates/shop/store.group/product-overview.html” for the page “http://shop.maisondelabonnevie.nl.duniqueserver.nl/store/category/woonaccessoires/1” to a single entries tag call.

Let me know.

#12

BoldMinded (Brian)

Feb 26, 2019

The FTP info you provided doesn’t work, so I can’t login to debug any code.

#13

Service Desk

Feb 26, 2019

Just update the url to an IP that is working.

#14

BoldMinded (Brian)

Feb 26, 2019

Ok, I think that was an easy fix. I changed line 755 of ext.publisher.php to

if ($channel->cat_request && ee()->TMPL->fetch_param('dynamic') !== 'no') {

As for the “options” appearing in the query, it’s because you have 4 options channels, which I’m assuming shouldn’t be the case. You need to cleanup your exp_channels table. https://d.pr/i/ABTO6a

#15

Service Desk

Feb 26, 2019

Yes, thats fixed the issue!

As for the “options” appearing in the query, it’s because you have 4 options channels, which I’m assuming shouldn’t be the case. You need to cleanup your exp_channels table. https://d.pr/i/ABTO6a

We are running the site in MSM, where we have on each site the same “options” channel.

#16

BoldMinded (Brian)

Feb 26, 2019

Ah, I see. I added site_id to a channel query to account for that. I made this change in your environment on line 1354 of EntryResult.php

$qry = $db->select('channel_id')->get_where('channels', [
                    'channel_name' => $channel,
                    'site_id' => $this->request->getSiteId()
                ]);
#17

Service Desk

Feb 28, 2019

Great, thanks for the fixes!

Login to reply

Contact

For add-on support, please use the Support section. General inquries and pre-sale questions can be sent to support@boldminded.com.