-1

我在我的目录页面中显示了属性过滤器。我的客户要求是,在某些类别中,属性过滤器没有产品,我需要隐藏空属性标签。我怎样才能做到这一点请帮助我。

“我需要特定属性的产品计数,例如形状、颜色和瓦特,我怎样才能按属性计算所有产品,如果我得到计数​​,我将使用它来控制属性标签。”

我在目录/层/view.phtml 中的代码:

    <?php if($this->canShowBlock()): ?>
    <?php // echo $this->getStateHtml() ?>
    <?php if($this->canShowOptions()): ?>
            <?php $_filters = $this->getFilters() ?>                
            <?php if($_filter->getItemsCount()):        
              <?php echo $this->__($_filter->getName()) ?>
                <?php echo $_filter->getCount();?>
                <?php  echo $_filter->getHtml(); ?>
            <?php endif;?>
              <?php endif;?>
            <?php endforeach; ?>
4

1 回答 1

0

//从“目录/产品”模型中获取产品集合

$collection = Mage::getModel('目录/产品')->getCollection();

//获取最受欢迎的特色产品

$collection->addAttributeToSelect('most_popular');
$collection->addAttributeToSelect('featured_prod');

//您可以通过以下方式检查您的查询:

$collection->getSelect();

希望这可以帮助你.... :)

于 2015-02-20T07:25:14.260 回答