把magento“排序依据”“每页显示”旁边

时间:2012-11-27 16:22:05

标签: magento layout

我正在尝试将magento“sort by”下拉选项移动到“Show X per page”下拉列表的旁边。我有点成功。

在toolbar.phtml文件(Template / catalog / product / list / toolbar.phtml)中,我使用了“sort-by”类将div移动并将其内容移到“pager”div中(同样的文件(toolbar.phtml)),我也修改了css使它看起来正确。

现在,如果我访问我网站中的任何页面,顶部工具栏没有功能,但底部的一个很好吗?!?!?

即使在list.phtml中,它们也被同一行调用 - >

<?php echo $this->getToolbarHtml() ?>

任何人都有任何可能导致这种情况的想法?

我的工具栏代码在

下面
<div class="toolbar">
    <div class="pager">
        <p class="amount">
            <?php if($this->getLastPageNum()>1): ?>
                <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
            <?php else: ?>
                <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
            <?php endif; ?>
        </p>

            /****** This div was moved from below ******/
        <div class="sort-by">
            <label><?php echo $this->__('Sort By') ?></label>
            <select onchange="setLocation(this.value)">
            <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
                <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                    <?php echo $this->__($_order) ?>
                </option>
            <?php endforeach; ?>
            </select>
            <?php if($this->getCurrentDirection() == 'desc'): ?>
                <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
            <?php else: ?>
                <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
            <?php endif; ?>
        </div>
        <div class="limiter">
            <label><?php echo $this->__('Show') ?></label>
            <select onchange="setLocation(this.value)">
            <?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
                <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
                    <?php echo $_limit ?>
                </option>
            <?php endforeach; ?>
            </select> <?php echo $this->__('per page') ?>
        </div>

        <?php echo $this->getPagerHtml() ?>



    </div>

    <?php if( $this->isExpanded() ): ?>
    <div class="sorter">
        <?php if( $this->isEnabledViewSwitcher() ): ?>
        <p class="view-mode">
            <?php $_modes = $this->getModes(); ?>
            <?php if($_modes && count($_modes)>1): ?>
            <label><?php echo $this->__('View as') ?>:</label>
            <?php foreach ($this->getModes() as $_code=>$_label): ?>
                <?php if($this->isModeActive($_code)): ?>
                    <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
                <?php else: ?>
                    <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
                <?php endif; ?>
            <?php endforeach; ?>
            <?php endif; ?>
        </p>
        <?php endif; ?>
    /****** Div moved from here ******/

    </div>
    <?php endif; ?>
</div>

1 个答案:

答案 0 :(得分:1)

是的,正如你所说,可能会有div重叠。所以,您的顶部工具栏位于透明div下,可阻止鼠标单击触发器。链接到该页面有助于更快地找到问题。