No replies
fmueller's picture
Offline
Joined: 04/02/2009
Juice: 33

Hello,

I would like to add an information like "excl. VAT" only to prices in certain locations. In UC 2.0-rc3 the array $context contained the index 'location' which was very helpful for doing that. (I had to change the function definition of uc_store_price_handler_format($price, $options) to uc_store_price_handler_format($price, $context, $options), modify the function call appropriately so that it gets the array $context and then add something like

<?php
  $display_info
= array('product-view', 'checkout-review-line-item',
                 
'cart-review-item', 'product-tapir-table');
  if (
in_array($context['location'], $display_info)) {
   
$output .= '<br />excl. VAT';
  }
?>

to the function uc_store_price_handler_format(). See also http://www.ubercart.org/forum/development/10938/usage_price_formatter.)

Now in UC 2.2 the index 'location' is not available in the array $context anymore. So how can I achieve what I have done with UC 2.0-rc3?

Additional note: grep shows that there are still three places where the 'location' index is available in UC 2.2:

$ egrep -r -i --line-number --color --context=0 -e "location' =>" ./
./docs/hooks.php:1431:      '@amount' => uc_price($amount, array('location' => 'hook-payment', 'revision' => 'formatted-original')),
./shipping/uc_weightquote/uc_weightquote.module:60:      'location' => 'shipping-weightquote-method-node-form',
./shipping/uc_weightquote/uc_weightquote.admin.inc:17:    'location' => 'shipping-weightquote-method-admin',

Have a nice day and thanx very much for a reply,

Fabian