понедельник, 25 февраля 2013 г.

Optimising Magento for Performance


Following our earlier entry about installing Magento Enterprise, we thought it would be appropriate to follow up with some tips for getting more from your Magento installation. One of the major criticisms leveled at Magento is its speed; many complain that it is far too slow. In this article we'll go through some steps you can perform to fine-tune your server to allow Magento to run more smoothly and more quickly in a production environment. Our examples are geared at a Debian-based LAMP stack, but most can be adapted for other platforms.


вторник, 19 февраля 2013 г.

Magento robots.txt




Magento robots.txt
Magento robots.txt
Magento comes without robots.txt functionality. It can be useful to add one yourself to tell the search engines where they are not allowed to index. It will hide your javascript files, hide SID parameters and prevent some duplicate content. It will help your SEO process and reduces resources on your server. In this blogpost I explain you how to set your own Magento robots.txt using an existing example and using an extension. Both solutions are easy to handle.

Import/Export Large MYSQL Databases

When working with MYSQL I often use phpMyAdmin, which is a nice GUI way to manipulate my database. But some operations won't work in phpMyAdmin when the database is too large. In particular, you can't import or export really large databases using phpMyAdmin. So sometimes you need to do things on the command line.

So I thought I'd document some of the command line snippets we use frequently. In the following, replace [USERNAME] with your mysql username, [DBNAME] with your database name, [/path_to_file/DBNAME] with the path and name of the file used for the database dump, and [/path_to_mysql/] with the path to mysql bin (like /Applications/MAMP/Library/bin/).

Copy/Export a Large Database

MYSQL has no 'Copy' function. You create a copy by dumping the database with mysqldump.
To dump the database and gzip it at the same time, use the following. This will prompt you for your password.

mysqldump -u [USERNAME] -p [DBNAME] | gzip > [/path_to_file/DBNAME].sql.gz

Import a Large Database

If you want to replace the database with a fresh dump created by the above process, do the following.
First, unzip the file.

gzip -d [/path_to_file/DBNAME].sql.gz
Get to a mysql prompt (you will be asked for your password.)

[/path_to_mysql/]mysql -u [USERNAME] -p
Then do the following to wipe out the old database and replace it with the new dump:

SHOW DATABASES;
DROP DATABASE [DBNAME];
CREATE DATABASE [DBNAME];
USE [DBNAME];
SOURCE [/path_to_file/DBNAME].sql;

Conditional Dumps

Sometimes the search index is huge and you want to omit it from the dump. Do so with:

mysqldump -u [USERNAME] -p [DBNAME] --ignore-table=[DBNAME].search_index | gzip > [/path_to_file/DBNAME].sql.gz
There are actually a number of tables you could exclude, like the sessions table, the watchdog table and all the cache* tables.
But if you use the above technique to destroy and recreate the database after doing this, you will be missing all those excluded tables. So you will want to do a two step process instead:
First, create a backup with ONLY the table information, no data.

mysqldump -u [USERNAME] -p [DBNAME] --no-data | gzip > [/path_to_file/DBNAME].info.sql.gz
Then create a backup, including only data from the tables you need.

[path_to_mysql/]mysqldump -u [USERNAME] -p [DBNAME]  --no-create-info --ignore-table=[DBNAME].search_index --ignore-table=[DBNAME].cache --ignore-table=[DBNAME].cache_block --ignore-table=[DBNAME].cache_content --ignore-table=[DBNAME].cache_filter --ignore-table=[DBNAME].cache_form --ignore-table=[DBNAME].cache_menu --ignore-table=[DBNAME].cache_mollom --ignore-table=[DBNAME].cache_page --ignore-table=[DBNAME].cache_pathdst --ignore-table=[DBNAME].cache_pathsrc --ignore-table=[DBNAME].cache_views | gzip > [/path_to_file/DBNAME].data.sql.gz;
Well that's a lot of typing. Wouldn't it be nice if there was a wildcard we could use instead of typing out all those cache_ tables? Well there is!! You can do:

[path_to_mysql/]mysqldump -u [USERNAME] -p [DBNAME]  --no-create-info --ignore-table=[DBNAME].search_index --ignore-table=[DBNAME].cache% | gzip > [/path_to_file/DBNAME].data.sql.gz;
After doing this, just import the two files as above, first the one with only the table info, and then the data. Result, a (relatively) small database with all the optional tables emptied out.
Note that the wildcard trick above is not documented anywhere that I can see, so you'll want to test that it works in your setup.

Источник 

вторник, 8 января 2013 г.

Magento аттрибуты

Отображение атрибутов на странице списка товаров

Было:
Изображение

Стало:
Изображение



четверг, 27 декабря 2012 г.

Zend Router

resources.router.routes.news.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.news.route = "news/(.*)\.html"
resources.router.routes.news.defaults.controller= "news"
resources.router.routes.news.defaults.action= "index"
resources.router.routes.news.defaults.name = "none"
resources.router.routes.news.map.1 = "name"
resources.router.routes.news.reverse = "news/%s.html"

разберем построчно
с 1ой строкой все понятно;
во 2ой задается регулярное выражение;
3,4,5 настройка контроллера, экшена и значения переменной name по умолчанию;
6 (предпоследняя) маппинг параметров у нас здесь один параметр и он будет присвоен переменной name;
7ая строка при генерации ссылок через вью хэлпер url будет использоватся это выражение.
 







resources.router.routes.id.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.id.route = "articles/(\w+)"
resources.router.routes.id.defaults.module = default
resources.router.routes.id.defaults.controller = articles
resources.router.routes.id.defaults.action = id
resources.router.routes.id.map.1 = "id"
resources.router.routes.id.reverse = "articles/%s"
Вы укажете Zend Framework при переходе на страницу типа articles/5 определить 5 как id.
Получить значение Вы можете розместив в action:


$this->getRequest()->getParam('id');
Zend router можно реализовать и в другом формате:








resources.router.routes.articles.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.articles.route = "articles/tag/(\w+)"
resources.router.routes.articles.defaults.module = default
resources.router.routes.articles.defaults.controller = articles
resources.router.routes.articles.defaults.action = tag
resources.router.routes.articles.map.1 = "tag"
resources.router.routes.articles.reverse = "articles/tag/%s"
Тут, соотвественно, данные будут в articles/tag/zend.
 

пятница, 23 ноября 2012 г.

пятница, 16 ноября 2012 г.

Перенос сайта WordPress на новый домен

14 октября 2007 г. Главная WordPress
Иногда может возникнуть ситуация, когда необходимо сайт, работающий на движке WordPress, перенести на новый домен. Т.е. суть данного действа заключается только в изменении имени домена, все содержимое же, равно как и структура ссылок, остается прежним. При этом не маловажный момент - сохранение показателей тИЦ и PR.
К данному вопросу необходимо подходить с полным пониманием дела, ибо обратное может быть чревато неприятными последствиями.