【问题标题】:Drupal, Ubercart, products templates (prices templates)Drupal、Ubercart、产品模板(价格模板)
【发布时间】:2011-03-14 05:26:15
【问题描述】:

我想更改我的 Ubercart 产品的模板。更详细地说,我想在每个价格前添加标签“来自...”。但我找不到模板。

我也在使用主题开发者模块,这就是我得到的:

zen_uc_product_price

但是我找不到这样的文件。

谢谢

【问题讨论】:

    标签: drupal drupal-6 ubercart


    【解决方案1】:

    您也可以创建一个 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”部分。

    【讨论】:

    • 这里是一个主题产品页面的教程:ubercart.org/forum/development/3868/…,只是不要使用 uc_currency 格式,uc_price 是正确的方法,特别是如果您在多价格模块中使用价格处理程序并且uc_vat
    【解决方案2】:

    要为价格添加前缀或后缀,您可以访问 /admin/store/settings/store/编辑/格式

    【讨论】:

    • 具体在哪里?这就是我所拥有的:dl.dropbox.com/u/72686/price.png。如果您的意思是“当前符号”字段,这不起作用,因为它取代了货币符号。我只想在它之前添加“发件人:”。
    • 您只需在货币符号字段中输入“发件人:£”即可。
    • 我不能这样做,因为我正在使用多币种自定义模块来处理欧元和英镑。而且我也不想在购物车中显示“发件人”。有没有我可以编辑的产品 php 模板?
    猜你喜欢
    • 1970-01-01
    • 2012-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-02
    • 2011-07-26
    • 2012-08-19
    • 2014-08-07
    相关资源
    最近更新 更多