‘Magento’ Archives

Setting up a Magento Site on Localhost

Recently, I wiped my main drive to do a completely fresh installation of OSX. I have a site that I work on for a client that uses Magento as the content management system (www.chouchoute.co.uk) and for development purposes, I set up a mirror of the site on my localhost. I use MAMP for local development, but WAMP (Windows) or LAMP (Linux) will do just as well. You need a working system to proceed…

(more…)

Add Google Analytics or StatCounter code to Magento Sites

A lot of people want to add Google Analytics and StatCounter javascripts to their Magento sites, but don’t know where to add the code.

I find the best place is to go to CMS > Static Blocks > Footer Links and add them there.

In some cases however (older versions of Magento perhaps), you may be better off editing the footer.phtml file in the app > design > frontend > default > currenttheme > template > page > html folder.

Google Analytics also needs to be enabled in Magento. To do this, first find the Web Property ID of the Google Analytics profile. This is right on the first page of your site’s profile, next to your domain name and starts UA… Copy it, then go to the Magento admin interface, then System> Configuration> Google API> Google Analytics. Change Enable to Yes and paste in the Web Property ID. Save the changes and hopefully, that’s it.

Magento – Access Issues on localhost

Following my earlier post on Setting Up Magento on OSX, I recently upgraded to the latest version of Magento (ver 1.3.2.1) and ran into access problems with a development site.

Firstly, make sure you have a .htaccess file in your root folder! Secondly, the use of www.localhost.com seemed to be an issue. Setting the url to http://localhost/mywebsite/ in the core_config_data table and commenting out my previous new line (127.0.0.1    http://www.localhost.com/mywebsite) in my private/etc/hosts file fixed the problem.

Can’t login to new Magento installation…

If you find yourself unable to login to your newley-installed Magento admin area, you may want to try this:

Open the file Varien.php in a text editor. You will find the file in app > code > core > Mage > Core > Model > Session > Abstract > Varien.php.

Go to somewhere around line 75 and comment out these lines:

/* set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);
*/

Save the file and try logging in again. (This tip came off the Magento forum and has helped me more than once so I thought I’d share it!)

Working with Magento on a local development site

This is something that has saved me a few headaches: if you are working in a local test version of Magento and have a live site open too, on another tab perhaps, switching between the tabs can get confusing…

Simple solution: create unique favicons to help you quickly and visually identify which tab is the local site and which is the live one.

Setting up Magento on Mac OSX

There have been plenty of posts dotted around the Magento community helping to get a local testing version of Magento set up on your machine, but here is a quick tip (as a reminder to me too!) Try this installation guide for a quick start. Once you have got Magento installed, you can download all the site files for your store via ftp and install the database.

Next, open up your /private/etc/hosts in a text editor. (I use Text Wrangler from Barebones software). You can get at it by going to File > Open Hidden… and navigating to your main Macintosh HD drive.

Edit the file so it looks something like this:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost
fe80::1%lo0    localhost

# my websites
127.0.0.1    www.localhost.com
127.0.0.1    http://www.localhost.com/magento
127.0.0.1    http://www.localhost.com/mywebsite

Once you have done this, you will need to edit your store database to reflect this. Go to the database and do a wildcard search (%mywebsite%) on the core_config_data table.

Edit both the web/unsecure/base_url & web/secure/base_url fields so the value is:

http://www.localhost.com/mywebsite/ making sure the trailing forward slash is there!

Restart MAMP and you’re good to go, using your new url to check out your site.