On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    Is it possible to order the values of the ajaxsearch on a TV? Basically I the results to be ordered by the TV(a date field TV) not by rabk.

    I tried using the &order parameter but I get an error.
    The date is displayed correctly in the output using the &tvPhx param.

    The error I get is

    « Execution of a query to the database failed - Unknown column 'researchPublicationDate' in 'order clause' »
          SQL: SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.template, sc.menutitle, sc.content, sc.publishedon, GROUP_CONCAT( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP_CONCAT( DISTINCT ntv.value SEPARATOR "," ) AS tv_value FROM `modx2_site_content` sc LEFT JOIN( SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `modx2_site_tmplvar_contentvalues` tv ) AS ntv ON sc.id = ntv.contentid WHERE ((sc.id IN (404,405,406)) AND (sc.published=1) AND (sc.searchable=1) AND (sc.deleted=0) AND (sc.privateweb=0)) GROUP BY sc.id HAVING (((sc.pagetitle LIKE '%entry%') OR (sc.longtitle LIKE '%entry%') OR (sc.description LIKE '%entry%') OR (sc.alias LIKE '%entry%') OR (sc.introtext LIKE '%entry%') OR (sc.menutitle LIKE '%entry%') OR (sc.content LIKE '%entry%') OR (tv_value LIKE '%entry%'))) ORDER BY researchPublicationDate


    I was hopping that AjaxSearch would build the query in a way that get the researchPublicationDate TV as a column.

    Thank you

    • Is it possible to order the values of the ajaxsearch on a TV?
      Yes. See http://www.evo.wangba.fr/index.php?id=500

      I was hopping that AjaxSearch would build the query in a way that get the researchPublicationDate TV as a column.
      For this you need to use the withTvs parameter.
      Instead of
      &tvPhx=`researchPublicationDate`

      use
      &withTvs=`researchPublicationDate`

      withTvs add the TV value as field in the sql request. tvPhx add the TV value as new field result AFTER the sql request