Skip to content

Commit 3270d41

Browse files
committed
Add product variant min. and max. prices in seller product list
1 parent f05dfe3 commit 3270d41

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

main/marketplace/Controllers/Seller/Product.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,25 @@ public function get_list($data)
8787
// Get product description
8888
$product_description_info = $this->model_seller_product->getProductDescription($product['product_id']);
8989

90+
// Get product variant min and max prices
91+
$product_variant_price = $this->model_seller_product->getProductVariantMinMaxPrices($product['product_id']);
92+
93+
if ($product_variant_price) {
94+
$min_price = $this->currency->format($product_variant_price['min_price'], $this->currency->getCurrentCode());
95+
$max_price = $this->currency->format($product_variant_price['max_price'], $this->currency->getCurrentCode());
96+
} else {
97+
$min_price = $this->currency->format(0, $this->currency->getCurrentCode());
98+
$max_price = $this->currency->format(0, $this->currency->getCurrentCode());
99+
}
100+
90101
$data['products'][] = [
91102
'product_id' => $product['product_id'],
92103
'name' => $product_description_info['name'],
93104
'thumb' => $thumb,
105+
'product_option' => $product['product_option'],
94106
'price' => $this->currency->format($product['price'], $this->currency->getCurrentCode()),
107+
'min_price' => $min_price,
108+
'max_price' => $max_price,
95109
'quantity' => $product['quantity'],
96110
'status' => $product['status'] ? lang('Text.enabled', [], $this->language->getCurrentCode()) : lang('Text.disabled', [], $this->language->getCurrentCode()),
97111
'href' => $this->url->customerLink('marketplace/seller/product/edit/' . $product['product_id'], '', true),

theme_marketplace/com_openmvm/Basic/Views/Seller/product_list.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@
4141
</th>
4242
<td><img src="<?php echo $product['thumb']; ?>" class="border p-1" /></td>
4343
<td><?php echo $product['name']; ?></td>
44-
<td><?php echo $product['price']; ?></td>
44+
<td>
45+
<?php if ($product['product_option']) { ?>
46+
<?php if ($product['min_price'] !== $product['max_price']) { ?>
47+
<span><?php echo $product['min_price']; ?></span> - <span><?php echo $product['max_price']; ?></span>
48+
<?php } else { ?>
49+
<span><?php echo $product['min_price']; ?></span>
50+
<?php } ?>
51+
<?php } else { ?>
52+
<span><?php echo $product['price']; ?></span>
53+
<?php } ?>
54+
</td>
4555
<td><?php echo $product['quantity']; ?></td>
4656
<td><?php echo $product['status']; ?></td>
4757
<td class="text-end"><a href="<?php echo $product['href']; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit fa-fw"></i></a></td>

0 commit comments

Comments
 (0)