How to Fix the Most Common Magento Issues

Common Magento Issues

Magento is a powerful platform but like pretty much everything in the Universe, it has some narrow spots you may face during the acquaintance with this platform. We’ve collected the most common Magento issues and their solutions to make your life easier.


1. How to set up Magento website on a new domain

2. How to deal with “Access Denied” issue

3. How to reset/change Magento admin password

4. How to add Contact form in Magento

5. Prevent Magento from logging you out too soon

6. How to change Magento Admin URL

7. How to get rid of 503 error

8. How to create SEO Friendly URLs in Magento

9. How to set up a blog in Magento

10. How to make Magento open through WWW

11. Disable admin notifications in Magento

12. Remove “.html” from Magento URLs

13. How to create 301 redirects

14. How to disable the “Compare products” functionality

15. How to create a custom user group and assign a discount

16. How to switch off Magento extension

17. Magento categories are not showing on the frontend


1. How to set up Magento website on a new domain

In order to set up Magento site on a new domain, you need to do two things:

1) Edit database settings

Go to the cPanel-phpMyAdmin, select your Magento database from the left menu and find the table core_config_data. Click on it and find two fields: web/unsecure/base_url and web/secure/base_url. Click the pen icon and replace the old domain with a new one for both of them. Click the Go button to save changes.

2) Clear cache

Find the cache folder at Magento installation directory – /var/cache and delete its content.

Note: if you delete the entire folder, you may lose the .htaccess file.

2. How to deal with “Access Denied” issue

To solve an “Access Denied” issue, you need to log out from Magento admin panel and then log back in. Then go to System > Permissions > Roles > Administrators and make sure that Resource Access is set to All. Now click Save Role button and the issues will be fixed.

3. How to reset/change Magento admin password

a) To reset or change the password you need to navigate to phpMyAdmin, select the corresponding database and find admin_user table. Here you can replace the old password with a new one. Make sure your password is in a MD5 function.

Note: Please don’t do that on your live environment! Simple MD5 function is not secure enough.

b) The other way to change the password is to insert the following MySQL query into SQL tab:

UPDATE admin_user SET password = CONCAT(MD5('xxNewPassword'), ':xx') WHERE username = 'UserName';

The ‘xx’ characters is a cryptographic salt. They can be whatever you want but make sure they are the same in both parts of the query. This is more secure than the first variant.

If you have a clean dev/test environment and you want to add a new admin user from scratch, please do the following MySQL queries. It is also useful for updating existing users, e.g. reactivating them and setting a new password.

#Creating new admin user or updating existing one by username
INSERT INTO admin_user
 (email, username, password, is_active)
VALUE
 ('example@email.com','magento', (SELECT MD5('password')), 1)
ON DUPLICATE  KEY UPDATE
 username = 'magento', password =(SELECT MD5('password')),is_active=1;
# Creating default admin-user group if not existing. Necessary on clean installation – there’s no Administrators group, thus no permissions can be granted to admin user
INSERT IGNORE INTO admin_role
   (parent_id,tree_level,sort_order,role_type,user_id,   role_name)
VALUES (
       0,        1,        1,          'G',      0,    'Administrators'
);
# Creating our account to access all things in admin panel
INSERT INTO admin_role
   (parent_id,tree_level,sort_order,role_type,user_id,role_name)
VALUES
(       1,        2,          0,        'U',
   (SELECT admin_user.user_id FROM admin_user WHERE username = 'magento'),
   'Super User'
);

4. How to add Contact form in Magento

Contact form is a default Magento feature and, if enabled, there will be a link to it in the footer. But of course you can add it to any page you want. To do so, log in to the Magento admin area, go to CMS-Pages, select the page you want to edit (or add a new one) and add the following code:

<!– CONTACT FORM CODE BEGIN–>
{{block type='core/template' name='contactForm' template='contacts/form.phtml'}}
<!– CONTACT FORM CODE END–>

Click Save Page and the contact form will appear on that page.


magento contact form

5. Prevent Magento from logging you out too soon

This one is very easy to solve. Go to System – Configuration – Web – Session Cookie Management – Cookie Lifetime and set the duration to whatever you need.


magento cookie lifetime

You also need to change this setting in php.ini – session.gc_maxlifetime and restart the server. Otherwise the change in Magento admin may not have any effect.

6. How to change Magento Admin URL

To change default Magento URL (/admin/), navigate to app/etc/ and open local.xml file. Find the code:

<admin>
    <routers>
        <adminhtml>
            <args>
                <frontName><![CDATA[admin]]></frontName>
            </args>
        </adminhtml>
    </routers>
</admin>
And change the “admin” value.

Clear Magento cache, test if new URL is working and make sure that an old one returns 404 code.

7. How to get rid of 503 error

In most cases, to solve this, go to your Magento root installation, find a maintenance.flag file and delete it. If this didn’t work, clear the cache and sessions and try again.

8. How to create SEO Friendly URLs in Magento

To get SEO friendly URLs, so it’s /red-roses.html rather than catalog/product/view/id/12345, you should navigate to System-Configuration.


magento seo friendly urls 1

Then select Web from the left navigation menu, set Use Web Server Rewrites to Yes and click Save Config.


magento seo friendly urls 2

9. How to set up a blog in Magento

Magento doesn’t have a Blog functionality out-of-the-box so you need to use an extension to add it. You can search Magento Marketplace or Magento Connect for a proper one. If you don’t want to spend time searching, try Blog extension from Aheadworks.

Installing blog extension is similar to the general extension installation process in Magento. See this guide.

After installation, you’ll have an additional section in the top Menu of Magento admin panel called Blog. You can edit settings and add new blog posts from there.

10. How to make Magento open through WWW

According to the SEO best practices, you website should resolve to one URL. And usually it’s WWW version.

To make your Magento website open through WWW, you need to access .htaccess file which is located in the Magento root. Then search RewriteEngine and insert the following just below:

    RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

Save the .htaccess file, login to your Magento Admin and navigate to System > Configuration > Web. Unfold the Unsecure tab and change the base URL to http://www.yourdomain.com instead of http://yourdomain.com.


magento www version

Click Save Config and your Magento store will start working through http://www.yourdomain.com.

11. Disable admin notifications in Magento

Go to Configuration – Advanced – Advanced and disable Mage_AdminNotification.


disable magento admin notification

12. Remove “.html” from Magento URLs

To remove .html from your URLs, go to System – Configuration – Catalog – Search Engine Optimizations and remove .html from Product URL Suffix and Category URL Suffix.


remove html from urls in magento

Then go to System – Index Management and reindex all data. Also, don’t forget to flush the cache.

13. How to create 301 redirects

Go to Catalog – URL Rewrite Management and click Add URL Rewrite.

Select Custom from the Create URL Rewrite menu and fill the fields:

ID Path: enter the old URL (don’t enter the full path. If the URL is example.com/old-url.html, you need to put just old-url.html)

Request Path: repeat the old URL again

Target Path: enter the new URL

Redirect: Choose Permanent (301)

Save the changes and check if the redirect works.

14. How to disable the “Compare products” functionality

To disable compare functionality, go to your Magento root folder, find app/code/core/Mage/Catalog/Helper/Product/Compare.php and replace:

public function getAddUrl($product)
{
return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product));
}
With
public function getAddUrl($product)
{
//return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product)); return false;
}

Now you need to find and edit /app/design/frontend/base/default/layout/catalog.xml. Don’t forget to use your theme name if you are not using a default one./

Find the code”

<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
And replace it with
<!-- <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" 
template="catalog/product/compare/sidebar.phtml"/> -->

Once done, clear the Magento Cache from admin area – System – Cache Management.

15. How to create a custom user group and assign a discount

To add a new custom user group, login into Magento admin panel and navigate to Customers – Customer Groups. Click Add New Customer Group and fill the required fields.

new customer group

To change the Group for a particular customer, go to Customers – Manage Customers. Navigate to Account Information, select the Group and click Save.

change customer group

You can also assign customers to groups in bulk.

change customer group bulk

If you need to create a discount for certain Customer Groups, go to Promotions – Catalog Price Rules – Add New Rule. Fill the necessary fields, pick the customers’ group for which the promotion is valid and click Save.

discount for customer group

16. How to switch off Magento extension

The easiest way it to navigate to System > Configuration > Advanced > Disable modules output and change the status to Disable and click Save Config. This solution is preferred and works in the majority of cases.

If this didn’t help, you can edit XML file of the certain module. To do so, go to app/etc/modules and find the right XML file. There you should find a line true. Change it to false, save the file and clear cache.

If you couldn’t find such line, there is one more way to turn off Magento extension quickly. Go to app/etc/modules, find the XML file you need and rename it. If it was random_extension.xml, rename it to abc_extension.xml.off and clear the cache.

17. Magento categories are not showing on the frontend

There may be several reasons for that. First of all, make sure that all your categories are placed inside the default category. Also, Is Active and Is Anchor (in Display Settings tab) should be set to Yes.

magento categories

Second, check if the Root Category is specified correctly.

correct root category

Lastly, you may need to Refresh Cache (System – Cache Management).

Enjoyed this post? Spread it to your friends!

Oleg Yemchuk

Oleg Yemchuk

 

Oleg Yemchuk is a SEO Manager at MavenEcommerce sharing office space with Magento business experts in NYC and software developers worldwide. Oleg is SEO expert by day, and geek by night. Favorite pastime: traveling in TARDIS.