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!
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
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- ChatGPT (1)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (2)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OpenAI (1)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)