Skip to content

Instantly share code, notes, and snippets.

@vpietri
Created November 28, 2015 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpietri/8756409613a2b129cf22 to your computer and use it in GitHub Desktop.
Save vpietri/8756409613a2b129cf22 to your computer and use it in GitHub Desktop.
Get all rewrite from Magento config class
<?php
$mageConfig = Mage::getConfig();
$rewriteResume=array();
foreach($mageConfig->getNode('global') as $type) {
foreach($type as $groupTypeName=>$groupType ) {
foreach($groupType as $aliasGroupName=>$group) {
if($group->rewrite) {
$rewriteClasses = $group->rewrite->children();
foreach($rewriteClasses as $scrClass=>$rewriteClass) {
if (preg_match('/([^_]+_[^_]+)_(.*)/', $rewriteClass,$match)) {
$rewriteResume[$match[1]][$groupTypeName.'::'.$aliasGroupName][$scrClass]=$rewriteClass->asArray();
} else {
//var_dump($rewriteClass);
}
}
}
}
}
}
foreach($rewriteResume as $module=>$moduleRewrites) {
var_dump($module, $moduleRewrites);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment