0

我的 Magento 商店中有一些代码可以在 2 列表中动态显示类别。如何将此表更改为 1 列而不是 2 列?我似乎找不到更改列号的部分。

<table width="100%" >
<colgroup>
<?php
$wCol = (int)($gWidth / $colCount); 
$oneTdWidth = ($gWidth - $offset * ($colCount - 1)) / $colCount;
for ($i = 0; $i < $colCount; $i++) { ?>
    <col width="<?php echo $oneTdWidth; ?>">
<?php } ?>
</colgroup>
<tbody>
<?php  
$catIndex = 0;
foreach ($map as $type => $items) {
    foreach ($items as $row) {
        ?><tr><?php 
        foreach ($row as $item) {
            echo $this->renderArray($item, '<td rowspan="%rowspan%" colspan="%colspan%"">');
            switch ($item['type']) {
                case 1:
                    if (isset($cats[$catIndex])) {
                        $text = 'Shop';
                        $class = '';
                        $nameCat = $cats[$catIndex]->getName();
                        if (($colCount / $item['colspan']) >= 3) {
                            $text = '&nbsp;';
                            $class = ' shop-btn-min';
                            $nameCat = substr($cats[$catIndex]->getName(), 0, 35);
                            if (strlen($cats[$catIndex]->getName()) > 35) {
                                $nameCat .= '...';
                            }
                        }
                        //$tdWidth = (int)($oneTdWidth * $item['colspan'] + $offset * ($item['colspan'] - 1));
                        echo $this->renderBoutique(
                            $cats[$catIndex], 
                            '<div class="shop" style="background: url(%image_url%)>
                              <a href="%url%">
                                <div class="brandholder">
                                    <div class="title">
                                        <h2>' . $nameCat . '</h2><span class="count-down hasCountdown">Ends in</span>
                                        <span class="count-down"></span>
                                        <span class="cntdown-source" style="display: none;">%privatesale_date_end_left%</span> 
                                    </div>
                                    <div class="shop-btn'. $class . '">'.$text.'</div>
                                </div>
                              </a>
                            </div>'); 
                        $catIndex++; 
                    }
                    break;
                case 2:
                    $banner = Mage::helper('privatesales/list')->getActiveBanner($item, $type);
                    if ($banner) {
                        //$tdWidth = (int)($oneTdWidth * $item['colspan'] + $offset * ($item['colspan'] - 1));
                        echo $this->renderBanner(
                            $banner,
                            '<div class="shop" style="background:url(%image_url%); height: %image_height%px;"><a href="%href%"></a></div>'
                        );
                    }
                    break;
            } 
            echo '</td>';
        }
        ?></tr><?php 
    }
}
?>  
    <!-- FIXER -->
    <tr class="picha" style="visibility: hidden;">
    <?php 
    for ($i = 0; $i < $colCount; $i++) { ?>
        <td  class="no-repeat shop"></td>
    <?php } ?>
    </tr>       
</tbody>

4

1 回答 1

0

正确的答案是

$colCount = 1
于 2013-04-13T04:12:26.387 回答