Commit 5782c131 authored by Cédric Houbart's avatar Cédric Houbart
Browse files

Set prd and cat image optimization in modules

parent 4bfc9145
......@@ -60,9 +60,14 @@ $categories = \Pasteque\CategoriesService::getAll();
$par = FALSE;
foreach ($categories as $category) {
$par = !$par;
if ($category->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category&id=" . $category->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=category&id=<?php echo $category->id; ?>" />
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $category->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
......@@ -83,4 +88,4 @@ if (count($categories) == 0) {
<div class="alert"><?php \pi18n("No category found", PLUGIN_NAME); ?></div>
<?php
}
?>
\ No newline at end of file
?>
......@@ -65,9 +65,14 @@ $archive = FALSE;
foreach ($products as $product) {
if ($product->visible) {
$par = !$par;
if ($product->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $product->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $product->id; ?>" />
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $product->reference; ?></td>
<td><?php echo $product->label; ?></td>
<td class="edition">
......
......@@ -73,10 +73,16 @@ foreach ($levels as $level) {
$par = !$par;
$prdRef = "";
$prdLabel = "";
$imgSrc = "";
foreach ($products as $product) {
if ($product->id == $level->productId) {
$prdLabel = $product->label;
$prdRef = $product->reference;
if ($product->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $product->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product";
}
break;
}
}
......@@ -98,7 +104,7 @@ if ($qty < 0) {
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $level->productId; ?>" />
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $prdRef; ?></td>
<td><?php echo $prdLabel; ?></td>
<td class="numeric<?php echo $class; ?>"<?php echo $help; ?>><?php echo $qty; ?></td>
......
......@@ -36,9 +36,14 @@ $compositions = \Pasteque\CompositionsService::getAll();
$par = FALSE;
foreach ($compositions as $composition) {
$par = !$par;
if ($composition->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $composition->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $composition->id; ?>" />
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $composition->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
......
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