Author Archives: admin

The template system architecture of Magento

The template architecture is broken into three areas—two for development of the theme and one for the containment of the assets:

• /app/design/frontend/default/<template_name>/

layout/—For all the XML files declaring which module tied functions should be called to which template files

template/—For all the templates processing the output that is passed from functions called from layout/ and structured into the final output to the user.

• /skin/frontend/default/<template_name>/—For the containment of all assets relating to our template, images, CSS, Flash, and JavaScript.

Structural blocks and content blocks
Each theme contains structural and content blocks. Structural blocks are the ones that lay out the theme into sections. Let’s take a look at a three-column layout.
The following are the structural blocks in a three-column layout:
• header
• left
• content
• right
• footer

Structural blocks and content blocksEach theme contains structural and content blocks. Structural blocks are the ones that lay out the theme into sections. Let’s take a look at a three-column layout.The following are the structural blocks in a three-column layout:• header• left• content• right• footer
MAGENTO TEMPLATE ARCHITECTURE

Inline Translation In Magento

System > Configuration > Select your site > Developer tab > Translate Inline
A common query that people are bringing up on the Magento forums is regarding finding the templates in order to edit your Magento theme – the FTP folder hierarchy makes this challenging to say the least! This can easily be solved by going into your Admin area and clicking System > Configuration > Select your site > Developer tab > Template Path Hints (change to Yes).   If you action this, you’ll then see what templates are populating your Magento site by visiting your home page – every different template that makes up your site is highlighted and the path is named for you… saves lots of messing about!
However – another handy tip, on the same section of your Admin, why not enable ”Translation Inline”.  This feature is even better, as you can literally edit the text “live” on your web-site, which means you don’t even need to FTP in and find the theme, you can simply change the textual elements of the site via your browser!  Now doesn’t that make it easier!

Magento Backup Using phpMyAdmin

The most common back up solution is phpMyAdmin, and some people prefer it over any built-in method. To export via phpMyAdmin, we:
1. Navigate to the database
2. Switch to the export tab
3. Select all tables and SQL as the export type
4. Under options on the right-hand side select Disable foreign key checks
5. Select save as file at the very bottom of the page
6. If we want to match the compression type of Magento’s output, select gzipped as our compression method
7. Click the Go button to export

This will give us an SQL file, which we can then import at a later date back into an empty database and restore our data.

To restore data from phpMyAdmin there can be some error occure. To avoid such error we can add following code in my sql file.

Add this code at the beginning of our sql file:

SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;

SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;

SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;

SET NAMES utf8;

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’;

SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;

At the end of the file, add the statements required to turn on constraint checking again:

SET SQL_MODE=@OLD_SQL_MODE;

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;

SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;

SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;

SET SQL_NOTES=@OLD_SQL_NOTES;

With these modifications, you should be able to restore your database from a .sql file backup created with any tool.

If you have similar problems installing the sample database, just add the same statements to the .sql file containing the sample data.