How to fix common Magento issues

header-how-to-fix-common-magento-issues

Good day to Amasty blog readers!

Our support team consists of four managers now, and every day they answer hundreds of questions not only about Amasty extensions, but also on Magento itself. We collected some of the most frequent questions and answered them; we do hope that this small knowledge base will help people that have just started working with Magento.

How to make Magento work on a new domain name

  1. Change database settings

Go to any tool that you use to access your database, go to core_config_data and change the first two fields (web/unsecure/base_url and web/secure/base_url) by replacing your old domain with the new one.

  1. Clear cache

Go to /var/cache and clear the folder.

How to change admin password in Magento

Go to PhpMyAdmin, choose Magento database, and paste this query to the SQL tab:

UPDATE admin_user SET password=CONCAT(MD5('sGnewpass'), ':sG') WHERE username='Admin';

Newpass and Admin must be changed by the new password and the admin user name accordingly. Click Go to apply the changes.

How to Create 301 Redirects for Magento

Go to Backend – Catalog – URL Rewrite Management. Click Add URL Rewrite button. Choose Custom from the Create URL Rewrite menu.

You’ll see the URL Rewrite Information form. Fill it in:

ID Path: enter the old URL. For instance, if you’re going to redirect site.com/page1.html, then enter page1.html in this field.

Request Path:  enter the old URL again.

Target Path: enter the new URL. Again, if the new URL will be site.com/page2.html, use page2.html only.

For Redirect choose Permanent (301).

You don’t have to fill the Description field in.

Save the changes, then go to your old page and check if the redirect is working as you want it to.

How to add a contact form in Magento

Magento has a contact form feature by default, and if it’s enabled, you’ll have a link to it in your footer. But what of you need to place your contact form on a particular page?

Make use of this code. Remember that you have to paste it using the HTML option when editing the CMS page.

<!– CONTACT FORM –>
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
<!– END OF CONTACT FORM –>

Or, you can use any Custom Form extension, such as the one from Amasty.

How to change Magento admin URL

Changing your admin URL is a matter of security. This method is more about security by obscurity, but can be useful as additional means of fighting against bots and brute force attacks. To change backend URL, edit app/etc/local.xml (admin / routers / adminhtml section).

<admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[your-secure-location]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
We do not recommend changing the default admin URL using the native interface of the Magento admin panel.

Make sure the new URL is quite hard to guess. You also might want to clear your cache after these steps.

Then check your new URL and make sure that the old URL returns 404 error page.

Get rid of .html in Magento URLs

Magento adds .html to category and product URLs by default. If you want to remove it, go to Backend – System – Config – Catalog – SEO tab, then delete .html from Product URL and Category URL suffixes.

Now, go to System – Index Management and reindex all data, plus clear your cache.

How to disable the product comparison feature in Magento

If you don’t want to use the product comparison feature, follow these steps:

1. Find and edit app/code/core/Mage/Catalog/Helper/Product/Compare.php file.

2. Find this piece of code:

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

And replace it by:

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

3. Find and edit /app/design/frontend/base/default/layout/catalog.xml. Don’t forget to use your Magento theme name instead of the default one.
4. Find this piece of code:

<block type=”catalog/product_compare_sidebar” before=”cart_sidebar” name=”catalog.compare.sidebar” template=”catalog/product/compare/sidebar.phtml”/>

And replace it by:

<!– <block type=”catalog/product_compare_sidebar” before=”cart_sidebar” name=”catalog.compare.sidebar” template=”catalog/product/compare/sidebar.phtml”/> –>

5. Clear your cache.

500 Internal Server Error on Magento backend/frontend after turning compilation on

Go to Magento installation root and edit includes/config.php.

You’ll have one line uncommented and one commented out. Make it viсe versa: comment the first one out and uncomment the second one:

define('COMPILER_INCLUDE_PATH',

dirname(__FILE__).DIRECTORY_SEPARATOR.'src');

#define('COMPILER_COLLECT_PATH',

dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

That’s how it should be after your manipulations.

#define('COMPILER_INCLUDE_PATH',

dirname(__FILE__).DIRECTORY_SEPARATOR.'src');

define('COMPILER_COLLECT_PATH',

dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

503 Service Temporarily Unavailable error for no reason

If you have 503 message in your browser and can’t access fronted or backend, go to your Magento root installation, find a maintenance.flag file and delete it. Sometimes Magento just won’t come out of maintenance mode. If this doesn’t help, delete your cache and sessions and try again.

How to disable Magento admin notifications

Magento backend notifications can be pretty annoying, but you can turn them off really quick. Go to Backend – Configuration – Advanced – Advanced and disable Mage_AdminNotification.

Magento categories are not showing on the frontend

This is a very common question from those who have just installed Magento and are setting everything up. All categories must be placed inside the default category. To ensure this is correctly done click on the default category section at Backend – Manage Store, and then click Add subcategory. Make sure that Is Active and Is Anchor settings are enabled.

How to stop Magento from logging me out too soon

By default Magento has a very short cookie lifetime. To make that longer, go to Backend – Configuration – Web – Session Cookie Management – Cookie Lifetime.

Can’t access the Magento module administration page

If you have installed the module and can’t access the module administration page getting an error, clean your cache and relog at the backend. These simple actions will let Magento update permissions.

My Magento emails go to spam, and clients don’t receive them

Read our article on how to make sure your Magento emails don’t go to spam (plus there’s a free spam check tool available).

Google says there are thousands of your Magento store’s pages indexed

But you know you have a smaller number of them. Most probably your Magento store has generated lots of duplicate pages. Read how to get rid of them.

Shopping cart price rules not working

Here’s a common mistake people are making when creating rules for discounts attached to, say, a category:

How to fix common Magento issies - shopping cart price rules not working

After saving the rule users complain that it is applied no matter if conditions are observed.

The issue is hidden in ‘if total quantity greater than 0’. Basically, you shouldn’t compare anything with null, so you’d better use ‘If total quantity equals or greater than 1’, which works the same.

Also, there is a common issue when using list rules. For example, here’s a rule using several SKUs or categories:

How to fix common Magento issues - Shopping cart price rules

Here we use the presence of products with ‘750′, ‘iddqd’, or ‘sample-product’ SKUs in the shopping cart as a condition. But we’ve chosen ‘SKU is‘, so Magento will search for ‘750,iddqd,sample-product’ SKU, but there is obviously no such product, and the rule won’t be working as the condition is not observed.

In this case we should use ‘is one of’ instead of ‘is’. For example, ‘SKU is one of 750,iddqd,sample-product‘, and Magento will search for any of these SKUs in the shopping cart.

How to turn an extension off fast

This method works when you install an extension, and it turns out you get critical errors. Go to \app\etc\modules, where you’ll see XML files. To switch an extension off, rename its XML file, for example, you have Cool_extension.xml, rename it to Cool_extension.xml.off and clear your cache. If your errors appeared because of this extension, now they must be gone.

Note: there are files starting with Mage in the same folder; we don’t recommend turning them off unless you know for sure what you are doing, because these are Magento files.

How to activate several shopping cart rules with one coupon

By default Magento doesn’t allow activating several shopping cart rules by one coupon, but there’s a way to change it.

Use this database request:

DROP INDEX `UNQ_SALESRULE_COUPON_CODE` ON `salesrule_coupon`

Then open  /app/code/core/Mage/SalesRule/Model/Resource/Coupon.php, find lines 43-46 and comment them out like that:

/*$this->addUniqueField(array(
'field' => 'code',
'title' => Mage::helper('salesrule')->__('Coupon with the same code')
)); */

Do you have any questions on the issues listed above? We’d love to help!

Ksenia Dobreva

Ksenia Dobreva

Ksenia is a devoted marketer with special love to blogging. She believes that content with several pinches of SEO and social can be a brilliant daily special. When she’s not working on Amasty updates and blog posts, Ksenia runs a blog on movies and books and helps animal shelters.

You may also like...

25 Responses

  1. clay says:

    How would I make urls such as WISH LIST, currency switcher and product compare 301 instead of 302? Is there code that I can update? What in Magento source code sets this? Currently with x-number of pages all have compare buttons, currency symbols, etc, I have a ton of 302s that are hurting me.

    • Ksenia Dobreva Ksenia Dobreva says:

      Hey!

      Thanks for your comment. This is a very common question, yet I didn’t see a solid answer on this on other platforms.

      For now the best decision will be to close these pages from indexing, and in that way these 302s won’t hurt your website.

      As this is a common question I have already scheduled a more detailed article with comments from our system administrator and SEO specialist on this question.

      Hope that helps. Cheers!

  2. krystle says:

    hello, i am trying to set up a shopping cart price rule to apply to everything in our catalog with the exception of certain categories. I have tried setting it up like this:
    If ALL of these conditions are TRUE :
    Category does not contain 739, 682, 740, 693, 683, 347, ..

    and like this:
    If ALL of these conditions are TRUE :
    Category is not 739, 682, 740, 693, 683, 347, …

    but it still apply’s the discount to these products in the specified categories.

    i cant figure out what i am doing wrong – can you please help!?
    thank you!

    • Ksenia Dobreva Ksenia Dobreva says:

      Hey! If you use category list or SKU, take “is one of \ is not one of”. Hope that helps.

  3. Kareen says:

    I have up until now had someone who does all the magento website stuff for us – However I am getting slow service! so I need to remove completely around 700 products – How to I redirect the URL’s for them – Probably an easy question for experienced folk out there!
    Thanks

    • Ksenia Dobreva Ksenia Dobreva says:

      Hi Kareen,

      there are two ways you can do this. You can add redirects in the Magento backend. Here’s how:
      Catalog > URL Rewrite Management, click Add URLrewrite, select Custom from the drop down menu. Fill in the info:
      ID Path: oldURL
      Request Path: oldURL
      Target Path: newURL
      Redirect: Permanent(301)ID Path: oldURL

      But this option allows you to add redirects one by one, which can take time.
      Also, if you have a list of the product URLs you are going to delete, you can add redirects much faster via .htaccess file.
      Here’s a nice tool http://www.htaccessredirect.net/ which can help you with this (also, there are a lot of guides on adding a 301 redirect via .htaccess).
      If you’re not sure about what you are doing, maybe it’s a good idea to try everything on a demo store.
      Hope that helps!

  4. tanin says:

    I want to change Magento theme name. Is there any easy way to do this? and how i can encrypted my Magento site?

    • Ksenia Dobreva Ksenia Dobreva says:

      Hi and thanks for asking.
      It’s hard to say what you mean by ‘easy way’, just make sure you correctly rename all the theme catalogs.
      For encryption, I’m afraid it’s difficult to explain the whole process in one comment. Maybe you should start with searching for a guide, there are lots of them on the web. Cheers!

  5. Ashish says:

    Hi,

    You have given very informative article. I have not seen so precise response from any other developer.

    I run MultimateCollection.com. On some chrome browsers – mobile simulators, it is throwing 301/302 redirects.

    I found out that if I delete Frontend cookie for this site from my laptop then it start working fine.

    I am unable to understand the issue and solution.

    Please help.

    Ashish

    • Ksenia Dobreva Ksenia Dobreva says:

      Hi Ashish,

      thanks for your question! Unfortunately, it’s impossible to help you without an opportunity to dig into the settings and the code. Looks like if you can’t solve the problem yourself and there is no info on the Internet that could guide you, a great idea is to hire an experienced developer to help you with this issue.

      Hope that helps. Good luck!

      • Ashish says:

        Thanks for being so quick.

        I am trying with experienced developers as well but unfortunately no luck yet!

        This happened after we shifted our server to cloud based server i.e. digitalocean. I also observed that problem came again even after I deleted Frontend cookie in the morning.

        Please advise?

        Ashish

        • Ksenia Dobreva Ksenia Dobreva says:

          Ashish, the first step here is to turn all the third party extensions off and see if the problem is still here.
          If it disappeared, turn the extensions on one by one and check if the issue is present after each time. If the issue is caused by the extension, thus you’ll be able to figure out which module caused you trouble.

  6. Mukesh Jain says:

    My magento admin panel global notification stops displaying suddenly. No notification is displayed on admin panel. Any leads to resolve this issue will be highly appreciated, Thanks in advance!

    • Mukesh Jain says:

      I have disabled all modules one by one but none is causing the issue..

    • Ksenia Dobreva Ksenia Dobreva says:

      Hey there and thanks for asking, but unfortunately it’s impossible to help you remotely, because virtually anything can cause this issue.

  7. vijay says:

    i am using SalesRepsandDealers1.4. magento extension in which i assign dealer to multiple ordered. but when any action perform on order page dealer will go to default admin.

  8. greg says:

    Thank you for the article) I’ve finally realized what was wrong with my shopping cart price rules on my magento store.

  9. Amal says:

    I have a problem with Special Promotions extension: with all cart items attributes rules, that I set on the “Actions”, promo banners don’t work ( like a price in cart, quantity in cart etc.). Am I do smth wrong or it’s a bug?

    • Alexandra Zhos Alexandra Zhos says:

      Hi, Amal! Thank you for the question. I guess that you need to check your settings. Go to System ->Configuration->Special Promotions and look at Product Page Banners section. You need to set “Validate conditions based on cart” to show your product page banners for any cart rules. Hope that you will fix the problem.

  10. Katarzyna Kajzar says:

    Thanks a lot!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *