在magento的表格视图中的产品规格..!

时间:2015-04-09 03:56:26

标签: php magento

我在magento的描述中插入数据...... !! 但我得到一个段落...... !! 但为了获得表格格式,我必须手动编写HTML代码。 那么有没有自动获取表格格式的解决方案。

例如,如下图:

enter image description here

1 个答案:

答案 0 :(得分:0)

为规范创建最大属性添加。

喜欢spec_1.spec_2,......

然后以表格格式在规范部分显示这些属性值。

例如:

    <table class="data-table" id="product-attribute-specs-table-4">
        <col width="25%" />
        <col />
        <tbody>
        <?php if (0 == strcmp($attributeSetName, 'Clothing')): ?>
            <tr>
                <th class="label">Clothing Shape</th>
                <td class="data"><?php echo $_product->getClothing_shape() ?></td>
            </tr>
            <tr>
                <th class="label">Outer Fabric</th>
                <td class="data"><?php echo $_product->getOuter_fabric() ?></td>
            </tr>   
            <tr>
                <th class="label">Clothing Lining</th>
                <td class="data"><?php echo $_product->getClothing_lining() ?></td>
            </tr>   
        <?php elseif (0 == strcmp($attributeSetName, 'Sleeping Bags')): ?>      
            <tr>
                <th class="label">Outer Fabric</th>
                <td class="data"><?php echo $_product->getOuter_fabric() ?></td>
            </tr>
            <tr>
                <th class="label">Inner Fabric</th>
                <td class="data"><?php echo $_product->getInner_fabric() ?></td>
            </tr>   
            <tr>
                <th class="label">Filling</th>
                <td class="data"><?php echo $_product->getFilling() ?></td>
            </tr>   
        <?php endif; ?>     
        </tbody>
    </table>

<script type="text/javascript">decorateTable('product-attribute-specs-table-4')</script>