On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I'm messing arround with MIGXdb for the first time and and setting up tables and schemas worked like a charm. This is a great enhancement for modx!

    Working on some frontpage things I'm facing a few obstacles I want to discuss.

    &where Parameter
    ---------------------------

    I need to check if a Multiselect TV inside a MIGXdb grid field contains the value "29"

    As some fields contain more than one value, I can't use a simple IS condition.

    Inside the DB both values are seperated by a double pipe (29||49) and as the TV is set to output a comma delimited list the placeholder output is as expected: 29,49

    I tried to use "find", "ia" or "find_pd" (migx.class.php line 1205+) to get this particular row by searching for "29", but without any success.

    Fortunately the &where parameter seems to understand SQL:

    &where=`{ "published:=":"1" , "resource_ids:LIKE":"%49%" }` 


    As far as I understand the where syntax from getImageList is not fully implemented into MIGXdb. Is this correct?

    &docid parameter
    --------------------------

    I try to get a some results from a different resource. but I never get a result in return.

    Example: I have 10 rows in a table that point to resource no. 1 inside resource_id. They can be seen and edited inside the TV. It's also possible to output them if you render resource no. 1.

    Now I want to output them in resource no 2. As far as I understand this is where the &docid paramter comes in.

    Example:

    [[!migx? 
    &configs=`migx_obDB`
    &docid=`1`
    &tvname=`migxDB`
    &tpl=`migxDB.Verkauf.tpl`
    &where=`{"published:=":"1","resource_ids:LIKE":"%49%"}`
    ]]


    If I call this snippet from Resource no. 1. I get the expected result. If I change the docid Parameter to something else this has no impact on the result. I stil get the same output.

    If I call the snippet from resource no 2 I don't get anything at all.

    This is also true for any use of &docidVarKey and any URL parameter. They are ignored.

    The only thing I seem to be able to do is with the migx snippet to output results in their "home" resource.

    What Am i missing here?

    Regards,

    pepebe [ed. note: pepebe last edited this post 7 years, 11 months ago.]
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
    • I've just uploaded a new version MIGX 2.2.2
      there is a snippet migxLoopCollection

      try thisone to get a Collection from your custom-tables with something like that:

      an example-call of migxLoopCollection:

      [[!migxLoopCollection? 
      &packageName=`yourPackage` 
      &classname=`yourClass` 
      &where=`{"resource_id":"1"}`
      &queries=`{"xPDOQuery::SQL_AND":"CONCAT('||',resource_ids,'||') LIKE '%||49||%'"}`
      &joins=`[
      {"alias":"Resource","selectfields":"pagetitle"},
      {"alias":"tvmigx2","classname":"modTemplateVarResource","on":"tvmigx2.contentid = Resource.id and tvmigx2.tmplvarid = 5"}]`
      ]]
      /code]
      
      
      
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!