2017-06-21 99 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

相關問題