Magento,实现下拉属性过滤

发布于 2024-11-28 21:14:47 字数 339 浏览 6 评论 0原文

所以我是 Magento 的新手,并且仍在努力了解它。基本上我有多个下拉菜单,并尝试在轮播中对产品进行排序。 (参见附图)

Product Carousel Filter

我的问题是如何使用 Magento 和 php 来做到这一点。我对ajax部分相当熟悉。但我对Magento的方法不熟悉,希望得到这里专家的建议。使用 Magento 来完成此操作的最佳方法是什么?我可以通过使用所选属性构建动态查询,直接使用 php 轻松完成此操作。 (我确信还有其他方法。)但如果有人能指出我正确的方向。这将帮助我完成这个项目。提前致谢。

So I am new to Magento and still trying to get my get my head wrapped around it. Basically I have multiple dropdowns and am trying to sort products in a carousel. (See attached screenshot)

Product Carousel Filter

My question is how would I do this with Magento and php. I am fairly familiar with the ajax part. But I am unfamiliar with Magento's methods and would like suggestions from the experts here. What would be the best way to go about this using Magento to do this. I could do this with straight php pretty easy by building a dynamic query with the selected attribute. (I'm sure there are other ways too.) But if anyone can point me in the right direction. It would help me get this project done. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伏妖词 2024-12-05 21:14:48

创建了一个下拉过滤器类别

我在 app/desing/frontend/your/theme/template/catalog/product/list/toolbar.phtml 中的第 50 行左右
如果你替换里面的所有代码

希望

            <!--Filter by Categories-->
            <?php
                $_helper = Mage::helper('catalog/category');
                $_categories = $_helper->getStoreCategories();
                $currentCategory = Mage::registry('current_category');
            ?>
            <div class="block block-list block-categorys">
                <div class="block-content">
                    <ul class="category_sub">
                        <?php if (count($_categories) > 0){ ?>
                        <?php
                            global $index;
                            global $data;
                        ?>
                        <!-- necesary -->
                        <select onchange="setLocation(this.value)">
                            <option  selected ="selected"><?php echo $this->__('Categories') ?></option>
                            <?php foreach($_categories as $_category){ ?>
                                <option  value="<?php echo $_helper->getCategoryUrl($_category) ?>"><?php echo $_category->getName();?></option>
                            <?php } ?>
                        </select>
                        <?php } ?>
                    </ul>
                </div>
            </div>

你会发现它有用

I made a dropdown filter category

Around line 50 in app/desing/frontend/your/theme/template/catalog/product/list/toolbar.phtml
If you replace all the code inside

For

            <!--Filter by Categories-->
            <?php
                $_helper = Mage::helper('catalog/category');
                $_categories = $_helper->getStoreCategories();
                $currentCategory = Mage::registry('current_category');
            ?>
            <div class="block block-list block-categorys">
                <div class="block-content">
                    <ul class="category_sub">
                        <?php if (count($_categories) > 0){ ?>
                        <?php
                            global $index;
                            global $data;
                        ?>
                        <!-- necesary -->
                        <select onchange="setLocation(this.value)">
                            <option  selected ="selected"><?php echo $this->__('Categories') ?></option>
                            <?php foreach($_categories as $_category){ ?>
                                <option  value="<?php echo $_helper->getCategoryUrl($_category) ?>"><?php echo $_category->getName();?></option>
                            <?php } ?>
                        </select>
                        <?php } ?>
                    </ul>
                </div>
            </div>

hope you find it useful

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文