File "punti-vendita-popup.inc.php"

Full Path: /srv/www/www.cadoro.it/src/controllers/punti-vendita-popup.inc.php
File size: 1.09 KB
MIME-type: text/x-php
Charset: utf-8

<?php
  $params = array(
    "prov" => _request('prov'),
    "city" => _request('city'),
    "store" => _request('store'),
  );

  if ($params['store']) {
    $store = models\Store::get_by_id($params['store']);
    $flyers = models\Flyer::get(array("store" => $store, "dates" => 1));
    if ($flyers) {
      echo "<script>window.top.location.href = '" . BASE_URL . "/punti-vendita/" . $store['slug'] . "/volantini/" . $flyers[0]['slug'] . "-" . $flyers[0]['id'] . "';</script>";
    } else {
      echo "<script>window.top.location.href = '" . BASE_URL . "/punti-vendita/" . $store['slug'] . "';</script>";
    }
    exit;
  }

  $provinces = models\Store::get_provinces($params);
  $cities = models\Store::get_cities($params);
  $stores = models\Store::get_vocabulary($params);

  $smarty->assign("stores", $stores);
  $smarty->assign("params", $params);
  $smarty->assign("provinces", $provinces);
  $smarty->assign("cities", $cities);

  $smarty->assign("data", array(
    "stores" => $stores,
    "provinces" => $provinces,
    "cities" => $cities,
  ));

  $smarty->display("punti-vendita-popup.tmpl");
?>