Commit 1c142f2f authored by Cédric Houbart's avatar Cédric Houbart
Browse files

Split sold and archived products in list

parent 80a9fad4
......@@ -34,6 +34,8 @@ $products = \Pasteque\ProductsService::getAll();
<p><?php \pi18n("%d products", PLUGIN_NAME, count($products)); ?></p>
<h2><?php \pi18n("Catalog", PLUGIN_NAME); ?></h2>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
......@@ -46,7 +48,9 @@ $products = \Pasteque\ProductsService::getAll();
<tbody>
<?php
$par = FALSE;
$archive = FALSE;
foreach ($products as $product) {
if ($product->visible) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
......@@ -59,10 +63,47 @@ $par = !$par;
</td>
</tr>
<?php
} else { $archive = TRUE; }
}
?>
</tbody>
</table>
<?php if ($archive) { ?>
<h2><?php \pi18n("Archived", PLUGIN_NAME); ?></h2>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th></th>
<th><?php \pi18n("Product.reference"); ?></th>
<th><?php \pi18n("Product.label"); ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$par = FALSE;
foreach ($products as $product) {
if (!$product->visible) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $product->id; ?>" />
<td><?php echo $product->reference; ?></td>
<td><?php echo $product->label; ?></td>
<td class="edition">
<a href="<?php echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array('id' => $product->id)); ?>"><img src="<?php echo \Pasteque\get_template_url(); ?>img/edit.png" alt="<?php \pi18n('Edit'); ?>" title="<?php \pi18n('Edit'); ?>"></a>
<form action="<?php echo \Pasteque\get_current_url(); ?>" method="post"><?php \Pasteque\form_delete("product", $product->id, \Pasteque\get_template_url() . 'img/delete.png') ?></form>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php } // archive end ?>
<?php
if (count($products) == 0) {
?>
......
......@@ -22,7 +22,7 @@ namespace BaseProducts;
function init() {
global $MENU;
$MENU->addSection("catalog", "Catalogue", PLUGIN_NAME);
$MENU->addSection("catalog", "Catalog", PLUGIN_NAME);
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "menu_tax.png", "Taxes", "taxes");
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "menu_category.png", "Categories", "categories");
$MENU->registerModuleEntry("catalog", PLUGIN_NAME, "menu_product.png", "Products", "products");
......
{
"Catalog": "Catalog",
"Products": "Products",
"Add a product": "Add a product",
"%d products": "%d products",
"No product found": "No product found",
"Archived": "Archived",
"Edit a product": "Edit a product",
"Display": "Display",
"Price": "Price",
......
{
"Catalog": "Catalogue",
"Products": "Produits",
"Add a product": "Ajouter un produit",
"%d products": "%d produits",
"No product found": "Aucun produit trouvé",
"Edit a product": "Édition d'un produit",
"Archived": "Archives",
"Display": "Affichage",
"Price": "Prix",
"Referencing": "Referencement",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment