如何更改magento中的价格过滤器

时间:2015-05-25 06:58:43

标签: jquery magento-1.9.1

现在我正在研究magento-1.9.1。我们都知道magento有默认价格过滤器。我想使用滑块代替默认过滤器。

实际代码: view.phtml,

<?php $_filters = $this->getFilters() ?>
 <?php foreach ($_filters as $_filter): ?>
    <?php if($_filter->getItemsCount()): ?>
        <dt><?php echo $this->__($_filter->getName()) ?></dt>
        <dd><?php echo $_filter->getHtml() ?></dd>
   <?php endif; ?>
 <?php endforeach; ?>

filter.phtml:

<ol>

<?php foreach ($this->getItems() as $_item): ?>

   <?php echo $_item->getLabel();?>
    <li>
        <?php if ($_item->getCount() > 0): ?>

            <a href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
                <?php echo $_item->getLabel() ?>
                <?php if ($this->shouldDisplayProductCount()): ?>
                <span class="count">(<?php echo $_item->getCount() ?>)</span>
                <?php endif; ?>
            </a>
        <?php else: ?>
            <span>
                <?php echo $_item->getLabel(); ?>
                <?php if ($this->shouldDisplayProductCount()): ?>
                    <span class="count">(<?php echo $_item->getCount() ?>)</span>
                <?php endif; ?>
            </span>
        <?php endif; ?>
    </li>
<?php endforeach ?>
</ol>

我的代码是, view.phtml:

<?php $_filters = $this->getFilters() ?>
                <?php foreach ($_filters as $_filter): ?>
                <?php
                            // get display attribute code
                            $attributeModel = $_filter->getAttributeModel();
                            if($attributeModel) {
                                $attr_code = $attributeModel->getAttributeCode();

                            }
                ?>

                <?php //echo $attr_code;?>
                <?php if($_filter->getItemsCount()): ?>
                    <?php if($attr_code == 'price'){?>
                        <dt><?php echo $this->__($_filter->getName()) ?></dt>
                        <dd>
                        <input id="range_1" type="text" name="range_1" value="1;<?php echo $maxPrice+100;?>" data-type="double" data-step="1" data-postfix="$" data-from="<?php echo $minPrice;?>" data-to="<?php echo $maxPrice;?>" data-hasgrid="true" />
                        </dd>

                    <?php }else { ?>
                    <dt><?php echo $this->__($_filter->getName()) ?></dt>
                    <dd><?php echo $_filter->getHtml() ?></dd>
                    <?php } ?>
                <?php endif; ?>
                <?php endforeach; ?>

我的jquery是,

$j('#range_1').ionRangeSlider();

我想要的是,当我更改滑块中的价格范围时,产品应该会改变。我不知道如何将过滤器URL添加到滑块。请帮我。感谢。

0 个答案:

没有答案