Exemple #1
0
 /**
  *
  * @param <type> $im
  * @param <type> $product 
  */
 protected function addPrice(&$im, $product)
 {
     if (Mage::getStoreConfig('barcodelabel/price/print') != 1) {
         return false;
     }
     //get base price
     $price = $product->getPrice();
     // get special price with range date depends on configuration flag yes/no
     if (Mage::getStoreConfig('barcodelabel/price/special_price') && $product->getspecial_price() != '') {
         if (Mage::app()->getLocale()->isStoreDateInInterval(Mage::app()->getStore(), $product->getspecial_from_date(), $product->getspecial_to_date())) {
             $price = $product->getspecial_price();
         }
     }
     //tax rate
     $taxRate = (double) Mage::getStoreConfig('barcodelabel/price/tax_rate');
     $price = $price * (1 + $taxRate / 100);
     // to do : choose symbol or code ( € | EUR )
     $currencyCode = Mage::getStoreConfig('barcodelabel/price/currency');
     $currency = Mage::getModel('directory/currency')->load($currencyCode);
     // place the symbol at the right of the price value
     $price = $currency->format($price, array(), false, false);
     $fontSize = Mage::getStoreConfig('barcodelabel/price/font_size') * $this->_coef;
     $position = $this->getPositions(Mage::getStoreConfig('barcodelabel/price/position'), true);
     $black = $this->setFontColor($im);
     $font = $this->getFont();
     imagettftext($im, $fontSize, 0, $position['x'], $position['y'], $black, $font, $price);
 }