LISE exclude_category not working as I would expect it to

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

LISE exclude_category not working as I would expect it to

Post by paulbaker »

Client wants customer quotes to appear on a page.

They want their favourite single quote to appear at the top, followed by all the rest in a random order.

I fire up LISE.

Add all the quotes.

Add a category alias "show-at-top". When adding this category I chose sub type "Checkbox Group".

I edit their favourite quote and put it in the "show-at-top" category. No other categories added.

My aim is to call the show-at-top category, and then another call with exclude_category="show-at-top".

So in my page template I put:

Code: Select all

{LISEQuotes action="default" category="show-at-top"}
I expect to see the one quote in that category. It works OK.

I change the page template call to:

Code: Select all

{LISEQuotes action="default" exclude_category="show-at-top"}
I expect to see all quotes EXCEPT the one in that category. However, no quotes show up. In debug mode I see the relevant SQL is:

Code: Select all

SELECT A.* FROM cms_module_lisequotes_item A 
          LEFT JOIN cms_module_lisequotes_item_categories IB 
          ON A.item_id = IB.item_id 
          LEFT JOIN cms_module_lisequotes_category B 
          ON IB.category_id = B.category_id  WHERE A.active = 1 AND NOT ( B.category_alias = 'show-at-top') AND (start_time IS NULL OR TIMESTAMPDIFF(DAY, CURDATE(), start_time) <= 0) AND (end_time IS NULL OR TIMESTAMPDIFF(DAY, end_time, CURDATE()) <= 0) GROUP BY A.item_id  ORDER BY A.position ASC
I guess the exclude_category SQL needs altering for a category structure such as this?

Note I have since achieved my goal by introducing a second category "general", putting all the other quotes in that, and calling this in the page template:

Code: Select all

{LISEQuotes action="default" category="show-at-top"}  <-- shows the first quote
{LISEQuotes action="default" category="general" orderby="rand"}  <-- shows all the rest of them
----------------------------------------------
Cms Version: 2.1.5
Installed Modules:
AdminSearch: 1.0.2
CGExtensions: 1.53.13
CGSharedContent: 1.0.1
CMSContentManager: 1.1.1
DesignManager: 1.1.1
FileManager: 1.5.2
LISE: 1.2.1.1
LISEQuotes: 1.2.1.1
MicroTiny: 2.0.3
ModuleManager: 2.0.4
Navigator: 1.0.3
News: 2.50.5
Search: 1.50.2

Config Information:
php_memory_limit:
max_upload_size: 50000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Europe/London
permissive_smarty: false

Php Information:
phpversion: 5.6.24
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 22519
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 120
register_globals: Off (False)
output_buffering: 4096
disable_functions:
open_basedir:
test_remote_url: Success
file_uploads: On (True)
post_max_size: 50M
upload_max_filesize: 50M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On

Performance Information:
allow_browser_cache: Off (False)
browser_cache_expiry: 60
php_opcache: Off (False)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
smarty_cache_udt: Off (False)
auto_clear_cache_age: On (True)
Server Information:
Server Software: Apache
Server Api: cgi-fcgi
Server Os: Linux 2.6.18-471.3.1.el5.lve0.8.72 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 5.6.30
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Permission Information:
tmp: /home/cthuk/public_html/bhs/tmp (0755)
tmp_cache: /home/cthuk/public_html/bhs/tmp/cache (0755)
templates_c: /home/cthuk/public_html/bhs/tmp/templates_c (0755)
modules: /home/cthuk/public_html/bhs/modules (0755)
uploads: /home/cthuk/public_html/bhs/uploads (0755)
File Creation Mask (umask): /home/cthuk/public_html/bhs/tmp/cache (0755)
config_file: 0444
----------------------------------------------
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: LISE exclude_category not working as I would expect it t

Post by velden »

I think it should be something like

Code: Select all

... WHERE A.active = 1 AND (B.category_alias IS NULL OR B.category_alias <> 'show-at-top') AND ...
Of course your work around is working but indeed for 'expected behavior' I think allowing for null might be better.

Obviously only the module developer should change this behavior and it's up to his discretion to do so (or not).
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: LISE exclude_category not working as I would expect it t

Post by Jo Morg »

Fixed in SVN for next release, thanks.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “Modules/Add-Ons”