Projet

Général

Profil

Révision 503b3f7b

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/commerce_price_flexyformatter/commerce_price_flexyformatter.module
28 28
        'base' => array('selection' => array('base_price' => 'base_price'), 'weight' => 0, 'calc' => 'default'),
29 29
        'reference1' => array('class' => '.flexy-striked', 'weight' => -10, 'calc' => 'default'),
30 30
        'reference2' => array('weight' => 10, 'calc' => 'default'),
31
        'raw' => array(),
31 32
        // need this to load all price components, hoping will not be changed
32 33
        'calculation' => 'calculated_sell_price',
33 34
      ),
......
169 170
    '#default_value' => $settings['reference2']['weight'],
170 171
    '#size' => 6,
171 172
  );
173
  $element['raw'] = array(
174
    '#type' => 'checkbox',
175
    '#title' => t('Use unformatted amount'),
176
    '#default_value' => $settings['raw'],
177
  );
172 178

  
173 179
  return $element;
174 180
}
......
241 247
      $summary[] = t('2nd reference amount not enabled.');
242 248
    }
243 249
  }
244

  
250
  if (isset($settings['raw']) && $settings['raw']) $summary[] = t('Using unformatted amounts.');
245 251
  return implode('<br />', $summary);
246 252
}
247 253
/**
......
322 328
                'weight' => (isset($display['settings']['reference2']['weight'])?$display['settings']['reference2']['weight']:null),
323 329
                'enabled' => (isset($display['settings']['reference2']['enabled'])?$display['settings']['reference2']['enabled']:0),
324 330
              ),
331
              'raw' =>(isset($display['settings']['raw'])?$display['settings']['raw']:false),
325 332
              'currency_code' => $item['currency_code'],
326 333
            )
327 334
          ),
......
342 349
  uasort($variables, 'drupal_sort_weight');
343 350
  drupal_add_css(drupal_get_path('module', 'commerce_price_flexyformatter') . '/commerce_price_flexyformatter.css');
344 351
  foreach ($variables as $key => $variable) {
345
   if (is_numeric($variable['weight']) && ($key == 'base' || $variable['enabled'])) {
346
    $output .= '<span class=flexy-item' . ($variable['class']?' ' . $variable['class']:'') . '><span class"flexy-title">' . $variable['label'] . '</span><span class="flexy-amount">' . commerce_currency_format($variable['amount'], $variables['currency_code']) . '</span></span> ';
352
   if (isset($variable['weight']) && is_numeric($variable['weight']) && ($key == 'base' || $variable['enabled'])) {
353
    $output .= '<span class=flexy-item' . ($variable['class']?' ' . $variable['class']:'') . '><span class"flexy-title">' . $variable['label'] . '</span><span class="flexy-amount">' . ($variables['raw'] == false ? commerce_currency_format($variable['amount'], $variables['currency_code']): commerce_currency_amount_to_decimal($variable['amount'], $variables['currency_code'])) . '</span></span> ';
347 354
   }
348 355
  }
349 356

  

Formats disponibles : Unified diff