Xtream VIP
Total posts: 129
03 Mar 2019 15:19

Hello Is it possible by API or by some code to get list of IDs for all childs articles when we are on child article page?

Last Modified: 13 May 2019


Sergey
Total posts: 13,748
12 Mar 2019 05:36

When you are on Child page you need list of parents? Or you want to get list of other chidren of the same parent?


Xtream VIP
Total posts: 129
12 Mar 2019 19:18

Or you want to get list of other chidren of the same parent? - Exactly!

I need it to creare next/prev buttons in child article and to have navigation throw other childs of the current parent. At a moment I use list of childs ID which I can take from parent field, but here is a big problem. After adding new child I need to manualy resave my parent, because whithout resave I cant receive new child ID from parent field data.


Sergey
Total posts: 13,748
21 Mar 2019 05:27
SELECT record_id FROM #__js_res_record_values WHERE field_value = '{$record_id}' AND field_id = {$field_id}

Where $record_id is an id of current record and $field_id is an ID of child field.


Xtream VIP
Total posts: 129
12 May 2019 17:50

Hello

Thank you. Have time to resolve my problem with next/prev buttons for childs and now everything works great. Final sql code is

 SELECT V.record_id rid 
   FROM #__js_res_record_values V 
  INNER JOIN #__js_res_record R ON R.id = V.record_id 
  WHERE V.field_value = {$parent_record_id} 
    AND V.field_id = {$chield_field_id} 
    AND R.published = 1 order 
     BY R.ctime asc
Powered by Cobalt