We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 491
    • 2 Posts
    Hello all, first off, I’d like to thank the modx team a real huge lot for coming up with this excellent software... maybe a a thank you that involves paypal would be more appreciated, but I’m still getting there to that point where I have enough paypal balance to make donations smiley

    Coming to the point, this is my question:

    I made a website a few months ago - it was for a medical product manufacturer, and it is nothing but a mess of sphagetti php and mysql - please check it here, if it can help you answer the question better.

    it basically has a huge index of products - each made with a large number of herbs - and each working for a range of diseases. the client wanted the ability to group all the products through:

    1. all products by alphabetical order - clicking on a product leads to its "details" page
    2. all herbs indexed by alphabetical order - and the products that use each of those herbs with links to the products
    3. all diseases and products they have to address them with links

    note that product details has herbs used with quantities - ideally, client should be able to select herbs from a list and enter quantities into fields without bothering to type them up...

    not only is my solution incomplete in places - it has less functionality and interlinking than i would have liked it to have - but also it does not allow the client to make any changes to the products/diseases/herbs - ridiculous!

    I am exploring options to change this - and I would be grateful to any kind soul who can:
    1. Tell me if this is possible in MODx or it is simply better to stick with full custom code
    2. If it is possible, point me in a direction with the right components to use? MODx has so many moving parts - templates, resources, chunks, TVs... a couple of lines suggesting a way to approach this problem would be much appreciated smiley
      • 491
      • 2 Posts
      Considering that I have had as much formal php training as my landlord’s pet parakeet, I may not be able to say that I know how to keep my database organized in the full hipster sense of the word smiley

      However, I am attaching the table structure I have used for this purpose when I custom coded this as an image for your kind perusal...

      I like to think that you’re completely correct about Assumption#1, and yes, you are right with assumption #2

      Ultimately, the presentation of the indices is in a document format, for the consumption of the general public... so I assumed that MODx would be of good use in that context.

      I very much enjoy tearing my hair out during long nights of figuring out unhelpful php parser errors and completely(!) blank screens, so I hope I can receive more assistance once I start needing it. I’ll take a look at getResources and see how far I take this with it. Thanks for the suggestion smiley

      The more obscure parts of the image are quite unimportant : please ignore the presence of "textaboveingtab", and "reference" fields...
        • 4172
        • 5,888 Posts
        I wouldn’t use modx-resources and getResources for that project.

        I think your db-structure doesn’t look that bad.
        I would name the key-fields of all tables allways id and would use them as they are as cutom-tables for modx in the same database.
        This way its easy to get connected to them for modx.

        I would also use modx-revolution for that project and create a xml-schema with proper relations between your tables.
        To manage them I would create a Custom-manager-page (CMP) for example on basis of xdbedit.
        Its possible to use loopDbChunk for example to list your items. I think you will need also some cutom-snippets to create filters, a-z-navigations and that all.

        As an example what you can do with modx-CMPs and some snippets you can also have a look to visioncart, how it is done.
        Its a very nice example to see how you can create powerfull apps with modx-revo.



          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          I wouldn’t recommend checking out VisionCart code to get a hang of it.. you just named probably the most complex addon out there at this point, lol.

          Start with Doodles, modExtra for setting up your development and check out slightly more complex addons like Quip.


          I do agree that it would be better to not use the MODX Resources for this - a custom table allows you more flexibility, minus the overhead involved in resources.

          That said, you could use resources as products, with combobox TVs to grab the ingredients and diseases from either another resource list, custom table or anything like that. It will be easier and faster to develop (using getResources with TV Filters) - but not as flexible as a custom table set up. Writing snippets like getResources for your own table is easy as well after you set up your database scheme.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.