This is the first in a planned series of tutorials covering MODx Revolution 2 for complete beginners from the ground up. MODx Revolution is the new branch of the MODx CMS that's built on a whole different code base than MODx Evolution. According to MODx founder Ryan Thrash: "MODx Revolution is a completely new MODx. It retains the soul of what makes MODx a great platform for building custom websites and rich applications, while enabling you to do more and to do them better. MODx Revolution 2.0 is more powerful, can handle high-volume sites, and offers the ability to handle multiple sites and subdomains from one install." (The Revolution Starts Now)
In this post, I am going to briefly walk through the process of creating a very simple and basic ecommerce setup using MODx Evolution and PayPal. There are several MODx shopping carts that are at different stages of development and that have different features, however I haven't extensively tested or used any of them, but I hope to eventually do some writeups on them if I get the opportunity to play with them. I would recommend that you definitely explore them too, as well as other third party services that integrate with MODx, such as Ecwid and Foxycart. For this tutorial we're going to do something very simple, basic, and direct with PayPal being the only payment gateway offered. This tutorial is by no means exhaustive or comprehensive, but it should give a good starting point for thinking about how to integrate PayPal with your MODx website for simple sales.
In this post we're going to go over how to get the MailChimp snippet set up and working on your MODx Evolution site. MailChimp is a service that allows you to send email newsletters, manage subscriber lists, and track campaign performance. You can of course simply create the forms and such directly in MailChimp and paste the supplied code into your site, but this little snippet works just great. The directions I will outline here are also covered in the documentation inside the snippet folder, but I thought I would go over it for my own future reference and for anyone who may not be aware that this snippet exists or who may have had trouble setting it up. I am using MODx Evolution 1.0.2 and will be setting this demo up on the Learn MODx website.
Part 0: Introduction Part 1: Write and Test the PHP Script Part 2: Create the Snippet Part 3 – MODx API, Placeholders, Chunks In the fourth part of this brief series on creating a custom MODx Evolution snippet, we're going to do some optimizing to make our snippet a little more efficient. So far the snippet seems to be working as expected and is pulling in the feeds as needed. However, it's a little inefficient. The way things are set up now, every time someone refreshes the page, the script fetches a new copy of the rss feed from the coding pad, or whatever source you're pulling your feeds from. If you have a heavily trafficked site where people spend a lot of time on your site and visit many pages (thus, for example, constantly refreshing your snippet call in the sidebar), this can be resource heavy on both your side slowing your website down, and also on the web server that you're pulling the feeds from. We can mitigate this by implementing caching.
Part 0: Introduction Part 1: Write and Test the PHP Script Part 2: Create the Snippet So far we have created the raw PHP script and tested the code outside of MODx. We've started the process of transforming this script into the rssfeedFetcher snippet and we have it working on the Learn MODx website. We've learned how to add optional parameters with default values to our call and everything seems to be working as expected. At the close of the last segment, I mentioned that our snippet is still relatively inflexible because the user has no control over how the output looks. We're going to rectify this today by tapping a little into the MODx API to create placeholders and utilize chunks to allow for some templating and customization of the output.