Price API

http://www.ubercart.org/docs/developer/11375/price_api

 

  1. function example_cart_item($op, &$item) {
  2. if($op == 'load'){
  3. $item->price = $item->price + 10; //add 10 just for the example
  4. }
  5. }

  1. function example_uc_price_handler() {
  2.   return array(
  3.     'alter' => array(
  4.       'title' => t('Distributor price handler'),
  5.       'description' => t('Handles price markups by customer roles and price table.'),
  6.       'callback' => 'example_price_alterer',
  7.     ),
  8.   );
  9. }

  1. function example_price_alterer(&$price_info, $context, $options = array()){
  2.  
  3.   $base_price = $context["subject"]["node"]->cost;
  4.  
  5.   $sales_price = $base_price + $markup;
  6.  
  7.   $price_info["price"] = $sales_price;
  8.  
  9.   return;
  10.  
  11. }