File "admin-flyers-products.inc.php"
Full Path: /srv/www/www.cadoro.it/src/controllers/admin-flyers-products.inc.php
File size: 1.02 KB
MIME-type: text/x-php
Charset: utf-8
<?php
$flyer = models\Flyer::get_by_id($id);
if (!$flyer) {
not_found();
}
$params = array(
"q" => _request('q'),
"filter" => _request('filter'),
);
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['homepage'])) {
$id = _request('id');
$status = _request('homepage')*1;
$product = $flyer->get_product_by_id($id);
if ($product) {
$product->update_homepage($status);
}
exit;
}
$params['batch'] = 25;
$params['offset'] = _request('offset');
$products = $flyer->get_products($params, $params['offset'], $params['batch']);
$params['count'] = $flyer->get_products_count($params);
$smarty->assign("flyer", $flyer);
$smarty->assign("params", $params);
$smarty->assign("products", $products);
$smarty->assign("batch_url", BASE_URL . "/admin/flyers/" . $flyer['id'] . "/products?q=" . $params['q'] . "&filter=" . $params['filter'] . "&");
$smarty->assign("menu", "content");
$smarty->assign("submenu", "flyers");
$smarty->display("admin-flyers-products.tmpl");
?>