Magento Theme Hierarchy check

by riddla

HTML

<h1>Magento Theme Hierarchy check</h1>

<h2>Package used:</h2>
<p><input id="package" type="text" value="arvato_basis"/></p>
<h2>Template used:</h2>
<p><input id="template" type="text" value="default"/></p>

<h3>Paths:</h3>
<p><input id="path1" type="text" value="/app/design/frontend/arvato_basis/default/template/checkout/onepage/review/info.phtml"/></p>
<p>vs.</p>
<p><input id="path2" type="text" value="/app/design/frontend/base/default/template/arvato/customization/checkout/onepage/review/info.phtml"/></p>
<p><button type="submit">check paths</button></p>

CSS

input {
    width:100%;
}

input.winner {
    color:green;
}

CoffeeScript

$('button').click ->
  template = $('#template').val()
  _package = $('#package').val()
  path1 = $('#path1').val()
  path2 = $('#path2').val()
  splat1 = path1.split('/')
  splat2 = path2.split('/')
    
  # package wins over base
  console.log(splat1[4])
  if splat1[4] == _package
    $('#path1').addClass('winner')
    win('path1')
    
$('button').click()


win = (id) ->
  $('#' + id).addClass('winner')