简体   繁体   English

价格范围过滤器

[英]Price range filter in opencart

I have the filter module installed in Opencart V2 that filters products on a variety of attributes. 我在Opencart V2中安装了过滤器模块,该模块可以过滤各种属性的产品。 They are all check boxes. 它们都是复选框。

I want customers to be able to filter products using a price range slider. 我希望客户能够使用价格范围滑块过滤产品。 There are a lot of modules available online, however most are for V1.5. 在线上有很多可用的模块,但是大多数模块都适用于V1.5。

How would I go about incorporating a range <input> to filter my prices? 我将如何合并范围<input>来过滤我的价格?

I could add a price attribute in filters, however this limits the customer to a variety of check boxes - and I need my pricing to be extremely accurate (it will be displaying over 50,000 products). 我可以在过滤器中添加价格属性,但是这将客户限制在各种复选框中-我需要我的定价要非常准确(它将显示50,000多种产品)。

Is there a way I can edit the current filter module, and not create a new one? 有什么方法可以编辑当前的过滤器模块,而不创建新的过滤器模块?

I have implemented several pricing filters in opencart. 我已经在opencart中实现了几个价格过滤器。 The available filters are not free so I decided to make my own. 可用的过滤器不是免费的,因此我决定自己制作。 Here is what I did. 这是我所做的。

  1. I made a custom module (price_filter) and made 3 fields in it. 我制作了一个自定义模块(price_filter),并在其中制作了3个字段。 Min price, max price (both dynamic) and status and I downloaded price range html and put it in the tpl . 最低价格,最高价格(均为动态)和状态,我下载了价格范围html并将其放在tpl
  2. I enabled it and then on search, i grabbed the url through jquery and integrated my two own parameters (min price and max price) through jquery and reloaded the page. 我启用了它,然后在搜索时,我通过jquery抓取了url,并通过jquery集成了我自己的两个参数(最低价格和最高价格),并重新加载了页面。
  3. In the controller, i retrieved those variables, passed to filter_data array and changed the model a little bit too. 在控制器中,我检索了这些变量,将其传递给filter_data数组,并对模型进行了一些更改。 I added the min_price and max_price conditions in my model. 我在模型中添加了min_pricemax_price条件。

It was simple if you know how to play with controller and model. 如果您知道如何使用控制器和模型,这很简单。

Solved my problem using this extension here: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=23022&filter_search=jquery%20price%20slider&filter_download_id=42&sort=e.price&order=ASC 在这里使用此扩展程序解决了我的问题: http : //www.opencart.com/index.php? route=extension/extension/info&extension_id=23022&filter_search=jquery%20price%20slider&filter_download_id=42&sort=e.price&order=ASC

I am using the default theme, with stylesheet modifications. 我使用带有样式表修改的默认主题。 It wasn't working at first as I had modified the category.tpl file to such an extent that the plugin wasn't working correctly. 起初它不起作用,因为我已修改了category.tpl文件,以致插件无法正常工作。

Resetting the .tpl file to it's defaults and making new changes, it now works. 将.tpl文件重置为默认值并进行新的更改,现在可以使用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM