Saturday, 4 May 2013


Google Analytics is a free Google service which allows the webmasters and web site administrators to monitor their web sites' traffic and conversion ratio.
Magento supports two types of tracking:
  • Page View Tracking: Lists the origin from which your web store visitors linked to your store.
  • E-commerce Tracking: Lists the customers that make purchases and what they buy.
First you need to sign up at http://www.google.com/analytics/sign_up.html. You will receive a Google Analytics account number. Write it down since you will need it for the Magento configuration.
Then configure the Google Analytics tracking in Magento. Open the Magento Admin area and navigate to System->Configuration->Sales->Google API.
Expand the Google Analytics section.
Google API
Pick the Yes option from the Enable drop-down menu. Enter the Google Analytics account number in the Account numberfield. Click on the Save Config button.



Magento Move / Magento Transfer


This tutorial provides detailed information on how to move a Magento store from one host to another (or to a different hosting account).

MySQL database backup

On SiteGround servers you have phpMyAdmin included by default in cPanel for your account. In other cases you will have to use the same tool or a similar one that is capable of exporting your MySQL database. Detailed information on how to perform a MySQL backup can be found in our MySQL Tutorial.
Alternatively, if you don’t have phpMyAdmin installed but you have shell access you can use the mysqldump tool. The syntax is as follows:
mysqldump -h HOST -u USER -p DATABASENAME > FILENAME.sql
where:
HOST is the database server hostname or it can be omitted if you are running the MySQL server locally
USER - a user with full privileges to the Magento database
DATABASENAME - is the full name of the database which Magento is running
FILENAME - can be anything you find suitable for the backup file
Also, if you have Plesk, DirectAdmin or any other web hosting management tool, you can look at the available options. Many panels allow you to dump the database with just a few clicks. For example cPanel does have an option for this.

Transfer Files


You will need to download all files from your current store and upload them to the new location. This can be a time consuming task considering that a standard Magento installation consists of many files. A good alternative is to archive the files prior to downloading/uploading them if possible.
If you have SSH access you can log on your server -> magento installation directory and archive all the files using the following command:
tar -czif ARCHIVENAME.tar.gz
This will create a tarball archive of all the files in the directory.
You can then download the archive and easily upload it to the new location. To extract it at the new location use the following command in the desired destination folder for the Magento installation:
tar -xzif ARCHIVENAME.tar.gz

Adjust Configuration

After the files are restored you should alter the configuration file in order to match the new settings. All you need to change here is the database details at the new location. Those are stored in the app/etc/local.xml file. The lines you need to alter are:
<host><![CDATA[HOSTNAME]]></host>
<username><![CDATA[USER]]></username>
<password><![CDATA[PASSWORD]]></password>
<dbname><![CDATA[DATABASENAME]]></dbname>

where:HOSTNAME should be the database hostname, most commonly - localhost
USER is a user that has full privileges to the database
PASSWORD is the password for the database user
DATABASENAME is the complete database name for the database you are going to use with the transferred Magento

Restore Database

Once you have adjusted the options above you should restore the database at the new location.
A good practice is to add several options in the MySQL backup file prior to uploading it. The following should be added at the beginning of the SQL file:
SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;
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;
The next option should be added at the end of the file after all other queries:
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;
You can now import the database using phpMyadmin -> Import or another MySQL tool depending on what kind of access you have to the website.
In case you would like to restore the database via a shell command you can use the following:
mysql -h HOST -u USER -p DATABASENAME < FILENAME.sql
and enter the password for the database user when asked.
Note that if the Magento online store is supposed to work with a different domain name at the new location you should alter the entries for it in the MySQL database.
The table you should edit is core_config_data and the values you need to change are in the path column. Change theweb/unsecure/base_url and web/secure/base_url to match the new domain name by altering the value column for both records.
The last step is to clear the Magento cache. You can do this either via the Magento admin panel > System > Cache management or by deleting the contents of the var/cache and var/session folders inside your Magento installation directory.
That is all. Your Magento should now be properly functioning at the new location.


Shipping and Payment methods in Magento

You can configure the shipping and the payment methods for your script through the admin area -> System -> Configuration -> Sales:
shipping methods
payment methods
In this tutorial we will illustrate how to enable the USPS shipping method and the credit card payment method. 

Before enabling the shipping method you should configure the shipping settings:
shipping settings
The fields there are self-explanatory.

Once you are ready, click on the Shipping Methods -> USPS link:
usps
Enable the shipping method, enter the Gateway URL and the UserID. The next options allow you to describe the packages which you need to be delivered.
Then you can define the handling fee. It can be fixed or calculated on the percent basis. After this you can pick the allowed delivery methods. You can configure a free shipping method and define whether there is a minimum purchase sum for it.
At the end you can define the countries for which the shipping is supported and the default error message in case the service is refused.

The credit card payment method can be configured through the Payment Methods -> Saved CC section:
credit card
Enable the method, enter its name, set the new order status, pick the supported credit cards, decide whether the credit card verification is required, define from which countries to accept payments and the range of the accepted payments.

SiteGround is the best Magento host because:
  • We have long experience with Magento;
  • Our servers are perfectly optimized for Magento;
  • Our Magento hosting package is the best offer on the market - it has the lowest price for the quality and features it includes;
If you don't have a Magento yet, you can sign-up for our Professional Magento Hosting and get a FREE Magento installation!

Common issues with importing/exporting

You can learn how to import your products in Magento by following the corresponding part of our tutorial:
How to Import Products in Magento
However, during the import and the export procedures different issues can occur.
The most common ones are as follows:
• Incorrect CSV file formatting - A bad formatting of a CSV file can cause a failed data import or missing rows after the import. The issue occurs more often with CSV files created with MS Excel since CSV is more prone to data failures due to bad formatting.

• Issues with short descriptions - Although you can use a custom size for short descriptions in Magento, it is recommended that you limit them to 255 characters.
• Issues with import/export paths - The import/export paths should be writable. Otherwise, the corresponding procedures will fail. More details on how to set the files and folders permissions can be found in our cPanel tutorial.
• Problems with images locations - If we import images with the products, they should be stored in the /media/import folder. Otherwise error messages will be displayed and the images will not be imported. For example, if the value of the image collumn is /image_subfolder/image.jpg then the correct path will be /media/import/image_subfolder/image.jpg.
• Problems with multiple images import - The import of multiple images through CSV and MS Excel image, small image and thumbnail image columns is causing problems.


Magento Files and Folders Structure

This part of the Magento tutorial will provide detailed information regarding the Magento's default files and folders structure.
You will learn more about the functions of main files and folders included in the Magento package.
The files and folders included in the main directory are as follows:
• .htaccess - contains mod_rewrite rules, which are essential for the Search Engine Friendly URLs. There you can also find standard web server and php directives that can improve your web site performance.

• .htaccess.sample - this is a backup of the .htaccess file. If you modify .htaccess it can be used in order to get the default settings.

• 404 (directory) - The folder stores the default 404 template and skin for Magento.

• app (directory) - This folder contains the modules, themes, configuration and translation files. Also there are the template files for the default administration
theme and the installation.

• cron.php - a Cron Job should be set for this file. Executing of the file on a defined time period will ensure that the complicated Magento caching system will not affect the web site performance.

• downloader (directory) - This is the storage of the web downloader files. They are used for the installation and upgrade of Magento through your browser.

• favicon.ico - the default favicon for Magento. A small icon that is shown in the browser's tool bar once your web site is loaded.

• index.php - the main index file for Magento.

• index.php.sample - A backup of the default index file. It can be used to revert the changes in a case of a index.phpmodification.

• js (directory) - Contains the pre-compiled libraries of the JavaScript code included in Magento.

• lib (directory) - The Magento core code is located in this folder. It contains the software's PHP libraries.

• LICENSE_AFL.txt - The Academic Free License under which the Magento software is distributed.

• LICENSE.txt - The Open Software License under which the Magento software is distributed.

• media (directory) - This is the storage of the Magento media files - images out of the box, generated thumbnails, uploaded products images. It is also used as a container for importing images through the mass import/export tools.

• mage (in versions older than 1.4.2.0 this tool was called pear)- The file controls the automatic update through the downloader script and SSH. It handles the update of each individual Magento module.

• php.ini.sample - This file contains sample php directives that can be used in order to modify your PHP setup. If you want to alter the default setup edit the file and then rename it to php.ini.

• pkginfo (directory) - Contains files with information regarding the modules upgrades' changes.

• report (directory) - This folder contains the skin of the Magento errors reports.

• skin (directory) - There are located the themes files - images, JavaScript files, CSS files, Flash files. Also there can be found the skin files for the installation of skins and administration templates.

• var (directory) - Cache, sessions, database backups, data exports and cached error reports can be found in this directory.

If you want to modify an existing template or set a new one you should know that the template files are separated in 3 folders:
• /app/design/frontend/default/YOUR_TEMPLATE_NAME/layout/ - Contains the .xml files that define which modules should be called by the template files and loaded in defined areas on the site.
• /app/design/frontend/default/YOUR_TEMPLATE_NAME/template/ - Contains files and subfolders that structure the final output for the users using the functions located in the layout/ folder.
• /skin/frontend/default/YOUR_TEMPLATE_NAME/ - Contains the CSS, images, JavaScript and Flash files related to the template.

0 comments:

Post a Comment