raf
Active Member
I've already added shop pulling offers from database instead of config.php array.
Now i'm working on adding, deleting and modifying offers. Adding works, offers also shows but only when i add new one. So whenever i go only on a admin_shop.php page, it doesn't show (cache is not caching).
This is a piece of code to show offers:
Which only works if i add item (after refresh it's gone again, but stays in database).
Now i'm working on adding, deleting and modifying offers. Adding works, offers also shows but only when i add new one. So whenever i go only on a admin_shop.php page, it doesn't show (cache is not caching).
This is a piece of code to show offers:
PHP:
<h1>Shop Offers</h1>
<?php
$cacheOut = new Cache('engine/cache/shop_offer');
if ($updateCache === true) {
$shop_offersOut = fetchAllshop_offers();
$cacheOut->setContent($shop_offersOut);
$cacheOut->save();
} else {
$shop_offersOut = $cacheOut->load();
}
if (isset($shop_offersOut) && !empty($shop_offersOut) && $shop_offersOut !== false) {
?>
<table class="ui celled striped table" id="shop_offerTable">
<thead>
<tr>
<th>Name</th>
<th>Delete</th>
<th>Update</th>
</tr>
</thead>
<tbody>
<?php
foreach ($shop_offersOut as $shop_offer) {
?>
<tr>
<td><?php echo $shop_offer['description']; ?></td>
<td>
<form class="ui form" action="" method="POST">
<input name="delete" type="hidden" value="<?php echo $shop_offer['id']; ?>">
<input name="action" type="hidden" value="1">
<input class="ui red mini submit button" type="submit" value="DELETE">
</form>
</td>
<td>
<form class="ui form" action="" method="POST">
<input name="shop_offerId" type="hidden" value="<?php echo $shop_offer['id']; ?>">
<input name="action" type="hidden" value="2">
<input class="ui orange mini submit button" type="submit" value="UPDATE">
</form>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
?>
<h2>Currently no shop offers in database.</h2>
<?php
} ?>