Magento: first glance

I'm currently cooperating with a company based near Modena and I recently heard about the use of Magento as the default CMS for their e-commerce projects. To keep me up-to-date, I downloaded Magento, unzipped it and took a look at the main configuration files.

The first impression is good: Magento makes use of PEAR and the Zend Framework for its backend activity, but it doesn't use Smarty as default template engine (Smarty compiles everything, so it may generate a little overloading on the server). So far so good.

The installation file checks first if you're using a recent version of PHP. If not, it returns an error:

if (version_compare(phpversion(), '5.2.0', '<')===true) {
    die('ERROR: Whoops, it looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer.');
}

That's cool, because we make sure that older, buggy versions of PHP are no longer in use. Magento allows you to install the CMS either via command line or through a web interface. Here's how it performs this initial check:

if ($installer->init($app)          // initialize installer
        && $installer->checkConsole()   // check if the script is run in shell, otherwise redirect to web-installer
        && $installer->setArgs()        // set and validate script arguments
        && $installer->install())       // do install
    {
      echo 'SUCCESS: ' . $installer->getEncryptionKey() . "\n";
        exit;
    }

Actually, the installation options are listed previously within PHP comments:

 * 2. Perform the installation
 *
 *  php -f install.php -- --license_agreement_accepted yes \
 *  --locale en_US --timezone "America/Los_Angeles" --default_currency USD \
 *  --db_host localhost --db_name magento_database --db_user magento_user --db_pass 123123 \
 *  --db_prefix magento_ \
 *  --url "http://magento.example.com/" --use_rewrites yes \
 *  --use_secure yes --secure_base_url "https://magento.example.com/" --use_secure_admin yes \
 *  --admin_lastname Owner --admin_firstname Store --admin_email "admin@example.com" \
 *  --admin_username admin --admin_password 123123 \
 *  --encryption_key "Encryption Key"
 *
 * Possible options are:
 * --license_agreement_accepted // required, it will accept 'yes' value only
 * Locale settings:
 * --locale                     // required, Locale
 * --timezone                   // required, Time Zone
 * --default_currency           // required, Default Currency
 * Database connection options:
 * --db_host                    // required, You can specify server port, ex.: localhost:3307
 *                              // If you are not using default UNIX socket, you can specify it
 *                              // here instead of host, ex.: /var/run/mysqld/mysqld.sock
 * --db_name                    // required, Database Name
 * --db_user                    // required, Database User Name
 * --db_pass                    // required, Database User Password
 * --db_prefix                  // optional, Database Tables Prefix
 *                              // No table prefix will be used if not specified
 * Session options:
 * --session_save <files|db>    // optional, where to store session data - in db or files. files by default
 * Web access options:
 * --admin_frontname <path>     // optional, admin panel path, "admin" by default
 * --url                        // required, URL the store is supposed to be available at
 * --skip_url_validation        // optional, skip validating base url during installation or not. No by default
 * --use_rewrites               // optional, Use Web Server (Apache) Rewrites,
 *                              // You could enable this option to use web server rewrites functionality for improved SEO
 *                              // Please make sure that mod_rewrite is enabled in Apache configuration
 * --use_secure                 // optional, Use Secure URLs (SSL)
 *                              // Enable this option only if you have SSL available.
 * --secure_base_url            // optional, Secure Base URL
 *                              // Provide a complete base URL for SSL connection.
 *                              // For example: https://www.mydomain.com/magento/
 * --use_secure_admin           // optional, Run admin interface with SSL
 * Admin user personal information:
 * --admin_lastname             // required, admin user last name
 * --admin_firstname            // required, admin user first name
 * --admin_email                // required, admin user email
 * Admin user login information:
 * --admin_username             // required, admin user login
 * --admin_password             // required, admin user password
 * Encryption key:
 * --encryption_key             // optional, will be automatically generated and displayed on success, if not specified
 *
 */

As you can see, if you come from Wordpress or another blogging-related CMS this can be quite shocking. I also noticed that Magento makes a massive use of XML for configuration tasks: that's good, because XML is notoriously easy to edit and modify. Well, next days I'll try to put it up on my local machine and to play a little bit with it. (Yes, I have to understand how to write good XHTML/CSS templates for Magento, but since I'm lazy and disorganized, that could take some time)

One thought on “Magento: first glance”

Leave a Reply

Note: Only a member of this blog may post a comment.