2017-06-21 157 views

回答

0

嗯,这是Magento的核心问题是:https://github.com/magento/magento2/issues/9961,但是你可以用下面的,现在的解决方案。

获得从attributes.phtml文件:/vendor/magento/module-catalog/view/frontend/templates/product/view/attributes.phtml

复制这个文件,并在你的主题贴:/应用/设计/前端/ [你的包装]/[你的主题] /模板/目录/产品/视图/属性.phtml。

搜索下面的代码:

<tr> 
     <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th> 
     <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> 
    </tr> 

通过下面的代码替换上面代码:

<?php 
     $_attribute = $_product->getResource()->getAttribute($_data['code']); 

     if (!$_attribute->getFrontend()->getValue($_product)) { 
      continue; 
     } 
    ?> 

    <tr> 
     <th class="label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th> 
     <td class="data"><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td> 
    </tr> 

以上解决方案在Magento 2.2

相关问题