Archive for the ‘Tutorial’ Category
After sharing the solutions on the magento forum, I thought I would blog it so one day or the other it might be useful to someone.
I would try to post it regularly on these kind of problems
1. Unable to login into admin after installation
If you are using Magento 1.4 then look into the following path
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
Find the following lines:
// session cookie params
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()/*,
'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()*/
);
if (!$cookieParams['httponly']) {
unset($cookieParams['httponly']);
if (!$cookieParams['secure']) {
unset($cookieParams['secure']);
if (!$cookieParams['domain']) {
unset($cookieParams['domain']);
}
}
}
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}
Replace it with the following
// session cookie params
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()/*,
'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()*/
);
/*if (!$cookieParams['httponly']) {
unset($cookieParams['httponly']);
if (!$cookieParams['secure']) {
unset($cookieParams['secure']);
if (!$cookieParams['domain']) {
unset($cookieParams['domain']);
}
}
}
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}*/
You would be able to login into your admin panel. By doing so it would work with your local development server. What we are doing is simply commenting out the code which doesn’t allow localhost or anything that is not a domain.
2. How best to clear cache:
In magento another major problem users face is they don’t know how to clear their cache.
Follow these steps carefully:
1. Backup your cache directory if in case you need it, its located at
var/cache/*
2. Delete all folders inside the var/cache/ folder, don’t delete the cache folder instead delete all folders inside the cache folder.
If you are using mangeto versions prior to 1.4 then you should adapt one more step too.
3. Backup app/etc/use_cache.ser, I mean you can also rename the file to app/etc/use_cache1.ser
4. Delete the app/etc/use_cache.ser file
5. Reload the magento in a new browser and you would be able to clear cache.
Everyone know that magento is one of a great ecommerce application. what really concerns one from using magento is the speed. I tried to get the performance increase by 265 times faster. I used the http://www.freespeedtest.com/ to check the loading time. We checked it against one of our theme at its PECoin.
The loading time before the .htaccess is 8 secs and after the modification it was on an average 2.6 secs.
I tried to explain things but I know you wanted some code to be pasted in your .htaccess.
Ok here we go:
Find the following lines from your .htaccess on magento root folder and replace it with the following:
############################################## enable apache served files compression## http://developer.yahoo.com/performance/rules.html#gzip# Insert filterSetOutputFilter DEFLATE# Netscape 4.x has some problems…BrowserMatch ^Mozilla/4 gzip-only-text/html# Netscape 4.06-4.08 have some more problemsBrowserMatch ^Mozilla/4\.0[678] no-gzip# MSIE masquerades as Netscape, but it is fineBrowserMatch \bMSIE !no-gzip !gzip-only-text/html# Don’t compress imagesSetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary# Make sure proxies don’t deliver the wrong contentHeader append Vary User-Agent env=!dont-vary##############################################
—————————
Now on to explanation:
SetOutputFilter DEFLATE
It tells apache to compress the response before the response is been sent over network.
Credits:
More over I did tried it from reading at http://httpd.apache.org/docs/2.0/mod/mod_deflate.html and thanks to inchoo for their blog post.
I see quite often people ask us more detail on how to install a magento theme. Be it a free theme downloaded in the internet or be it a premium theme. Premium theme comes along with the installation procedures. We do have a crisp install procedure which is just 1 and 1/2 half page. Back to the the topic. Please do the following procedure on installing a magento theme.
There are 2 main folders that you need to aware of. 1. App, 2. Skin
App folder contains the template structures of the theme.
Skin folder contains the css, images etc.,
The template is located at magento_folder/app/design/frontend/default/
- Unzip the theme and you should find app and skin folders seperate on unzipping.
- Please find the theme name inside the app folder or if the theme name is default then ensure this is the path were you need to upload it to your magento installation folder. magento_folder/app/design/frontend/default/yourtheme
- Find the skin folder in the theme and upload it to the following path.magento_folder/skin/frontend/default/yourtheme
- Once the folders are uploaded, get into the admin panel
- System->Design, click on “Add design change” button. Select your store to which you wanted to roll out the new theme in the “Store” field.
- Select the new theme name from the available drop down in the “Custom design” field.
- Click on “Save“.
Please note you can also instruct magento to keep the new theme for a fixed time lime, if you want to keep the new theme for a fixed time line, select the Date from and Date to.
- Please let us know if in case you find any problem in installing a new theme.




