Skip to content

Instantly share code, notes, and snippets.

View magento_salesrule_subselect.patch
diff -rupN src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php
--- src_org/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2016-02-17 19:27:54.000000000 +0100
+++ src_patched/app/code/core/Mage/SalesRule/Model/Rule/Condition/Product/Subselect.php 2017-05-04 16:36:44.349301447 +0200
@@ -114,7 +114,7 @@ class Mage_SalesRule_Model_Rule_Conditio
$attr = $this->getAttribute();
$total = 0;
foreach ($object->getQuote()->getAllVisibleItems() as $item) {
- if (parent::validate($item)) {
+ if (Mage_Rule_Model_Condition_Combine::validate($item)) {
$total += $item->getData($attr);
edannenberg /
Last active October 12, 2016 23:03
Mage_Eav_Model_Entity_Attribute_Source_Abstract::getOptionId() value/label collision

Had to investigate a weird bug in our product data, turns out to be a Magento core "feature" that can cause option id/label collisions when using getOptionId() of Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Truncated getAllOptions() array for a common size attribute:

  [232] => Array
 [value] => 104
edannenberg /
Last active January 26, 2017 17:41
Magento 1.8.x tax calculation when using prices including tax.

We upgraded to 1.8 a couple of weeks ago, today i had to investigate this little gem:


The issue was reproducable by adding 3 of the above items to the cart, checking the db confirmed that the 2nd quote item already had the wrong tax value.

Digging down the culprit turned out to be in Mage_Tax_Model_Sales_Total_Quote_Subtotal and Mage_Tax_Model_Sales_Total_Quote_Tax:

collect() will call for each quote item:

edannenberg / replicate-attribute-values.php
Last active December 17, 2015 08:08
Fixes possible borked filtered navigation after upgrading older Magento versions.
View replicate-attribute-values.php
* This will replicate attribute values of configurable products to all it's child products.
* Rationale: After upgrading Magento 1.4 to 1.7 we found that our filtered navigation was
* missing quite alot of products. Turns out somewhere after 1.4 Varien changed the filtered
* navigation to only use the attributes of child products, ignoring the attributes of
* their configurable products.
View fix-url-keys.php
* Drop this into the shell directory in the Magento root and run with -h to see all options.
require_once 'abstract.php';
* Fix duplicate url keys for categories and products to work with the 1.8 alpha1 CE url key constraints.
edannenberg / magento_url_rewrite.patch
Last active August 11, 2022 17:27
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
View magento_url_rewrite.patch
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
edannenberg / mavento_bash_completion
Created April 11, 2012 08:56
Bash completition for maven-magento-plugin.
View mavento_bash_completion
# Programmable completion for the Maven mvn command under bash. Source
# this file (or on some systems add it to ~/.bash_completion and start a new
# shell) and bash's completion mechanism will know all about mvn's options!
# Copyright (C) 2009, Ludovic Claude <>
# Base on git completion script, Copyright (C) 2006,2007 Shawn O. Pearce <>
# Distributed under the GNU General Public License, version 2.0.
# Customization: you can always edit this file (as root) and add or remove plugins and options in the lists defined below.
# If you have some interesting changes, please send patches to