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

    I like MODx - I have only just begun with exploring it, but I am already sold. The TV / Snippet / Chunk methodology is one of those simple but amazingly effective ideas.

    I am hoping for some advice. I am going to be migrating a site from a proprietary CMS into MODx, and I need to make a decision about the shopping cart - whether to use MODx + Ditto + Foxycart, or look for something external to integrate.

    The existing site has less than 100 products for sale, split into 7 categories. There isn’t anything particularly unusual about the cart right now, but I need to be able to ensure that there is scope for some integration with a internal ERP system. But first things first.

    The business has different pricing for members than for non-members. So my first question is whether there is a way I can add arbitrary information (such as a member number) to a webuser record? Also any other pertinent information, beyond what is available by default - like a system similar to TVs? Note that the content manager needs to be able to manage this information simply - as simply as a TV would be for a document.

    I have been looking through the Catalogue howto for the product side of things, using FDM, eform and Ditto. Is there a method of doing what FDM does, but inside the manager? The content manager will look after both the site, and the ecommerce items and pricing, so I would like this to be a single interface. For example, having a ModelProduct that is used as the basis of documents created under the products folder for example. Also, I would probably use TVs to add product images, but can I still get maxigallery to provide lightbox, or is there a better way to do this? I note that having an Input TV for maxigallery is a planned feature, but what about now?

    Finally, integration. Is it possible to trigger a snippet via a TV? Here is what I am considering for product management. The customer has a large portfolio of products they sell, but only a small amount of them are available via the website. I am thinking that an easy way for them to add a product to the website would be to add a new document to the Products folder that had the SKU id as a TV, then click an Update button which would create a connection to the main database (which is housed elsewhere) and pull down description, pricing and any other info that would be needed into the document. I am thinking I could somehow do this with a checkbox TV that issued an EVAL that called a snippet which did the database call. I am not sure if this is feasible, or I am banging a square peg into a round hole. The important thing is that this be asynchronous - ie an update only happens at the behest of the content manager. So again, it needs to be a straightforward process, ideally managed from the Document editing page (hence my idea to use a TV somehow even though this isn’t really a TV purpose).

    If this were possible, then I could do the same thing with webuser records - have an "update" button, so that if the customer has called in and updated their details (which would be entered into the main database), then all the content manager would need to do is hit an update button in MODx to pull those details into the webuser account. I can use the push feature of the Foxycart API to reflect the changes out to foxycart.

    Ultimately what I am asking here is - should I be attempting these things in MODx, or should I just use Magento or something similar, that has import/export routines and just use something that is already built?

    Thanks everyone.

    Paul












      • 9207 ☆ A M B ☆
      • 2,475 Posts
      Well, I can answer the easy question: yes, you can call a Snippet from a Template variable. So in your document where you type in the text for the template variable, you’d just type in the call to your Snippet, e.g. [!MySnippet? &var=`1`!], and then in your template, where-ever your template variable appeared (e.g. [*my_tv*] ), it’d be replaced with the Snippet output.

      Have a look at the Wiki for more info re TVs:
      http://wiki.modxcms.com/index.php/Template_Variables

      I can’t speak to the shopping cart... I haven’t done that in MODx...
        • 22827
        • 129 Posts
        Thanks, yeah. I wasn’t clear in my question, but what I was intending to ask for won’t work I don’t think.

        A TV is parsed during the display of the document. I was hoping to subvert the TV so that I could get the snippet to run while the document was being edited in manager.

        I suspect I am going to need to use a module to accomplish what I want.
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          Perhaps you need a module, but if you want PHP code that runs based on events (i.e. a page being edited in the manager), that falls into the realm of Plugins. See if you can’t find something in the forums or in the Wiki that’ll help you out.
            • 3749
            • 24,544 Posts
            Quote from: paulkoan at Feb 22, 2009, 06:12 PM

            Thanks, yeah. I wasn’t clear in my question, but what I was intending to ask for won’t work I don’t think.

            A TV is parsed during the display of the document. I was hoping to subvert the TV so that I could get the snippet to run while the document was being edited in manager.

            I suspect I am going to need to use a module to accomplish what I want.

            As Everett said, it sounds like you want a Plugin listening to onDocFormPrerender if you want to alter the document before it’s edited or onDocFormSave if you want to alter it after it’s edited but before it’s saved.

            If, OTOH, you want to alter the document *while* it’s being edited, you’re looking at a whole other can of worms. wink
              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
              • 22827
              • 129 Posts

              Heh.. yeah well I was thinking "while"! Ok I’ll table that for a while and think of alternative ways to do it.

              Any ideas on the question of adding additional information to a web user?