We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    A client has asked me to build in a way to handle basic company details. As MODX does not currently do this kind of thing, I know that I will need to create a new module, and a new table (ie: modx_companydata) to hold all data.

    The fields are very generic, ie: "Company name," "Address", "Telephone", etc) and the data is to be listed, and most probably paged (1|2|3) later on.

    My questions;

    1) Am I right that if I created a form within my module I can only view it via the front-end of the site, and not via the MODX backend?

    2) How do I prevent web-users from adding companies via the module?

    3) Is there a walkthrough or a guide to help build your own modules, especally if it interacts with the MODX database object?

    Many thanks.
      • 6726
      • 7,075 Posts
      Using custom tables and a module is not the only way to go.

      It depends on what you need to do (I am not sure I fully understand what your client needs) but you could use Template Variables (TVs) for that purpose. It’s very easy to build directories with TVs and Ditto for example.

        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 32645
        • 377 Posts
        Hi.

        Thanks for your prompt reply.

        A client wants to add a list of companies into MODX. This directory of companies will be publically viewable (but not editable).

        The list of companies has generic data such as company name, address, etc.

        quote;
        "It’s very easy to build directories with TVs and Ditto for example."

        Are there any live examples of using TV and Ditto to build a directory with generic data as detailed above?

        I’m curious about using TV and Ditto to do this, I guess you could argue that each client is a page too -- but I don’t really want to do that as the user might forget a piece of data (IE: company address).

        Can you really use TV to hold database type data, such as address, etc? Even for more than 1 row?
          • 32645
          • 377 Posts
          I’m going to explore the use of TV or template variables to resolve this.

          Thanks all

          * closed.
            • 6726
            • 7,075 Posts
            Sorry, I am busy at the moment and can’t provide a detailed answser...

            Here is a quick one :

            • create a template for your company pages
            • create a TV for each field you need for your company directory
            • associate those TVs with the template
            • create a document for each company you need to fill in details. Now when you go and create a document with that template, you’ll have your fields handy. You can change the order of fields in Resources > Manage Resources > Templates >> click the template, then second tab "Assigned Template Variables", there is a link "Edit the sort order of the template variables". Edit and you’re set smiley BTW If you need to hide the default content field, check the HideEditor plugin.
            • insert a Ditto call on the page you want to list the companies (dig into Ditto countless parameters and options wink )

            Hope it helps smiley


              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id
              • 10449
              • 956 Posts
              If you’re brave enough, there’s also tvExplorer and tvEditor:
              http://modxcms.com/forums/index.php/topic,16456.0/topicseen.html
              http://modxcms.com/forums/index.php/topic,16455.0.html

              But I’d suggest you get the basics down first with using TVs (+ Ditto for listing/retrieving the tv content).
                • 6726
                • 7,075 Posts
                tvExplorer and tvEditor are sugar coating helping you setting up TVs or a custom search, but firt things first start with Ditto it’s really the key MODx snippet anyway...
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 32645
                  • 377 Posts
                  Sorry I’ve not done TVs before, and mixing into a "mini-database" confused the hell out of me, but I’m really impressed with the detailed answers as they were exactly what I was looking for!

                  Many thanks!