LinuxUK
   Home About us Design services Get in Touch Testimonails Create and account / Log in
Categories
 Templates

 Security checks

 Support Club

 Tips and Tricks

 How to guides osC

 My Contributions

 osCommerce versions

 Base64 Decoder

 Link to us!

Hide Price if 0 & replace with a message
Product stats Product Stats
Products name Product Name: Hide Price if 0 & replace with a message
Products model Model: Hide Price
Products info Product description

This mod will allow you to hide prices if they are set to 0, and in their place display a message.
We use the same bit of code as we used here, all we do is change the IF statement.
From catalog / includes / classes / currencies.php
Line 72 & 73 find

     function display_price($products_price, $products_tax, $quantity = 1) {
      return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
    }

to this we add a simple IF statement, so it looks ....

    function display_price($products_price, $products_tax, $quantity = 1) {
      if ($products_price > 0.01) {
   return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
   }else{
   return 'Contact us';
   }
    }

We are saying, IF the price is over 0.01 show the prices ELSE display the message.

Its a very simple method compared to some of the contributions you come across!

 

Reviews

Hide Price if 0 & replace with a message - TITLE_DEL_ICIO_US Hide Price if 0 & replace with a message - TITLE_DIGG Hide Price if 0 & replace with a message - TITLE_YAHOO_MYWEB Hide Price if 0 & replace with a message - TITLE_SPURL Hide Price if 0 & replace with a message - TITLE_FURL Hide Price if 0 & replace with a message - TITLE_ASK Hide Price if 0 & replace with a message - TITLE_SQIDOO Hide Price if 0 & replace with a message - TITLE_SIMPY Hide Price if 0 & replace with a message - TITLE_REDDIT Hide Price if 0 & replace with a message - TITLE_MA_GNOLIA Hide Price if 0 & replace with a message - TITLE_FACEBOOK_BOOKMARK Hide Price if 0 & replace with a message - TITLE_GOOGLE_BOOKMARK