Skip to content

Instantly share code, notes, and snippets.

Erik Dannenberg edannenberg

  • X-Trade GmbH
Block or report user

Report or block edannenberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 Oct 12, 2016
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 Jan 26, 2017
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 / magento_catinv_api.patch
Created Oct 17, 2013
Fixes catalogInventoryStockItemUpdate api call (V2) in Magento 1.8. Whats broken: The api method got refactored and now does not call $product->save() anymore. As a result the stock_id for new items is not set as the observer that takes care of that is hooked to the product_save_after event. Fix 1: Apply patch below. *OR* Fix 2: Update db schema…
View magento_catinv_api.patch
--- mage_org/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php 2013-10-17 12:24:37.773265017 +0200
+++ src_shop/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php 2013-10-17 13:09:30.141351173 +0200
@@ -54,6 +54,7 @@
/** @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
$stockItem = $product->getStockItem();
+ $stockItem->setStockId($stockItem->getStockId());
$stockData = array_replace($stockItem->getData(), (array)$data);
edannenberg / replicate-attribute-values.php
Last active Dec 17, 2015
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 Oct 10, 2019
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 Apr 11, 2012
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
You can’t perform that action at this time.