title: Custom helper functions in OpenCart
body: <p>Trying to create a custom PHP function within opencart. Basically I need to know if we are viewing the cart or checkout pages. I understand the simplest way to accomplish this is by accessing the route request param. I want to create a re-usable function however that is available site wide.</p>
  
  <p>Is this possible? Where would it go?</p>
  
  <p>The function looks something like this:</p>
  
  <pre><code>function isCheckout() {
  
      $route = $this-&gt;request-&gt;get['route'];
  
      //is cart?
      if($route == 'checkout/cart')
          return 'cart';
  
      $parts = explode('/', $route);
  
      if($parts[0] == 'checkout')
          return 'checkout';
  
      return false;
  
  }
  </code></pre>