views:

36

answers:

2

hi,

I want to change the template of my Ubercart products. More in detail, I want to add the label "From..." in front of each price. But I cannot find the template to do it.

I'm also using theme developer module and this is what I get:

zen_uc_product_price < phptemplate_uc_product_price < theme_uc_product_price

But I cannot find such files.

thanks

A: 

To add a prefix or suffix to the price, you can go to /admin/store/settings/store/edit/format

Tom
where exactly ? This is what I have: http://dl.dropbox.com/u/72686/price.png . If you meant the field "Current Sign", this doesn't work, because it replaces the currency sign. I just want to add "From:" before it.
Patrick
You just write "From: £" in the currency sign field.
Tom
I cannot do that, because I'm using multi-currency custom module to handle euros and pounds. And I don't want to display "From" in the cart as well. Is there any product php template I can edit ?
Patrick
A: 

You can also make a node-product.tpl.php file, if so this is the way to get prices:

 <?php
    $context = array(
      'type' => 'product',
      'revision' => 'altered', // using altered to get the bare price with no themeing
      'field' => 'sell_price',
      'subject' => array('node' => $node)
    );
    $dp = uc_price($node->sell_price, $context);
    $context['field'] = 'list_price';
    $lp = uc_price($node->list_price, $context);
    ?>


  <div class="price clear-block <?php if($dp != $lp) print 'discounted'; ?>">
    <?php print 'From: ' . $node->content['display_price']['#value']; ?>
    <?php //print $node->content['list_price']['#value']; ?>
  </div>

This became a bit more than it should be: Use: content['display_price']['#value']; ?>

Unless you want to theme discounted pricing :-)

Just copied out from one of my projects.

Last: you can probably use theme_uc_product_price: you add a function in template.php (Pasting in default implementation from uc_product.module

function zen_uc_product_price($price, $context, $options = array()) {
  $output = '<div class="product-info '. implode(' ', (array)$context['class']) .'">';
  $output .= uc_price($price, $context, $options);
  $output .= '</div>';

  return $output;
}

Inspect the $context variable for when to add the "From" part.

Tom
Here is a tutorial for theming product pages:http://www.ubercart.org/forum/development/3868/nifty_products_tutorial_part_1 , just dont use uc_currency format, uc_price is the right way to do it, especially if you use a price handler as in a multi price module and uc_vat
Tom

related questions