Categories

Featured templates

VirtueMart. Zero product prices issue

Norman Fisher December 26, 2011
Rating: 5.0/5. From 3 votes.
Please wait...

This tutorial is going to show you how to solve a problem with zero product prices when no discount is selected.

On some templates, when in your admin go to Components -> Virtuemart, click on Product list, select a product and in the Product Information tab change Discount Type to 0 (-none-) and click on Apply to save your changes, the price shows like this

To fix this, you need to access the theme files on your server, navigate to components/com_virtuemart/themes/vmtheme(your_theme_number)/templates/common/ and open price.tpl.php to edit. Look for the following code:

in price.tpl.php

  <?php
  if(!empty($discount_info["amount"])) {
  ?>
  <span class="productPrice">
  <?php echo $CURRENCY_DISPLAY->getFullValue($base_price) ?>
  <?php echo $text_including_tax ?>
  </span>
  <?php
  }
  ?>
  <?php
  if( !empty( $price_info["product_price_id"] )) { ?>
  <span class="product-Old-Price">
  <?php echo $CURRENCY_DISPLAY->getFullValue($undiscounted_price); ?>
  </span>
  <?php
  }
  echo $price_table;
  ?>

Where you need to interchange these two lines

if(!empty($discount_info["amount"])) { 
if( !empty( $price_info["product_price_id"] )) { ?>

so that your code would look like this

<?php
  if( !empty( $price_info["product_price_id"] )) {
  ?>
  <span class="productPrice">
  <?php echo $CURRENCY_DISPLAY->getFullValue($base_price) ?>
  <?php echo $text_including_tax ?>
  </span>
  <?php
  }
  ?>
  <?php
  if(!empty($discount_info["amount"])) { ?>
  <span class="product-Old-Price">
  <?php echo $CURRENCY_DISPLAY->getFullValue($undiscounted_price); ?>
  </span>
  <?php
  }
  echo $price_table;
  ?>

Once you have done that, save the changes, re-fresh your product page and you are done.

Please, see the demo below for additional info.

VirtueMart. Zero product prices issue
This entry was posted in VirtueMart Tutorials and tagged archived_tutorial, price, product, VirtueMart, zero. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket