=== modified file 'uc_store/includes/uc_price.inc' --- uc_store/includes/uc_price.inc 2009-04-13 18:37:31 +0000 +++ uc_store/includes/uc_price.inc 2009-04-18 00:57:57 +0000 @@ -19,10 +19,13 @@ * * 'revision': * Default: 'themed' - * - 'original' => The original price, - * - 'altered' => Price after passing through the alterer(s), - * - 'formatted' => Price after passing through the formatter, - * - 'themed' => Price after passing through the theme layer. + * - 'original' => Original price value, + * - 'altered' => Original price passed through the alterer(s), + * - 'formatted-original' => Original price passed through the formatter, + * - 'formatted' => Altered price passed through the formatter, + * - 'themed-original' => Formatted original price passed through the + * theme layer, + * - 'themed' => Formatted altered price passed through the theme layer. * * @param $options * An associative array containing options that will be passed through to @@ -80,15 +83,10 @@ ); // Clamp to allowed revisions. - switch ($context['revision']) { - case 'original': - case 'altered': - case 'formatted': - case 'themed': - break; + $revisions = array('original', 'altered', 'formatted-original', 'formatted', 'themed-original', 'themed'); - default: - $context['revision'] = 'themed'; + if (!in_array($context['revision'], $revisions)) { + $context['revision'] = 'themed'; } // Get all the active handlers. @@ -117,7 +115,7 @@ } else { // Otherwise, build it from scratch. - $values['original'] = $price_info['value'] * $price_info['qty']; + $values['original'] = $price_info['price'] * $price_info['qty']; // Alter the price, context, and options. foreach ($handlers['alterers'] as $alterer) { @@ -133,12 +131,14 @@ // Otherwise use the actual numeric and formatted numeric values. $values['altered'] = $price_info['price'] * $price_info['qty']; - // Format the price using the formatter callback. + // Format the original and altered prices using the formatter callback. + $values['formatted-original'] = $handlers['formatter']($values['original'], $options); $values['formatted'] = $handlers['formatter']($values['altered'], $options); } // Theme the price. - $values['themed'] = theme('uc_price', $values['formatted'], $context, $options);; + $values['themed-original'] = theme('uc_price', $values['formatted-original'], $context, $options); + $values['themed'] = theme('uc_price', $values['formatted'], $context, $options); // Cache this price values. // TODO: Determine if we can safely cache these things...