Browsing articles in "Magento error"
Nov 7, 2014

Magento error: SCP 404: GET /spp/ajax/?___SID=Uco/?id=460&pid=123

If you are using Magento extension Simple Configurable Product (SCP, it gets dangerous sometimes when you have configured Special Prices or Tiered Pricing. It requests for prices via ajax after page is loaded. For some customers having old system and browser, this results in sending ___SID (session ID) along with GET request parameter, which causes double question mark in the URL.

Ideally, the ajax URL should be:

where it requests to module’s AjaxController and coAction() method, with parameters id (product ID) and pid (parent ID). This should go good without any issue.

But, ___SID=U, which is used in the cache as a placeorder, also goes along with the parameters it creates a problem. As there are two “?” in the URL, Magento will try to see for AjaxController’s indexAction() because when you don’t have anything for action part in URL, it by defaults to indexAction of the controller.

The problem doesn’t end in just a 404 error in error log, this also DISPLAYS whole 404 page just below the product price in product page. So, customer will get confused as there is a big 404 page inside the product page and configurable attributes like size, color and quantity box are pushed down. This may result in low sales when it appears frequently.

The easiest way to fix this is to create an action indexAction() and check if you have ___SID as a parameter, then just ignore it.

Add the following code in your module’s AjaxController.php file, just above the coAction():

public function indexAction() {
    $p = $this->getRequest()->getParam('___SID');
    if($p) { return ''; }

This will solve the weird 404 page that gets displayed in product page, but not the 404 error coming up in the logs. You need to remove ?___SID=U from the URL when it appears in the request to completely resolve the issue.

Oct 7, 2014

Magento fix for error “Code already exists.”

Fix for Magento error Code already exists. in Sales > Tax > Manage Tax Rules, when saving the rule.

When trying to save Tax rules in Magento, you may get “Code already exists.” error if there are lots of tax rates passing in POST. Magento error is not making sense here, as the issue is something different. Basically when you post the data in PHP, it limits maximum post variables which should pass to the server. For me, that limit was 1000 in max_input_vars, which by changing to 20000 solved this issue and Magento successfully accepted my changes without any error.

To change max_input_vars to higher value, you need to edit in PHP.ini file for max_input_vars like this:

max_input_vars 20000

But as editing PHP.ini requires restarting apache to reflect the changes, I did the change in .htaccess file just for Tax rule modification and later reverted it.

You can edit .htaccess to make this change by copy-pasting below line at the end of the file:

php_value max_input_vars 20000

Now you should be able to change Tax rules even if you have lots of tax rates posting through for that change! I prefered to revert .htaccess back to what it was as I didn’t need to change tax rules frequently.

Note: If the above does not solve the issue for you, make sure your Tax Rule name is not duplicating with another tax rule name.

Dec 1, 2013

Magento Redis read error on connection

Magento read error on connection when using Redis. If you are using Redis as cache in Magento and read timeout is not specified, you may get this error. Below is how it looks in the error report.

read error on connection

#1 lib/Mage/Cache/Backend/Redis.php(210): Credis_Client->hGet('zc:k:0cd_FPC_DE...', 'd')
#2 lib/Zend/Cache/Core.php(303): Mage_Cache_Backend_Redis->load('0cd_FPC_DESIGN_...', false)
#3 lib/Varien/Cache/Core.php(158): Zend_Cache_Core->load('FPC_DESIGN_EXCE...', false, false)
#4 app/code/core/Mage/Core/Model/Cache.php(379): Varien_Cache_Core->load('FPC_DESIGN_EXCE...')
#5 app/code/core/Enterprise/PageCache/Model/Processor.php(185): Mage_Core_Model_Cache->load('FPC_DESIGN_EXCE...')
#6 app/code/core/Enterprise/PageCache/Model/Processor.php(146): Enterprise_PageCache_Model_Processor->_getDesignPackage()
#7 app/code/core/Enterprise/PageCache/Model/Processor.php(108): Enterprise_PageCache_Model_Processor->_createRequestIds()
#8 app/code/core/Mage/Core/Model/Cache.php(703): Enterprise_PageCache_Model_Processor->__construct()
#9 app/code/core/Mage/Core/Model/Cache.php(685): Mage_Core_Model_Cache->_getProcessor('Enterprise_Page...')
#10 app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Model_Cache->processRequest()
#11 app/Mage.php(683): Mage_Core_Model_App->run(Array)
#12 /var/www/source/index.php(87): Mage::run('', 'store')

The solution (atleast for us) was to add a read_timeout config option in app/etc/local.xml where you have configured Redis cache for Magento.

                <read_timeout>10</read_timeout><!--add this-->


Oct 20, 2013

Magento Error: Fatal error: Call to a member function rewrite() on a non-object in app/code/core/Mage/Core/Controller/Varien/Front.php on line 165

Magento Error: Fatal error: Call to a member function rewrite() on a non-object in /var/www/magento/app/code/core/Mage/Core/Controller/Varien/Front.php on line 165

While upgrading Magento from 1.7 to 1.8 version, this error generally appears and stops the site from loading.

We can get rid of this error simply by clearing the cache:

rm -rf var/cache/*

If you don’t have terminal access, clear all the contents of var/cache/ directory.

Further if you have memcached or other caching system installed, flush them as well.

Jul 19, 2013

Magento products not showing in categories

If your Magento products are not showing up in frontend category pages, that can be because one or more of the below points are not done correctly.

The products must have following set correctly to appear in the category pages in frontend. You can check all the below things in Manage Products screen of any individual product.
Status must be Enabled (under General tab)
Visiblility should be Catalog OR Catalog, Search (under General tab)
– Stock Qty (quantity) should be greater than Qty for Item’s Status to Become Out of Stock (under Inventory tab)
Stock Availability must be IN STOCK
Category should be assigned (under Categories tab)
Website must be assigned (under Websites tab)

Clear the cache, re-index the indexes related to product (Product prices, Product flat data and Category products) and everything should work as expected.

This post is written to address the following issue:
magento products not displaying in categories
magento products not showing in categories
magento items not showing in categories
magento products not showing up in categories
magento products not showing under categories
magento products not displaying on category page
magento product images not showing in category
magento configurable product not showing in category
magento new product not showing in category

If you are unable to see Product Images in frontend category pages, check this blog post to resolve it:


Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!




Magento top 50 contributors

Magento top 50 contributors