We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26436
    • 19 Posts
    Background: I am building a custom shopping cart (loosely) based on Kiwee Commerce. I had trouble getting the Kiwee cart to function properly and it needed modification to use for the type of products we would be selling. I have everything pretty much working, cataloging, product detail, shopping cart page, checkout, shipping, billing. But I am having trouble with something as simple as the e-mail notification.

    Here is my problem: Upon order confirmation, the external class file calls a function to send an order confirmation. In that function I would like to use something like $cnk = $modx->getChunk(’emailtpl’); and then use a str_replace("[+orderdata+]
      • 3749
      • 24,544 Posts
      You might look at class.phpmailer.php. It’s in \manager\includes\controls

        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        And check out the eForm code; it does pretty much what you have in mind, I believe.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 26436
          • 19 Posts
          Ya, I have those, sending the email wasnt my main problem, I think my real problem is bringing in the template with the $modx-getChunk. I suppose it really isnt necessary, I could just make a call to the database and bring it in that way. I was just curious how to bring in the $modx functions like getChunk and getSnippet.

          Thanks for your help guys, I do appreciate it.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            $modx->getChunk(’chunk-name’);

            $modx->runSnippet(’snippet-name, array(’param1’=>’value1’, ’param2’=>’value2’));
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 26436
              • 19 Posts
              I guess my real problem is that my external class that is being called from an external php file and not directly from a page that is going through the parser. It isnt recognizing the $modx even when I put a global $modx statement. Which makes sense, i suppose if i think about it.

              Again, I dont think it is that big of a deal. I can just pull the Chunk directly from the database.

              Thanks for the help from everyone. I was just curious how to make my class recognize the $modx functions when called from an external file and not from a page containing a snippet.