2010-07-10 106 views
0

我想更改我的Ubercart产品的模板。更详细地说,我想在每个价格前添加“From ...”标签。但是我找不到要执行的模板。Drupal,Ubercart,产品模板(价格模板)

我还使用主题开发模块,这就是我得到:

zen_uc_product_price < phptemplate_uc_product_price < theme_uc_product_price

但我无法找到这些文件。

感谢

回答

0

你也可以做一个节点product.tpl PHP文件,如果是这样,这是获取价格的方式:

<?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> 

这成为多一点比它应该是: 用途: 内容[“DISPLAY_PRICE”] [“#值”]; ?>

除非你想主题优惠价格:-)

单从我的项目之一复制出来。

末:你大概可以使用theme_uc_product_price: 你的template.php(粘贴在默认实现从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; 
} 

检查的时添加了“从” $上下文变量增加一个功能部分

+0

这里是一个教程主题产品页面: http://www.ubercart.org/forum/development/3868/nifty_products_tutorial_part_1,只是不使用uc_currency格式,uc_price是正确的方式来做到这一点,特别是如果您使用价格处理程序,如多价格模块和uc_vat – Tom 2010-07-11 10:03:41

0

要添加前缀或后缀的价格,你可以去 /管理/存储/设置/存储/编辑/格式

+0

究竟是哪里?这就是我所拥有的:http://dl.dropbox.com/u/72686/price.png。如果你的意思是“当前签名”字段,这是行不通的,因为它替换货币符号,我只想在它之前加上“From:” – aneuryzm 2010-07-10 19:58:41

+0

您只需在货币符号字段中输入“From:£” – Tom 2010-07-11 09:24:16

+0

I c annot做到这一点,因为我使用多货币自定义模块来处理欧元和英镑。而且我也不想在购物车中显示“发件人”。有没有我可以编辑的任何产品的PHP模板? – aneuryzm 2010-07-11 09:29:51