Archive - Magento RSS Feed

Give Your Command Line Script Full Access to Magento

In the past year, I have had the pleasure of having to write a lot of scripts that accomplish certain tasks inside Magento. It is not immediately obvious how to do this, but once you know how, you will love the power that it gives you.

In your PHP script simply put the following at the top:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

// Load Up Magento Core
define('MAGENTO', realpath('/path/to/magento'));

require_once(MAGENTO . '/app/Mage.php');

$app = Mage::app();

?>

You can now do anything you would normally do inside Magento. I usually end up loading and manipulating a models in my scripts. You will notice at the top that I set error reporting to be outputted. I like to do this to ensure that errors are being displayed on the command line (it will override any other settings).

A Brand New Look, Some Changes, and An Announcement

I have made a lot of different changes to the website this weekend and I thought I should let everyone know about what is happening with the website.

First are foremost, I have changed the design of the website. I was never truly satisfied with the old look and I like this one a lot better. Your comments are welcome, but please remember that I am a programmer, not a designer (so constructive criticism only).

You will also notice that I have removed all advertising from the website. It hurt the look of the site and nobody was clicking on them anyways. There will still be advertising in the RSS feed, but that is the only place for now. No advertising now means that I can get rid of that ugly privacy policy.

I would also like to take this time to announce the launch of a new website that I will begin doing called Learn PHP Now. It will cover the exact same type of topics as this website, but with PHP. There were posts on this website where using PHP would have been very helpful to some of you, but it was not within the scope of this website to do so. So now I can fill in that gap with the launch of Learn PHP Now.

Learn PHP Now Coming Soon

Welcome to Learn PHP Now.  This website is brand new and in the coming days will provide you with tutorials, news coverage, and other general information about the PHP programming language.

So please stand by while we launch this website!

Page 4 of 4«1234