2012-11-24 127 views
0

如何仅在相关产品区域显示产品缩略图,我当前的代码也显示链接,即image带有产品名称的href标签。我只想显示缩略图joomla中的相关产品

<?php 
    foreach($this->product->customfieldsRelatedProducts as $field) { 
     echo $field->display; 
    } 
?> 

回答

0

我认为代码会帮助你。

<?php 
    $image_dir = JURI::root()."images/"; 

    foreach($this->product->customfieldsRelatedProducts as $field) { 
     echo $field->display; 
     ?> 
      <img src="<?php echo $image_dir.$field->image; ?>" alt="<?php echo $field->title ?>" /> 
     <?php 
    } 
?> 
+0

同样的结果,没有任何反应 –

+1

<?PHP的 \t的foreach($这 - >产品 - > customfieldsRelatedProducts为$字段){ \t $现场>显示= preg_replace函数('#()。*? ()#','$ 1 $ 2',$ field-> display); \t?> <?PHP回声$现场>显示?> \t \t