/**
  * @param string $url
  * @param array $get
  * @param waRouting $routing
  * @param bool $demo
  * @return string
  */
 private function redirectSimpla($url, $get, $routing, $demo = false)
 {
     $redirect = null;
     if (substr($url, 0, 9) == 'products/') {
         # products/%product_slug%
         $url = substr($url, 9);
         $url_parts = explode('/', $url);
         if ($p = $demo ? array('url' => '%product_url%', 'category_id' => true) : $this->productModel()->getByField('url', $url_parts[0])) {
             $params = array('product_url' => $p['url']);
             if ($p['category_id']) {
                 $c = $demo ? array('full_url' => '%category_url%') : $this->categoryModel()->getById($p['category_id']);
                 $params['category_url'] = $c['full_url'];
             }
             $redirect = wa()->getRouteUrl('shop/frontend/product', $params);
         }
     } elseif (substr($url, 0, 8) == 'catalog/') {
         # catalog/%category_slug%
         $url = substr($url, 8);
         if ($demo) {
             $redirect_params = array('category_url' => $url);
             $redirect = wa()->getRouteUrl('shop/frontend/category', $redirect_params);
         } else {
             if ($c = $this->categoryModel()->getByField('full_url', rtrim($url, '/'))) {
                 $route = $routing->getDomain(null, true) . '/' . $routing->getRoute('url');
                 $cat_routes_model = new shopCategoryRoutesModel();
                 $routes = $cat_routes_model->getRoutes($c['id']);
                 if (!$routes || in_array($route, $routes)) {
                     $redirect = wa()->getRootUrl(false, true) . $routing->getRootUrl() . $url;
                 }
             }
         }
     }
     return $redirect;
 }
 public function __construct()
 {
     $this->routing = wa()->getRouting();
     $this->domain = $this->routing->getDomain(null, true);
 }