How do you display the discounted price on a node level?

e.g.
Regular Price: $100
Discounted Price $70

(i'm using a custom template "node-product.tpl.php", i have everything else figured out other than the discounted price)

Comments

duntuk’s picture

Status: Fixed » Active

Ok... figured it out...

<div id="cart-price">

<?php 
if ($node->discounts != NULL) {
foreach ($node->discounts as $discountListing) {

$discountedAmount = $discountListing['amount'];
$discountedDescription = $discountListing['description'];
$normalAmount = $node->sell_price;
$discountedTotal = ($normalAmount - $discountedAmount);
?>
<h4 class="price price-regular"><s>Regular Price: <span><?php print uc_currency_format($normalAmount); ?></span></s></h4>
<h4 class="price price-discount">Discounted Price: <span><?php print uc_currency_format($discountedTotal); ?><span></h4>
<p><?php print $discountedDescription; ?></p>
<?php } } else { ?>
<h4 class="price">Price: <span><?php print uc_currency_format($node->sell_price); ?></span></h4>
<?php } ?>

</div><!-- /#cartPrice -->
duntuk’s picture

Status: Active » Fixed

closed..

duntuk’s picture

Status: Active » Fixed

cleaned up the code a bit....

<div id="cart-price">

<?php 
$normalAmount = $node->sell_price;

if ($node->discounts != NULL) {
foreach ($node->discounts as $discountListing) {

$discountedAmount = $discountListing['amount'];
$discountedDescription = $discountListing['description'];
$discountedTotal = ($normalAmount - $discountedAmount);
?>
<h4 class="price price-regular"><s>Regular Price: <span><?php print uc_currency_format($normalAmount); ?></span></s></h4>
<h4 class="price price-discount">Discounted Price: <span><?php print uc_currency_format($discountedTotal); ?></span></h4>
<p><?php print $discountedDescription; ?></p>
<?php } } else { ?>
<h4 class="price">Price: <span><?php print uc_currency_format($normalAmount); ?></span></h4>
<?php } ?>

</div><!-- /#cart-price -->

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.