Magento – creating a custom observer

3 Steps to create a custom observer. These instructions are to create an observer when a customer is in the process of checking out, and we are "Observing" the Save shipping piece. This was needed for a project that we are appending to the Gift Message feature for magento. We are adding some text to every order that passes through regardless if the user entered something or not. For this project I have a Website called Bloom Step 1: create the module xml In /app/etc/modules create an xml file called Bloom_Checkout.xml In this new file add the following:

<?xml version="1.0"?>

Read more

Recover Mysql Root password

You can recover MySQL database server password with following five easy steps.

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5: Exit and restart the MySQL server. Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service # /etc/init.d/mysql stop Output: Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password: # mysqld_safe --skip-grant-tables & Output: [1] 5988 Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client: # mysql -u root Output: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>

Read more

How to get a magento item using sku, name, ID

// Load by name $_category = Mage::getModel('catalog/category')->loadByAttribute('name', 'Ruby Ring'); $_product = Mage::getModel('catalog/product')->loadByAttribute('name', 'emerald earring'); // Load by SKU $_product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'Eram18j4'); //Load by ID (just load): $_product = Mage::getModel('catalog/product')->load($productID);

How to get Product image url from product id or SKU?



Example 1:



Example 2:




Example 3 (origional image without resize):


How many files are in a typical magento install

Well, I just did another install of Magento and as a Magento developer I always wanted to know roughly how many files and folders are in that. I did do some custom work to this install, so these number are slightly higher than whats in a fresh install but its rather impressive: First here is the command I ran: for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null The output showed: 20384 files 0 links 5165 directories Now thats a lot of files and folders!