Skip to content
Snippets Groups Projects
Commit 5169e17c authored by Gabriela Emma's avatar Gabriela Emma
Browse files

LN-470 showed the product price on the single page in both usd and ada

parent 769db776
No related branches found
No related tags found
1 merge request!9Ln 470 show product price in ada
Pipeline #3410 failed
......@@ -34,7 +34,6 @@
$id = isset($_GET['id']) ? (int)$_GET['id'] : null;
$selectedItem = null;
if ($id !== null && count($items)) {
$selectedItems = array_filter($items, fn ($t) => $t['id'] == $id);
$selectedItem = reset($selectedItems);
......@@ -42,7 +41,7 @@
?>
<div id="itemDetails" class="flex flex-col items-center gap-8">
<?php if ($selectedItem ) : ?>
<?php if ($selectedItem) : ?>
<img src="<?php echo $selectedItem['img']; ?>" alt="<?php echo $selectedItem['name']; ?>" class="h-[500px]" />
<div class="flex flex-row items-center gap-4">
<div class="text-[20px]">
......@@ -51,7 +50,18 @@
</div>
<div class="text-[24px] font-bold">
<p><?php echo $selectedItem['name']; ?></p>
<p><?php echo $selectedItem['price']; ?></p>
<?php
if ($selectedItem['id'] == 2) {
$price_in_ada = usd_to_ada((float)str_replace('$', '', $selectedItem['price']));
echo '<p>' . number_format($price_in_ada, 2) . ' ADA</p>';
echo '<p>' . $selectedItem['price'] . ' USD</p>';
} else {
echo '<p>' . $selectedItem['price'] . '</p>';
}
?>
</div>
</div>
......@@ -78,4 +88,4 @@
</div>
</body>
</html>
\ No newline at end of file
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment