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.
Is this possible? Where would it go?
The function looks something like this:
function isCheckout() {
$route = $this->request->get['route'];
//is cart?
if($route == 'checkout/cart')
return 'cart';
$parts = explode('/', $route);
if($parts[0] == 'checkout')
return 'checkout';
return false;
}