We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38575
    • 5 Posts
    Hello!
    I tried to do so as it is written in the manual (https://github.com/Mark-H/getRelated/commit/6d12859a926c3db19a48d875a6e0b43ec55d2c1d), but nothing works. Instead, the results you want a message: "No related pages found."

    Call the snippet:

    [[getRelated?
    &fields=`pagetitle:3,introtext:2`
    &hideContainers=`1`
    &limit=`5`
    &tplOuter=`newsTplRelatedNews`
    &tplRow=`newsTplRelatedNewsRow`
    ]]


    Thanks for your help.
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      You linked to a commit for Russian support - is your site russian? If it is, can you try going back to page 3 of the thread and apply createit's patch for russian support and see if that fixes it?

      Can you call the snippet with the &debug=`1` property and post the results?
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        You linked to a commit for Russian support - is your site russian? If it is, can you try going back to page 3 of the thread and apply createit's patch for russian support and see if that fixes it?

        Can you call the snippet with the &debug=`1` property and post the results?
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 38575
          • 5 Posts
          Hello!

          Yes, my website in Russian.

          Call the snippet with the &debug=`1`

          Apply createit's patch

          Resource Query:
          SELECT `id`, `pagetitle`, `longtitle`, `introtext` FROM `modx_site_content` AS `modResource` WHERE ( ( LOWER(`modResource`.`pagetitle`) LIKE '%��%' OR LOWER(`modResource`.`pagetitle`) LIKE '%��������������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�%' OR LOWER(`modResource`.`pagetitle`) LIKE '%���������1%' OR LOWER(`modResource`.`pagetitle`) LIKE '%��%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%����������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������,%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�������������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%����������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�����������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������,%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�����%' OR LOWER(`modResource`.`pagetitle`) LIKE '%��%' OR LOWER(`modResource`.`pagetitle`) LIKE '%��������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�������������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�������%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�%' OR LOWER(`modResource`.`pagetitle`) LIKE '%�����%' OR LOWER(`modResource`.`pagetitle`) LIKE '%������.%' OR LOWER(`modResource`.`introtext`) LIKE '%��%' OR LOWER(`modResource`.`introtext`) LIKE '%��������������%' OR LOWER(`modResource`.`introtext`) LIKE '%������%' OR LOWER(`modResource`.`introtext`) LIKE '%������%' OR LOWER(`modResource`.`introtext`) LIKE '%�%' OR LOWER(`modResource`.`introtext`) LIKE '%���������1%' OR LOWER(`modResource`.`introtext`) LIKE '%��%' OR LOWER(`modResource`.`introtext`) LIKE '%������%' OR LOWER(`modResource`.`introtext`) LIKE '%����������%' OR LOWER(`modResource`.`introtext`) LIKE '%������,%' OR LOWER(`modResource`.`introtext`) LIKE '%�������������%' OR LOWER(`modResource`.`introtext`) LIKE '%������%' OR LOWER(`modResource`.`introtext`) LIKE '%����������%' OR LOWER(`modResource`.`introtext`) LIKE '%������%' OR LOWER(`modResource`.`introtext`) LIKE '%�����������%' OR LOWER(`modResource`.`introtext`) LIKE '%������,%' OR LOWER(`modResource`.`introtext`) LIKE '%�����%' OR LOWER(`modResource`.`introtext`) LIKE '%��%' OR LOWER(`modResource`.`introtext`) LIKE '%��������%' OR LOWER(`modResource`.`introtext`) LIKE '%�������������%' OR LOWER(`modResource`.`introtext`) LIKE '%�������%' OR LOWER(`modResource`.`introtext`) LIKE '%�%' OR LOWER(`modResource`.`introtext`) LIKE '%�����%' OR LOWER(`modResource`.`introtext`) LIKE '%������.%' ) AND ( `modResource`.`id` != 190 AND `modResource`.`context_key` IN ('web') ) AND `modResource`.`id` NOT IN (0) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`isfolder` = 0 ) ORDER BY createdon desc LIMIT 125
          Config:array(30) { ["base_bath"]=> string(52) "C:/xampp/htdocs/myportal/core/components/getrelated/" ["core_path"]=> string(52) "C:/xampp/htdocs/myportal/core/components/getrelated/" ["model_path"]=> string(58) "C:/xampp/htdocs/myportal/core/components/getrelated/model/" ["elements_path"]=> string(61) "C:/xampp/htdocs/myportal/core/components/getrelated/elements/" ["resource"]=> string(7) "current" ["fields"]=> string(23) "pagetitle:3,introtext:2" ["returnFields"]=> array(3) { [0]=> string(9) "pagetitle" [1]=> string(9) "longtitle" [2]=> string(9) "introtext" } ["returnTVs"]=> array(0) { } ["parents"]=> array(0) { } ["parentsDepth"]=> int(10) ["contexts"]=> array(1) { [0]=> string(3) "web" } ["includeDeleted"]=> string(0) "" ["includeUnpublished"]=> string(0) "" ["includeHidden"]=> bool(true) ["exclude"]=> array(1) { [0]=> string(0) "" } ["hideContainers"]=> string(1) "1" ["limit"]=> string(1) "5" ["fieldSample"]=> int(125) ["fieldSort"]=> string(9) "createdon" ["fieldSortDir"]=> string(4) "desc" ["tvSample"]=> int(125) ["tvSort"]=> string(9) "createdon" ["tvSortDir"]=> string(4) "desc" ["tplOuter"]=> string(18) "newsTplRelatedNews" ["tplRow"]=> string(21) "newsTplRelatedNewsRow" ["noResults"]=> string(23) "No related pages found." ["toPlaceholder"]=> string(0) "" ["rowSeparator"]=> string(1) " " ["defaultWeight"]=> int(5) ["debug"]=> string(1) "1" }
          Fields:array(2) { [0]=> string(9) "pagetitle" [1]=> string(9) "introtext" }
          TVs:array(0) { }
          Match Data:array(24) { [0]=> string(4) "��" [1]=> string(28) "��������������" [2]=> string(12) "������" [3]=> string(12) "������" [4]=> string(2) "�" [5]=> string(19) "���������1" [6]=> string(4) "��" [7]=> string(12) "������" [8]=> string(20) "����������" [9]=> string(13) "������," [10]=> string(26) "�������������" [11]=> string(12) "������" [12]=> string(20) "����������" [13]=> string(12) "������" [14]=> string(22) "�����������" [15]=> string(13) "������," [16]=> string(10) "�����" [17]=> string(4) "��" [18]=> string(16) "��������" [19]=> string(26) "�������������" [20]=> string(14) "�������" [21]=> string(2) "�" [22]=> string(10) "�����" [23]=> string(13) "������." }
          All Related Resources:array(0) { } No related pages found. 
          [ed. note: sky-master87 last edited this post 14 years, 8 months ago.]
            • 38575
            • 5 Posts
            Hello!

            Does anyone know how to fix this problem?

            Thanks for your help.
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              Looks like some kind of encoding issue... have you had any issues with other Extras or the Manager displaying Russian characters?

              Could try replacing the occurences of strtolower on line 181, 182, 183 and 356 (in getrelated.class.php) with mb_strtolower to use the multibyte library. If that fixes it for you, please file an issue in Github for multibyte support: https://github.com/Mark-H/getRelated/issues/new

              (Find it weird createit could use it without problems though, but could be a server-specific issue)
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 38575
                • 5 Posts
                Thank you so much!

                I did as you said and now it works!

                My actions:

                1).
                $v = preg_replace('/[^А-Яа-яЁёa-z0-9\s]/', '', mb_strtolower($v));


                Without this mb_ does not work

                2). I have to resave the page getrelated.class.php encoded in UTF-8

                Without utf-8 does not work

                Sorry for my english, I hope you understand me smiley
                  • 37213
                  • 25 Posts
                  Hi,

                  I try using getRelated with a TV to get the related documents. Got a strange issue.
                  Hopefully I can get the right direction to fix this issue. Below I describe what I have and what I want.

                  tv = addTag (input type is auto-tag)
                  Output type of tv = ,
                  
                  Used this tag and got the result below:
                  [[!getRelated? &fields=`tv.addTag` &tvDelimiter=`,` &debug=`1` &limit=`5`]]
                  
                  


                  My documents with tags:
                  Pasta
                  Tomato,Spagettie,Milk,Cream [addTag]

                  Pizza
                  Tomato,Cheese,Italy

                  Cake
                  Sugar,Strawberry,Milk,Cream

                  Chocolate milk
                  Milk,Italy


                  Estimated result:
                  Pasta related with "Pizza" and "Cake"
                  Pizza related with "Pasta" and "Cake"
                  Cake related with "Pizza"
                  Chocolate milk related with "Pasta", "Pizza" and "Cake"

                  Current result:
                  Pasta related with "Cake" duplicated on front-end
                  Pizza related with "Pasta" duplicated on front-end
                  Cake related with "Pasta" duplicated on front-end
                  Chocolate milk related with "cake" duplicated on front-end

                  Current result refresh again:
                  Pasta related with "Cake" duplicated and "Chocolate milk" on front-end
                  Pizza related with "Pasta" duplicated on front-end
                  Cake related with "Pasta" and "Chocolate milk" duplicated on front-end
                  Chocolate milk related with "cake" duplicated and "pasta" on front-end

                  Anybody any idea what I'm doing wrong.

                  Thanks for your time.

                  Using:
                  MODX Revolution 2.1.3-pl (traditional)
                  getRelated 1.1.2
                  getResources 1.4.2
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    tvDelimiter is not something used in getRelated, and as getRelated doesn't process TVs either - the output type there doesn't do anything either.

                    Can you show the debug output?

                    When using the default tpls, can you also show the numbers between brackets? That's the amount of points assigned to a result and can help debugging.
                      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                      • 37213
                      • 25 Posts
                      Hi Mark thanks for your time.

                      [[!getRelated? &fields=`tv.addTag` &debug=`1` &limit=`5`]]
                      
                      Config:array(31) { ["base_bath"]=> string(44) "/home/web/bakkery/core/components/getrelated/" ["core_path"]=> string(44) "/home/web/bakkery/core/components/getrelated/" ["model_path"]=> string(50) "/home/web/bakkery/core/components/getrelated/model/" ["elements_path"]=> string(53) "/home/web/bakkery/core/components/getrelated/elements/" ["resource"]=> string(7) "current" ["fields"]=> string(10) "tv.addTag" ["returnFields"]=> array(3) { [0]=> string(9) "pagetitle" [1]=> string(9) "longtitle" [2]=> string(9) "introtext" } ["returnTVs"]=> array(0) { } ["parents"]=> array(0) { } ["parentsDepth"]=> int(10) ["contexts"]=> array(1) { [0]=> string(3) "web" } ["includeDeleted"]=> string(0) "" ["includeUnpublished"]=> string(0) "" ["includeHidden"]=> bool(true) ["exclude"]=> array(1) { [0]=> string(0) "" } ["hideContainers"]=> string(0) "" ["limit"]=> int(3) ["fieldSample"]=> int(125) ["fieldSort"]=> string(9) "createdon" ["fieldSortDir"]=> string(4) "desc" ["tvSample"]=> int(125) ["tvSort"]=> string(9) "createdon" ["tvSortDir"]=> string(4) "desc" ["tplOuter"]=> string(12) "relatedOuter" ["tplRow"]=> string(10) "relatedRow" ["noResults"]=> string(23) "No related pages found." ["toPlaceholder"]=> string(0) "" ["rowSeparator"]=> string(1) " " ["defaultWeight"]=> int(5) ["debug"]=> string(1) "0" ["tvDelimiter"]=> string(1) "," } 
                      Fields:array(0) { } 
                      TVs:array(1) { [0]=> string(7) "addTag" } 
                      Match Data:array(4) { [0]=> string(6) "tomato" [1]=> string(9) "spagettie" [2]=> string(4) "milk" [3]=> string(5) "cream" } 
                      All Related Resources:array(12) { [9]=> array(7) { ["rank"]=> int(10) ["id"]=> int(428) ["tvid"]=> string(4) "5269" ["pagetitle"]=> string(4) "Cake" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(27) "Sugar,Strawberry,Milk,Cream" } [0]=> array(7) { ["rank"]=> int(10) ["id"]=> int(428) ["tvid"]=> string(4) "5269" ["pagetitle"]=> string(4) "Cake" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(27) "Sugar,Strawberry,Milk,Cream" } [2]=> array(7) { ["rank"]=> int(10) ["id"]=> int(428) ["tvid"]=> string(4) "5269" ["pagetitle"]=> string(4) "Cake" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(27) "Sugar,Strawberry,Milk,Cream" } [1]=> array(7) { ["rank"]=> int(10) ["id"]=> int(428) ["tvid"]=> string(4) "5269" ["pagetitle"]=> string(4) "Cake" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(27) "Sugar,Strawberry,Milk,Cream" } [10]=> array(7) { ["rank"]=> int(5) ["id"]=> int(259) ["tvid"]=> string(4) "5347" ["pagetitle"]=> string(14) "Chocolate milk" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(10) "Milk,Italy" } [5]=> array(7) { ["rank"]=> int(5) ["id"]=> int(259) ["tvid"]=> string(4) "5347" ["pagetitle"]=> string(14) "Chocolate milk" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(10) "Milk,Italy" } [4]=> array(7) { ["rank"]=> int(5) ["id"]=> int(259) ["tvid"]=> string(4) "5347" ["pagetitle"]=> string(14) "Chocolate milk" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(10) "Milk,Italy" } [3]=> array(7) { ["rank"]=> int(5) ["id"]=> int(259) ["tvid"]=> string(4) "5347" ["pagetitle"]=> string(14) "Chocolate milk" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(10) "Milk,Italy" } [11]=> array(7) { ["rank"]=> int(5) ["id"]=> int(223) ["tvid"]=> string(4) "5272" ["pagetitle"]=> string(5) "Pizza" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(19) "Tomato,Cheese,Italy" } [8]=> array(7) { ["rank"]=> int(5) ["id"]=> int(223) ["tvid"]=> string(4) "5272" ["pagetitle"]=> string(5) "Pizza" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(19) "Tomato,Cheese,Italy" } [7]=> array(7) { ["rank"]=> int(5) ["id"]=> int(223) ["tvid"]=> string(4) "5272" ["pagetitle"]=> string(5) "Pizza" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(19) "Tomato,Cheese,Italy" } [6]=> array(7) { ["rank"]=> int(5) ["id"]=> int(223) ["tvid"]=> string(4) "5272" ["pagetitle"]=> string(5) "Pizza" ["longtitle"]=> string(0) "" ["introtext"]=> string(0) "" ["addTag"]=> string(19) "Tomato,Cheese,Italy" } }
                      


                      Got this result with the default tpl:
                      cake (10)
                      cake (10)
                      cake (10)