2012-10-09 66 views
0

我使用Joomla的VirtueMart 2.0.10! 2.5.6和我的问题是每个产品的自动生成的pdf文件不包括我的自定义字段。我不是PHP的专家,但我认为,在文件theese行/components/com_virtuemart/views/productdetails/tmpl/default_pdf.php有事情做吧,开始行145:virtuemart 2产品pdf不显示自定义字段

<?php // Product custom_fields TODO relation to Childs 
if (!empty($this->product->customfields)) { ?> 
    <div class="product-fields"> 
    <?php 
    $custom_title = null ; 
    foreach ($this->product->customfields as $field){ 
     ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>"> 
     <?php if ($field->custom_title != $custom_title) { ?> 
      <span class="product-fields-title" ><strong><?php echo JText::_($field->custom_title); ?></strong></span> 
      <?php //echo JHTML::tooltip($field->custom_tip, $field->custom_title, 'tooltip.png'); 
     } ?> 
     <span class="product-field-display"><?php echo $field->display ?></span> 
     <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span> 
     </div> 
     <?php 
     $custom_title = $field->custom_title; 
    } ?> 
    </div> 
    <?php 
} // Product custom_fields END ?> 

我测试在上面的if语句和它的executetd之后添加一个else语句来回显一些文本。所以显然没有自定义字段...但真的有...

我还没有发现任何其他人遇到这个问题,我认为这很奇怪,但我不认为我搞砸了。我已对/components/com_virtuemart/views/productdetails/tmpl/default.php文件进行了一些更改。

回答

0

我删除,我在我的问题进入,并从该文件下面的代码/components/com_virtuemart/views/productdetails/tmpl/default.php取代了它的所有代码:

<?php 
$custom_title = null; 
foreach ($this->product->customfieldsSorted['normal'] as $field) { // I set the position to normal 
if ($field->is_hidden) 
continue; 
if ($field->display) { 
?> 
<?php if ($field->custom_title != $custom_title) { ?> 
<b><?php echo JText::_($field->custom_title); ?></b><br /> 

<?php 
if ($field->custom_tip) 
echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png'); 
} 
?> 
<?php echo $field->display ?><br /> 
<?php echo jText::_($field->custom_field_desc) ?><br /> 
<?php 
$custom_title = $field->custom_title; 
} 
} 
?> 

我我没有专家,但这对我有用。 PDF现在包含自定义字段。

正如您在代码中的评论中所见,我将位置更改为'正常'。其他位置似乎是'ontop''onbot'。但我不会改变这个设置,所以我放弃了。

编辑:我忘了提及我添加了一些其他的HTML代码到该段,如<br /><b>只是为了出现。所以没什么大不了,只是为了说明代码并非完全像它在文件中那样default.php

相关问题