下面的这个脚本在不同的生产线上输出产品的所有规格(在白色和灰色之间切换)。
我希望脚本以 2 x 2 的形式输出规格。
所以而不是:
label - value 
label - value 
label - value
我想:
label - value    label - value 
label - value    label - value 
label - value    label - value
有谁知道我应该如何实现这一目标?
当前代码是:
<?php
$color='grey';
$attributes = $_product->getAttributes();
foreach ($attributes as $attribute) {
    if ($attribute->getIsVisibleOnFront() and $attribute->getFrontend()->getValue($_product)) 
    {
    ?>
        <div class="row-<?php $color=($color=='grey')? 'white' : 'grey'; echo $color; ?>">
            <div class="name-detail">
                <?php echo $attribute->getFrontend()->getLabel($_product); ?>
            </div>
            <div class="description">
                <?php echo $attribute->getFrontend()->getValue($_product); ?>
            </div>
        </div>
    <?php
    }
}
?>