Php “如何显示”;按“购买”;“中的左侧边栏属性列表”;下拉列表“;像是;按“排序”;工具栏?

Php “如何显示”;按“购买”;“中的左侧边栏属性列表”;下拉列表“;像是;按“排序”;工具栏?,php,magento,Php,Magento,如何像“排序依据”工具栏一样在“下拉菜单”中显示“按商店”左侧边栏属性列表 我想将属性列表显示为与“排序依据”工具栏相同的下拉列表 我的toolbar.phtml代码是 <?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in

如何像“排序依据”工具栏一样在“下拉菜单”中显示“按商店”左侧边栏属性列表

我想将属性列表显示为与“排序依据”工具栏相同的下拉列表

我的toolbar.phtml代码是

    <?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list toolbar
 *
 * @see Mage_Catalog_Block_Product_List_Toolbar
 */
?>
<?php
/**
 * - Pager moved after sorter. Show pager only if there are pages.
 * - Amount and limiter moved inside sorter
 * - Changed order of the main elements
 */
?>
<?php if($this->getCollection()->getSize()): ?>
<div class="toolbar">

    <?php if( $this->isExpanded() ): ?>
    <div class="sorter">

        <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>

        <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 class="category-desc ic ic-arrow-up" href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"></a>
            <?php else: ?>
                <a class="category-asc ic ic-arrow-down" href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"></a>
            <?php endif; ?>
        </div>

        <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 class="category-desc ic ic-arrow-up" href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"></a>
            <?php else: ?>
                <a class="category-asc ic ic-arrow-down" href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"></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><span class="per-page"> <?php echo $this->__('per page'); ?></span>
        </div>

        <?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 //Removed spaces from the foreach loop to improve layout of the buttons ?>
                <?php foreach ($this->getModes() as $_code=>$_label): ?><?php $codeToLower = strtolower($_code); if($this->isModeActive($_code)): ?><span title="<?php echo $_label ?>" class="<?php echo $codeToLower; ?> ic ic-<?php echo $codeToLower; ?>"></span><?php else: ?><a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo $codeToLower; ?> ic ic-<?php echo $codeToLower; ?>"></a><?php endif; ?><?php endforeach; ?>
            <?php endif; ?>
        </p>
        <?php endif; ?>

    </div> <!-- end: sorter -->
    <?php endif; ?>

    <?php //Show pager only if there are pages ?>
    <?php if ($pagerHtml = trim($this->getPagerHtml())): ?>
    <div class="pager">
        <?php echo $pagerHtml; ?>
    </div>
    <?php endif; ?>

</div>
<?php endif ?>


我找到了解决方案,我得到了这个扩展,它工作得非常完美。但我如何从下拉列表中隐藏未分配给任何产品的空属性???这个扩展有什么变化吗?我找到了解决方案,我得到了这个扩展,它工作得非常完美。但我如何从下拉列表中隐藏未分配给任何产品的空属性???这个扩展有什么变化吗?
<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>

<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_collectionSize = $_productCollection->count();
?>

<?php if ($_collectionSize && $tmpHtml = $this->getChildHtml('block_category_above_collection')): ?>
    <div class="block_category_above_collection std"><?php echo $tmpHtml; ?></div>
<?php endif; ?>

<?php if(!$_collectionSize): ?>
    <?php if ($tmpHtml = $this->getChildHtml('block_category_above_empty_collection')): ?>
        <div class="block_category_above_empty_collection std"><?php echo $tmpHtml; ?></div>
    <?php else: ?>
        <p class="note-msg empty-catalog"><?php echo $this->__('There are no products matching the selection.') ?></p>
    <?php endif; ?>
<?php else: ?>

<?php
    $_helper = $this->helper('catalog/output');
    $theme = $this->helper('ultimo');
    $helpLabels = $this->helper('ultimo/labels');
    $helpTemplate = $this->helper('ultimo/template');
    $helpImg = $this->helper('infortis/image');

    //Default image size
    $imgWidth = 295;
    $imgHeight = 295;

    //Aspect ratio settings
    if ($theme->getCfg('category/aspect_ratio'))
        $imgHeight = 0; //Height will be computed automatically (based on width) to keep the aspect ratio

    //Hide toolbar
    $hideToolbar = false;
    if ($this->getHideToolbar())
    {
        $hideToolbar = true;
    }
?>

<div class="category-products">
    <?php if (!$hideToolbar): ?>
        <?php echo $this->getToolbarHtml() ?>
    <?php endif; ?>
    <?php if($this->getMode()!='grid'): //List mode ?>

    <?php
        //Get list configuration array
        $lc = $theme->getCfgGroup('category_list');

        //List classes
        $listClasses = '';
        if ($lc['hover_effect'])
            $listClasses = ' hover-effect';


    ?>

    <?php $_iterator = 0; ?>
    <ul class="products-list<?php if($listClasses) echo $listClasses; ?>" id="products-list">
    <?php foreach ($_productCollection as $_product): ?>
        <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">

            <?php //Product Image ?>
            <div class="product-image-wrapper grid12-4 mobile-grid-half">

                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image" style="max-width:<?php echo $imgWidth; ?>px;">
                    <img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight, 'small_image'); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

                    <?php if ($theme->getCfg('category/alt_image')): ?>
                        <?php echo $theme->getAltImgHtml($_product, $imgWidth, $imgHeight); ?>
                    <?php endif; ?>

                    <?php echo $helpLabels->getLabels($_product); //Product labels ?>
                </a>

            </div> <!-- end: product-image-wrapper -->

            <?php //Product description ?>
            <div class="product-shop grid12-5 mobile-grid-half">
                <div class="product-shop-inner">
                    <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
                    <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
                    <?php if($_product->getRatingSummary()): ?>
                        <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                    <?php endif; ?>

                    <div class="desc std">
                        <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
                    </div>
                </div>
            </div>

            <div class="right-column grid12-3 mobile-grid-half">
                <?php echo $this->getPriceHtml($_product, true) ?>
                <?php if($_product->isSaleable()): ?>
                    <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
                <?php else: ?>
                    <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                <?php endif; ?>

                <?php
                if ($lc['addtolinks_simple'])
                    echo $helpTemplate->getCategoryAddtoLinks($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
                else
                    echo $helpTemplate->getCategoryAddtoLinksComplex($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
                ?>
            </div>

        </li>
    <?php endforeach; ?>
    </ul>
    <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>

    <?php else: //Grid mode ?>

    <?php
        //Get grid configuration array
        $gc = $theme->getCfgGroup('category_grid');

        //Get number of columns (from parameter or from theme config)
        $columnCount = 3;
        if ($this->getGridColumnCount())
        {
            $columnCount = $this->getGridColumnCount();
        }
        else
        {
            $columnCount = $gc['column_count'];
        }

        //Grid classes
        $gridClasses = '';
        $productNameClasses = '';
        if ($gc['display_name'] == 2 && $gc['display_name_single_line'] == true)
            $gridClasses .= ' single-line-name';
        if ($gc['display_name'] == 1)
            $productNameClasses .= ' display-onhover';
        if ($gc['centered'])
            $gridClasses .= ' centered';
        if ($gc['hover_effect'])
            $gridClasses .= ' hover-effect';
        if ($gc['equal_height'])
            $gridClasses .= ' equal-height';

        //Size of grid elements
        if ($gc['elements_size'])
        {
            $gridClasses .= ' size-' . $gc['elements_size'];
        }
        else
        {
            //Calculate size based on number of columns
            if ($columnCount >= 6)
            {
                $gridClasses .= ' size-xs';
            }
            elseif ($columnCount >= 4)
            {
                $gridClasses .= ' size-s';
            }
        }

        //Container "actions" at the bottom of the grid item stores button and add-to links
        //If at least one of those elements was set as "Display on hover" but no element was set as "Display":
        //apply appropriate classes to the container.
        $actionsClasses = '';
        if ($gc['display_addtocart'] == 1 || ($gc['display_addtolinks'] == 1 && !$gc['addtolinks_simple']))
        {
            $actionsClasses = ' display-onhover';
        }
        if ($gc['display_addtocart'] == 2 || ($gc['display_addtolinks'] == 2 && !$gc['addtolinks_simple']))
        {
            $actionsClasses = '';
        }
    ?>

    <ul class="products-grid category-products-grid itemgrid itemgrid-adaptive itemgrid-<?php echo $columnCount; ?>col<?php if($gridClasses) echo $gridClasses; ?>">
        <?php foreach ($_productCollection as $_product): ?>
            <li class="item">

                <div class="product-image-wrapper" style="max-width:<?php echo $imgWidth; ?>px;">

                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true); ?>" class="product-image">
                        <img src="<?php echo $helpImg->getImg($_product, $imgWidth, $imgHeight, 'small_image'); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true); ?>" />

                        <?php if ($theme->getCfg('category/alt_image')): ?>
                            <?php echo $theme->getAltImgHtml($_product, $imgWidth, $imgHeight); ?>   
                        <?php endif; ?>

                        <?php echo $helpLabels->getLabels($_product); //Product labels ?>
                    </a>

                    <?php //Add-to links
                        if ($gc['display_addtolinks'] != 0 && $gc['addtolinks_simple'])
                        {
                            if ($gc['display_addtolinks'] == 1) //Display on hover
                                echo $helpTemplate->getCategoryAddtoLinksIcons($_product, $this->getAddToCompareUrl($_product), 'addto-links-icons addto-onimage display-onhover');
                            else //Always display
                                echo $helpTemplate->getCategoryAddtoLinksIcons($_product, $this->getAddToCompareUrl($_product), 'addto-links-icons addto-onimage');
                        }
                    ?>

                </div> <!-- end: product-image-wrapper -->

                <?php if ($gc['display_name'] != 0): ?>
                    <h2 class="product-name<?php echo $productNameClasses; ?>"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
                <?php endif; ?>

                <?php if ($_product->getRatingSummary()): ?>
                    <?php if ($gc['display_rating'] == 1): //Display on hover ?>
                        <div class="display-onhover ratings-wrapper"><?php echo $this->getReviewsSummaryHtml($_product, 'short') ?></div>
                    <?php elseif ($gc['display_rating'] == 2): //Always display ?>
                        <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                    <?php endif; ?>
                <?php endif; ?>

                <?php if ($gc['display_price'] == 1): //Display on hover ?>
                    <div class="display-onhover"><?php echo $this->getPriceHtml($_product, true); ?></div>
                <?php elseif ($gc['display_price'] == 2): //Always display ?>
                    <?php echo $this->getPriceHtml($_product, true); ?>
                <?php endif; ?>

                <?php
                    //If at least one element was set as "Display on hover" but no element was set as "Display":
                    //aggregate classes from those elements and apply them to the "actions" container.
                    $actionsClasses = '';
                    if ($gc['display_addtocart'] == 1 || ($gc['display_addtolinks'] == 1 && !$gc['addtolinks_simple']))
                    {
                        $actionsClasses = ' display-onhover';
                    }
                    if ($gc['display_addtocart'] == 2 || ($gc['display_addtolinks'] == 2 && !$gc['addtolinks_simple']))
                    {
                        $actionsClasses = '';
                    }
                ?>

                <div class="actions clearer<?php echo $actionsClasses; ?>">
                    <?php //Cart button ?>
                    <?php if ($gc['display_addtocart'] != 0): ?>
                        <?php if ($_product->isSaleable()): ?>
                            <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                        <?php endif; ?>
                    <?php endif; ?>

                    <?php //Add-to links
                        if ($gc['display_addtolinks'] != 0 && !$gc['addtolinks_simple'])
                        {
                            echo $helpTemplate->getCategoryAddtoLinks($_product, $this->getAddToCompareUrl($_product), 'addto-gaps-right');
                        }
                    ?>
                </div> <!-- end: actions -->
            </li>
        <?php endforeach; ?>    
    </ul>
    <?php endif; //end: if grid mode ?>

    <?php if (!$hideToolbar): ?>
        <div class="toolbar-bottom">
            <?php echo $this->getToolbarHtml() ?>
        </div>
    <?php endif; ?>
</div>
<?php endif; ?>

<?php if ($_collectionSize && $tmpHtml = $this->getChildHtml('block_category_below_collection')): ?>
    <div class="block_category_below_collection std"><?php echo $tmpHtml; ?></div>
<?php endif; ?>