【发布时间】:2011-03-14 05:26:15
【问题描述】:
我想更改我的 Ubercart 产品的模板。更详细地说,我想在每个价格前添加标签“来自...”。但我找不到模板。
我也在使用主题开发者模块,这就是我得到的:
zen_uc_product_price
但是我找不到这样的文件。
谢谢
【问题讨论】:
我想更改我的 Ubercart 产品的模板。更详细地说,我想在每个价格前添加标签“来自...”。但我找不到模板。
我也在使用主题开发者模块,这就是我得到的:
zen_uc_product_price
但是我找不到这样的文件。
谢谢
【问题讨论】:
您也可以创建一个 node-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']['#value']; ?>
除非你想以折扣价为主题:-)
刚刚从我的一个项目中复制出来。
最后:您可能可以使用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;
}
检查 $context 变量何时添加“From”部分。
【讨论】:
要为价格添加前缀或后缀,您可以访问 /admin/store/settings/store/编辑/格式
【讨论】: