<commit_before><?php

function price_for($rt_shop_product, $config = array())
{
  $config['between_string'] = isset($config['between_string']) ? $config['between_string'] : ' &rarr; ';
  $config['format'] = isset($config['between_string']) ? $config['between_string'] : ' &rarr; ';

  $currency  = sfConfig::get('app_rt_currency', 'USD');

  $price_str = ' - ';

  $price_min = $rt_shop_product->isOnPromotion() ? $rt_shop_product->getMinPromotionPrice() : $rt_shop_product->getMinRetailPrice();
  $price_max = max($rt_shop_product->getMaxRetailPrice(), $rt_shop_product->getMaxPromotionPrice());

  if($rt_shop_product->isOnPromotion())
  {
    $price_str .=  '<span class="rt_shop_regular_price">' . format_currency($price_max, $currency) . '</span> - ' . format_currency($price_min, $currency);
  }
  elseif($price_min !== $price_max)
  {
    $price_str .=  format_currency($price_min, $currency) . $config['between_string'] . format_currency($price_max, $currency);
  }
  else
  {
    $price_str .=  format_currency($rt_shop_product->getMinRetailPrice(), $currency);
  }

  return  $price_str;
}<commit_msg>Updated helper format.<commit_after><?php

use_helper('I18N');

function price_for($rt_shop_product, $config = array())
{
  $format_was = '<span class="price-before">%s<em>%s</em></span>';
  $format_now = '<span class="price-now">%s<em>%s</em></span>';
  
  $config['format_was'] = isset($config['format_was']) ? $config['format_was'] : $format_was;
  $config['format_now'] = isset($config['format_now']) ? $config['format_now'] : $format_now;
  $config['format_now_preffix_from'] = isset($config['format_now_preffix_from']) ? $config['format_now_preffix_from'] : __('From') .' ';
  $config['format_now_preffix_only'] = isset($config['format_now_preffix_only']) ? $config['format_now_preffix_only'] : __('Only') .' ';
  $config['format_now_preffix_now_only'] = isset($config['format_now_preffix_now_only']) ? $config['format_now_preffix_now_only'] : __('Now only') .' ';
  $config['format_now_preffix_now_from_only'] = isset($config['format_now_preffix_now_from_only']) ? $config['format_now_preffix_now_from_only'] : __('Now from only') .' ';
  $config['format_was_preffix'] = isset($config['format_was_preffix']) ? $config['format_was_preffix'] : __('Was') .' ';

  $currency  = sfConfig::get('app_rt_currency', 'USD');

  $price_min = $rt_shop_product->isOnPromotion() ? $rt_shop_product->getMinPromotionPrice() : $rt_shop_product->getMinRetailPrice();
  $price_max = max($rt_shop_product->getMaxRetailPrice(), $rt_shop_product->getMaxPromotionPrice());

  if(!$rt_shop_product->isOnPromotion())
  {
    return sprintf($config['format_now'], $price_min != $price_max ? $config['format_now_preffix_from'] : $config['format_now_preffix_only'], format_currency($price_min, $currency));
  }

  $string = '';

  $retail_prices_match = ($rt_shop_product->getMaxRetailPrice() == $rt_shop_product->getMinRetailPrice());
  $promo_prices_match =  ($rt_shop_product->getMaxPromotionPrice() == $rt_shop_product->getMinPromotionPrice());

  if($retail_prices_match)
  {
    $string = sprintf($config['format_was'], $config['format_was_preffix'], format_currency($price_max, $currency));
  }
  
  $string .= ' '. sprintf($config['format_now'], $promo_prices_match ? $config['format_now_preffix_now_only'] : $config['format_now_preffix_now_from_only'], format_currency($price_min, $currency));

  return $string;
}
{'fraction_non_alphanumeric': 0.18839730442426017, 'fraction_numerical': 0.0005859947260474656, 'mean_word_length': 7.556390977443609, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3726952', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1236, 'n_words': 133}