We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38783
    • 571 Posts
    Hello

    I have used Bob Ray's Class Extender to extend modUser. I would like to incorporate data from the fields I have added into results from the Simple Search extra.

    I have tried following the guide here:
    https://rtfm.modx.com/extras/revo/simplesearch/simplesearch.simplesearch
    But I am unable to specify the correct information in the place of the example below.
    className:fieldName(s):packageName:packagePath:joinCriteria||class2Name:fieldName(s):package2Name:package2Path:join2Criteria


    Class Extender is installed in its default location.
    Custom (class extender) fields containing some data I want to search are:
    profileOne
    profileTwo

    I have a (class extender) field that contains the resource number of the users profile. This is called:
    userPageNumber

    My Search is as follows
    [[!SimpleSearch?
      &toPlaceholder=`sisea.results`
      &perPage=`10`
      &customPackages=`ext_user_data:profileTwo:extendeduser:{core_path}components/classextender/model/:profileTwo.resource = userPageNumber`
    ]]
    
    <h2>Search Results</h2>
    [[+sisea.results]]


    Unsurprisingly this does not work and results in an error log that reads
    2016-02-12 18:41:37] (ERROR @ /index.php) Could not load class: ext_user_data from mysql.ext_user_data.
    [2016-02-12 18:41:37] (ERROR @ /index.php) Error 42S22 executing statement: 
    Array
    (
        [0] => 42S22
        [1] => 1054
        [2] => Unknown column 'ext_user_data.profileTwo' in 'where clause'
    )


    If anyone is able to help I would be very grateful.

    Andy





      If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

      email: [email protected] | website: https://andytough.com
      • 51816
      • 4 Posts
      I use also SimpleSearch. Maybe the order has to be different.

      mmlTemplateVarResource:value:migxmultilang:{core_path}components/migxmultilang/model/:mmlTemplateVarResource.contentid = modResource.id AND mmlTemplateVarResource.langid = [[!getLangId]]



      Martin
        • 38783
        • 571 Posts
        Thank you Martin. I will check this out when I get back home.
          If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

          email: [email protected] | website: https://andytough.com
          • 3749
          • 24,544 Posts
          You might try this:

           &customPackages=`ext_user_data:profileTwo:extendeduser:{core_path}components/classextender/model/:profileTwo.resource = extendeduser.userPageNumber`


          I don't see how it will work, though, because you're looking for resources (right?) and I don't see how SimpleSearch would know how to connect this to the the modx_site_content table.

          How about this?

          profileTwo.resource = resource.id


            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 38783
            • 571 Posts
            Hello Bob, Each user has a resource allocated to them. In the user profile I have a field for the users resource number. So I am hoping I can create a link between the two fields when generating search results?
              If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

              email: [email protected] | website: https://andytough.com
              • 3749
              • 24,544 Posts
              I hate to suggest this after you've gone to all the work, but if the fields in your custom table will fit in any unused fields of the user profile (e.g., country, fax, photo) it would make things a lot simpler.

              If not, I'm not familiar with how SimpleSearch handles custom packages, so I can't be much help beyond my last suggestion above.

              What, exactly, is the user searching for? If it's just one user's resource there are much faster ways to find it.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 38783
                • 571 Posts
                Hello Bob

                The website is to be a register of dog trainers. The dog trainers will sign up, login, and update their own profiles. The profiles will contain a fairly extensive list of fields relating to their qualifications, areas of expertise etc. I would prefer that they are updating their actual user account/profile, through the website. I want to avoid setting up permissions for each of them to use the MODX Manager and have access to a single resource which contains their information.

                There will be a single resource allocated to each user. This will display the information they have entered into their profile. The site manager will also be entering their address into the Google Maps StoreLocater TVs.

                Members of the public will hopefully visit the site to look for qualified dog trainers. My other post that you helped me with previously was related to a requirement for the members of the public to tick boxes specifying that they are interested in (for example) Agility and Rally and for those trainers who specialise in both of these to be listed.

                The trainers full profile can then be accessed. This will work OK I think, once I overcome the problem I had with my checkbox searches.

                However, I have a feeling that as the project progresses someone will say they want a general site search that will contain both the content from site AND the user profile information. This led me to ask the question about searching profiles with Simple Search.

                Sorry about providing all this background detail, but I realise that I have asked a technical question that may be irrelevant if you look at what my aims are and think I am approaching the whole project in the wrong way.

                So if you think I am approaching it wrong I would prefer to know. The project is in its early stages and I am working with dummy fields and data. So starting again in a different way would not be too painful.

                Thank you for all your advice so far

                Andy
                  If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

                  email: [email protected] | website: https://andytough.com