<![CDATA[ Taxonomies: getPagesbyTerm - My Forums]]> https://forums.modx.com/thread/?thread=97545 <![CDATA[Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-527472 However i run into some problems.

The backend stuff seems to work ok. So i am able to create some taxonomies and some terms.
However if i try to load [[!getPagesByTerm]] nothing "happens" and the following (several duplicate) lines appear in the log:

[2015-06-26 00:28:17] (ERROR @ /index.php) No class specified for loadClass


Who has encountered this and solved it? Or does anyone have a clue where to look?

PS: None of the scripts seem to work.]]>
mintnl Jun 25, 2015, 05:46 PM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-527472
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-548914 Quote from: mintnl at Apr 04, 2016, 03:11 AM
Thought I have to give Taxonomies another trie on a new project.
Thus far i got the snippet to work. Maybe there was some hick-up in php-versions or something a while ago as it seems to for for other people.

Ha to hack the extra a bit. At first i implemented the pull changes requested by PeteVox here: https://github.com/craftsmancoding/taxonomies/pulls
After that i checked the var_dump of the sql as proposed by Mark Hamstra somewhere on one of the Taxonomy-topics, there i could see something went wrong with the SQL statement.

After changing line 45
$taxonomy_id = $modx->getOption('taxonomy_id',$scriptProperties, null);

to
$taxonomy_id = $modx->getOption('taxonomy_id',$scriptProperties,'');


and line 49 + 50
$and_where = (is_null($taxonomy_id)) ? '' : 'AND doc.parent = ' . $taxonomy_id;
 $page_id = (is_null($page_id)) ? $modx->resource->get('id') : $page_id;

to
$and_where = (empty($taxonomy_id)) ? '' : 'AND doc.parent = ' . $taxonomy_id;
$page_id = (empty($page_id)) ? $modx->resource->get('id') : $page_id;


i got the thing working...

Maybe it helps someone. However, this extra seems quite dead. It's a shame.

Hi,

I got the getPageTerms working following your solution THANK YOU. But the getPagesByTerm snippet is not working. What changes did you pull because that is the step I could not do.]]>
jsheke Feb 24, 2017, 08:25 AM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-548914
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-540178 Quote from: mintnl at Apr 04, 2016, 08:11 AM


After changing line 45
$taxonomy_id = $modx->getOption('taxonomy_id',$scriptProperties, null);


Maybe it helps someone. However, this extra seems quite dead. It's a shame.

I recently used this extra instead of Tagger because it just makes more sense in the context of taxonomies than Tagger, and offers much more flexibility. I too ran into the error you are speaking of, and I think it has more to do with MODx recently making some changes to their system and the extra not getting updated to compensate. Here is the complete issue that I posted on Github about this problem:

Another issue I'm coming across, specifically in the Snippet "getPagesByTerm" is that the $modx->getOption method only returns the default value if the fourth attribute $skipEmpty is set to true. From the official documentation:
    $default: the value to return when the key was not found.
    $skipEmpty: when set to true, the $default will also be returned if the $key's value is an empty string. Added in xPDO 2.2.1 / MODX 2.2.0-rc2.

This is causing the SQL queries to error since the options values are empty. I'm not sure why the developers at MODx decided to change this feature, but it is a freakin’ time-bomb. It should have been "$doNotSkipEmpty" for backwards compatibility reasons.

Anyway, please visit the github page and look at the recent issues for a couple posts I made that might help with some of these issues.]]>
dan971 Apr 05, 2016, 02:27 PM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-540178
<![CDATA[Re: Taxonomies: getPagesbyTerm (Best Answer)]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-540133 Thus far i got the snippet to work. Maybe there was some hick-up in php-versions or something a while ago as it seems to for for other people.

Ha to hack the extra a bit. At first i implemented the pull changes requested by PeteVox here: https://github.com/craftsmancoding/taxonomies/pulls
After that i checked the var_dump of the sql as proposed by Mark Hamstra somewhere on one of the Taxonomy-topics, there i could see something went wrong with the SQL statement.

After changing line 45
$taxonomy_id = $modx->getOption('taxonomy_id',$scriptProperties, null);

to
$taxonomy_id = $modx->getOption('taxonomy_id',$scriptProperties,'');


and line 49 + 50
$and_where = (is_null($taxonomy_id)) ? '' : 'AND doc.parent = ' . $taxonomy_id;
 $page_id = (is_null($page_id)) ? $modx->resource->get('id') : $page_id;

to
$and_where = (empty($taxonomy_id)) ? '' : 'AND doc.parent = ' . $taxonomy_id;
$page_id = (empty($page_id)) ? $modx->resource->get('id') : $page_id;


i got the thing working...

Maybe it helps someone. However, this extra seems quite dead. It's a shame.]]>
mintnl Apr 04, 2016, 03:11 AM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-540133
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-535218
Go to getPagesByTerm snippet, and go to Properties tab. Check if this default properties are set. For me they were not:
classname: PageTerm
graph: {"Page":{}}
sort: pagetitle
dir: ASC


there is some problem with the installer i suppose..
]]>
morelmm Dec 03, 2015, 02:54 AM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-535218
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-534088 davidsmith Nov 06, 2015, 10:29 AM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-534088 <![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528410 Quote from: mintnl at Jul 15, 2015, 05:50 PM
Hi Wpicotte,

sorry, but no. Tried to reach the creator of the extra but he didnt have the time to investigate further.
So i switched to the Tagger extra.

http://modx.com/extras/package/tagger
https://rtfm.modx.com/extras/revo/tagger

Yeah, that's where I wound up, too. What a let-down. ModX needs this badly.]]>
wpicotte Jul 16, 2015, 07:24 PM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528410
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528329
sorry, but no. Tried to reach the creator of the extra but he didnt have the time to investigate further.
So i switched to the Tagger extra.

http://modx.com/extras/package/tagger
https://rtfm.modx.com/extras/revo/tagger

]]>
mintnl Jul 15, 2015, 12:50 PM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528329
<![CDATA[Re: Taxonomies: getPagesbyTerm]]> https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528286 Quote from: mintnl at Jun 25, 2015, 10:46 PM
I have succesfully (?) installed the Taxonomies extra. Saw the screencast on youtube and the principle appeals to me very much.
However i run into some problems.

Did you ever resolve this? I'm in the same boat with getPagesbyTerm, and have the following three errors from the error log:

[2015-07-14 13:55:42] (ERROR @ /wpp-redev/index.php) `[[+Page.id]]` is not a valid integer and may not be passed to makeUrl()
[2015-07-14 13:55:42] (ERROR @ /wpp-redev/index.php) No class specified for loadClass
[2015-07-14 13:55:42] (ERROR @ /wpp-redev/index.php) Could not load class 


When including the default class name, this error is produced:

[2015-07-14 14:02:08] (ERROR @ /wpp-redev/index.php) Error 42000 executing query: SELECT `PageTerm`.`id` AS `PageTerm_id`, `PageTerm`.`page_id` AS `PageTerm_page_id`, `PageTerm`.`term_id` AS `PageTerm_term_id`, `PageTerm`.`seq` AS `PageTerm_seq` FROM `tax_page_terms` AS `PageTerm` WHERE `PageTerm`.`term_id` = ? GROUP BY page_id ORDER BY  LIMIT 6  - Array
(
    [0] => 42000
    [1] => 1064
    [2] => 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 'LIMIT 6' at line 1
)


This is on ModX 2.3, mysql 5.5.42, php5.6.7.
]]>
wpicotte Jul 14, 2015, 04:06 PM https://forums.modx.com/thread/97545/taxonomies-getpagesbyterm#dis-post-528286