File "admin-promotions-edit.inc.php"
Full Path: /srv/www/www.cadoro.it/src/controllers/admin-promotions-edit.inc.php
File size: 1.29 KB
MIME-type: text/x-php
Charset: utf-8
<?php
$promotion = models\Promotion::get_by_id($promotion_id);
if (!$promotion) {
not_found();
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$params = array(
'lang' => _post('lang'),
'slug' => _post('slug'),
'title' => _post('title'),
'date' => _post_date('date'),
'image' => _image('image', 'promotions'),
'image_small' => _image('image_small', 'promotions'),
'description' => _post('description'),
'stores' => _post('stores'),
'seo_title' => _post('seo_title'),
'seo_image' => _image('seo_image', 'blog'),
'seo_description' => _post('seo_description'),
'seo_keywords' => _post('seo_keywords'),
);
if (!$params['lang']) {
$errors['lang'] = 1;
}
if (!$params['slug']) {
$errors['slug'] = 1;
}
if (!$params['title']) {
$errors['title'] = 1;
}
if (!$errors) {
$promotion->update($params);
header("Location: " . BASE_URL . "/admin/promotions");
exit;
}
}
$smarty->assign("promotion", $promotion);
$smarty->assign("errors", $errors);
$smarty->assign("stores", models\Store::get_vocabulary());
$smarty->assign("menu", "catalog");
$smarty->assign("submenu", "promotions");
$smarty->display("admin-promotions-edit.tmpl");
?>