Browsing articles tagged with "500 internal server error Archives - Kalpesh Mehta"
Mar 28, 2015
kalpesh

Magento bug – Checkout cart 500 error – Redirect loops

Magento checkout cart gives 500 error and redirect loops when there is a shopping cart rule with Category condition.

I found a bug in Magento which redirects shopping cart indefinitely causing it 500 internal server error. This can be a serious bug as customer will not able to shop if this happens. I noticed this happens when there is a shopping cart rule which have Category in conditions of the rule.

If total quantity equals or greater than 1 for a subselection of items in cart matching ALL of these conditions:
Category is 125

So for example you have a shopping cart rule where you want to give some discount or free product if at least one product is chosen from specific Category, this triggers the error in frontend shopping cart. Main reason here is Category condition. If you remove category condition then the error should go away. But if you want to keep the category condition and still want Magento to handle the shopping cart promotion rule, check the code changes below:

To solve this I copied below file to my local
app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Combine.php

and edited the function validate:

/**
     * Validate a condition with the checking of the child value
     * @param Varien_Object $object
     *
     * @return bool
     */
    public function validate(Varien_Object $object)
    {
        /** @var Mage_Catalog_Model_Product $product */
        $product = $object->getProduct();
        if (!($product instanceof Mage_Catalog_Model_Product)) {
            $product = Mage::getModel('catalog/product')->load($object->getProductId());
        }

        $valid = parent::validate($object);

        /* Kalpesh commented whole block, as it causes redirect loop and Segmentation fault in apache
        if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
            $children = $object->getChildren();
            //$valid = $children && $this->validate($children[0]); //Kalpesh commented, issue....
        }*/


        return $valid;
    }

Hope this helps to some troubled souls!

Feb 9, 2013
kalpesh

Magento 500 internal server error

[Resolved]: Magento 500 internal server error
If you are getting “500 Internal Server Error” then the reason might be permissions issue or fatal error.

In Magento, you can check the errors occured in files:
var/log/system.log
var/log/exception.log

You can even allow the error to output to your browser by editing your Magento index.php with:
error_reporting(E_ALL | E_STRICT);
ini_set(‘display_errors’, 1);

Also, try this to solve the error:
– Check the owner of your magento project. It should be the server (www-data for apache)
chown -R www-data:www-data .

– Change the directory permissions to 755 and file permissions to 644 for your project
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
chmod 550 pear
chmod 550 mage
chmod 755 -R var

– Check after upgrade do you have your .htaccess file inside Magento root

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!

Certifications

Honor

Recognition

Magento top 50 contributors

Magento top 50 contributors

Contributions