title: How do I solve it 'using $this'
body: <pre><code>function printPrice($price = null)
  {
      $oCurrencyModel = getModel('currency');
  
      if(!$price &amp;&amp; $this-&gt;price)
      {
          $price = $this-&gt;price;
      }
      return $oCurrencyModel-&gt;printPrice($price);
  }
  
  function printMileage($mileage)
  {
      $oCurrencyModel = getModel('currency');
  
      return $oCurrencyModel-&gt;printPrice($mileage);
  }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Using $this when not in object context in /home/masanwatch/www/modules/nproduct/nproduct.item.php:89 Stack trace: #0 /home/masanwatch/www/files/cache/template_compiled/3a2e9f2cf85b939b1b1026ccb734f400.compiled.php(82): nproductItem::printPrice(0) #1 /home/masanwatch/www/classes/template/TemplateHandler.class.php(430): include('/home/masanwatc...') #2 /home/masanwatch/www/classes/template/TemplateHandler.class.php(197): TemplateHandler->_fetch('file:///home/ma...') #3 /home/masanwatch/www/classes/display/HTMLDisplayHandler.php(61): TemplateHandler->compile('./modules/ncart...', 'ordercomplete.h...') #4 /home/masanwatch/www/classes/display/DisplayHandler.class.php(64): HTMLDisplayHandler->toDoc(Object(ncartView)) #5 /home/masanwatch/www/classes/module/ModuleHandler.class.php(1153): DisplayHandler->printContent(Object(ncartView)) #6 /home/masanwatch/www/index.php(59): ModuleHandler->displayContent(Object(ncartView)) #7 {main} thrown in /home/masanwatch/www/modules/nproduct/nproduct.item.php on line 89</p>
  </blockquote>
  
  <p>How do I solve it?</p>