VladP Posted June 21, 2013 Author Report Share Posted June 21, 2013 использовать куки что-то типа такого(в ProductsView.php сразу после $filter['visible'] = 1;): $path = '/products/'; if(!empty($category_url)) $path = '/catalog/'.$category_url; if(!empty($brand_url) $path = '/brands/' if(!isset($current_min_price) && empty($current_min_price)){ if(isset($_COOKIE['min_price'])) $current_min_price = $_COOKIE['min_price']; else unset($current_min_price); } else{ setcookie("min_price", $current_min_price, time()+60*60*24*30, $path); } if(!isset($current_max_price) && empty($current_max_price)){ if(isset($_COOKIE['max_price'])) $current_max_price = $_COOKIE['max_price']; else unset($current_max_price); } else{ setcookie("max_price", $current_max_price, time()+60*60*24*30, $path); } сохраняет значения для каждой категории отдельно Quote Link to post Share on other sites
quiz Posted June 30, 2013 Report Share Posted June 30, 2013 я застрял на последнем пункте, где написано "в файле с JS кодом"куда текст вставлять надо? Quote Link to post Share on other sites
Matteus Posted July 1, 2013 Report Share Posted July 1, 2013 Спасибо, VladP, инструкция очень понятная, все работает! Quote Link to post Share on other sites
partamelon Posted July 3, 2013 Report Share Posted July 3, 2013 А как быть, если в категории более 5000 товаров? Страница попросту не открывается. Я пока так и не нашёл почему так сильно возрастает нагрузка на сервер. С отключённой фильтрацией категории открываются нормально. Помогает, если восстановить строку $limit = 100; в api/Products.php но лишь отчасти. Страницы открываются, но стоит зайти насколько раз и сервак ложится. Quote Link to post Share on other sites
Shpion Posted July 4, 2013 Report Share Posted July 4, 2013 Что - то я мучился, мучился так и неполучилось.((( Quote Link to post Share on other sites
quiz Posted July 9, 2013 Report Share Posted July 9, 2013 кто нибудь за небольшое вознаграждение сделает мне? =))) Quote Link to post Share on other sites
mart Posted July 9, 2013 Report Share Posted July 9, 2013 http://rlstudio.com/products/simplacms/plagin-filtr-po-tsene-dlia-simplacms-21 Quote Link to post Share on other sites
partamelon Posted July 15, 2013 Report Share Posted July 15, 2013 Код надо стараться писать не копированием чужого, а с пониманием, чтоб работал не только правильно, но и РАЦИОНАЛЬНО. Например, использовать код от artbe для MainView.php, приведенный несколькими постами выше - это примерно как носить сметану ложками из погреба. Если надо 2-3 ложки, неудобство терпимое. А дальше, как показывает предыдущий пост, уже идет причинение сайту ущерба (непреднамеренное).Я не понял что тут вообще написано?!Я пытаюсь узнать в чём причина и каково решение. Quote Link to post Share on other sites
mart Posted July 15, 2013 Report Share Posted July 15, 2013 Сделал в моем решении (2 поста ранее) отдельную функцию для выбора минимальной и максимальной цены без дополнительных подзапросов - в итоге нагрузки ноль. И нет смысла гонять весь "набор" параметров для выборки цены. Quote Link to post Share on other sites
Siarhei Posted October 2, 2013 Report Share Posted October 2, 2013 VladP, спасибо за слайдер. Есть небольшая проблема, после нажатия кнопки "применить" исчезает листалка страниц. Как можно исправить? И как сделать так что бы после сортировки не сбрасывались установленные цены? Quote Link to post Share on other sites
walexnokia Posted October 4, 2013 Report Share Posted October 4, 2013 Не правильно выдаёт когда есть много вариантов цен если по одной цене кое как правильно. Quote Link to post Share on other sites
sergei5770 Posted March 23, 2014 Report Share Posted March 23, 2014 а как можно сделать смену валюты в фильтре, при смене валюты на сайте? Quote Link to post Share on other sites
yodaexolon Posted April 21, 2014 Report Share Posted April 21, 2014 Тоже интересует как сменить валюту в фильтре Quote Link to post Share on other sites
infinity178 Posted June 2, 2014 Report Share Posted June 2, 2014 Если кому надо стили для ползунка/* ползунок */ui-slider + ui-slider-horizontal +ui-widget +ui-widget-content +ui-corner-all + /* линия */ui-slider-range +ui-widget-header ui-corner-all + /* кнопка */ui-slider-handle + ui-state-default ui-corner-all + ui-state-hover ui-state-active ui-state-focus мой пример для магазина .ui-slider { width: 70%; margin: 0 7%; float: left; position: relative; text-align: left; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 20px; height: 20px; cursor: default; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } /* Corner radius */ .ui-corner-all { border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; } .ui-slider-horizontal { height: .3em; top:.5em; } .ui-slider-horizontal .ui-slider-handle { top: -.55em; margin-left: -.6em; cursor: pointer; } .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider-horizontal .ui-slider-range-min { left: 0; } .ui-slider-horizontal .ui-slider-range-max { right: 0; } .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget-content { border: 1px solid #aaaaaa; background: #E4E8BC; color: #222222; } .ui-widget-content a { color: #222222; } .ui-widget-header { background: #AFB383; box-shadow:inset 0 3px 3px 0 rgba(100,100,100,0.5); color: #222222; height:10px; font-weight: bold; } .ui-widget-header a { color: #222222; } /* --------------------------------------------------- кнопка слайда --------------------------------------------------- */ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { background: url(../images/bg__slide_.png), url(../images/bg___slide_bottom.png); background-size: 70% 70%, 100% 100%; background-position: 50% 50%, 0% 0%; background-repeat: no-repeat, no-repeat; font-weight: normal; color: #555555; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #94995A; font-weight: normal; color: #212121; box-shadow: 0px 0px 2px #94995A; transition: all 00ms ease-in-out; } .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; font-weight: normal; color: #212121; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } Quote Link to post Share on other sites
KIRA Posted July 3, 2014 Report Share Posted July 3, 2014 а как сделать кнопку "Сбросить фильтр"? <a rel="nofollow" href="#" class="reset">Сбросить фильтр</a> Quote Link to post Share on other sites
Json Posted September 12, 2014 Report Share Posted September 12, 2014 подскажите включили кэширование сайта, поменяли в конфиге "config.php" на true и перестал работать ползунок, кто может подсказать как поправить? Quote Link to post Share on other sites
dols4me Posted January 29, 2015 Report Share Posted January 29, 2015 Подскажите как сделать фильтр на главной странице?Пробовал сделать вывод категории на главной - максы определяет сам фильтр не работает.mainview.tpl <?PHP /** * Simpla CMS * Storefront class: Каталог товаров * * Этот класс использует шаблоны hits.tpl * * @copyright 2010 Denis Pikusov * @link http://simplacms.ru * @author Denis Pikusov * * * */ require_once('View.php'); class MainView extends View { function fetch() { $current_min_price = $this->request->post('min_price'); $current_max_price = $this->request->post('max_price'); $filter = array(); $filter['visible'] = 1; $filter['min_price'] = $current_min_price; $filter['max_price'] = $current_max_price; if($this->page) { $this->design->assign('meta_title', $this->page->meta_title); $this->design->assign('meta_keywords', $this->page->meta_keywords); $this->design->assign('meta_description', $this->page->meta_description); } unset($filter['min_price']); unset($filter['max_price']); unset($filter['limit']); foreach($this->products->get_products($filter) as $p) $products_prices[$p->id] = $p; if(!empty($products_prices)) { $prices_products_ids = array_keys($products_prices); $prices_variants = $this->variants->get_variants(array('product_id'=>$prices_products_ids)); foreach($prices_variants as &$prices_variant) $prices[] = $prices_variant->price; } $min_price = 0; $max_price = 0; $min_price = min($prices); $max_price = max($prices); if(!isset($current_min_price) && empty($current_min_price)) $current_min_price = $min_price; if(!isset($current_max_price) && empty($current_max_price)) $current_max_price = $max_price; $this->design->assign('minprice', $min_price); $this->design->assign('maxprice', $max_price); $this->design->assign('current_minprice', $current_min_price); $this->design->assign('current_maxprice', $current_max_price); return $this->design->fetch('main.tpl'); } } Quote Link to post Share on other sites
Suprun4uk Posted April 3, 2015 Report Share Posted April 3, 2015 Приветствую, подскажите а куда пагинация девалась ? Quote Link to post Share on other sites
Dysha-Kuzbass Posted August 5, 2015 Report Share Posted August 5, 2015 Дайте нормальный, рабочий, архив с данным решением!По кускам как-то не складывается! То там баг вылезет, то там! Quote Link to post Share on other sites
GS3 Posted August 25, 2015 Report Share Posted August 25, 2015 Есть тот, кто реализовал ? Я, когда нажимаю, применить, просто обновляется страница Quote Link to post Share on other sites
GS3 Posted August 27, 2015 Report Share Posted August 27, 2015 Мёртвый форум Quote Link to post Share on other sites
mishanya Posted August 27, 2015 Report Share Posted August 27, 2015 Мёртвый форум форму не мертвый. просто во-первых без ссылки и просмотра кода никто не скажет почему не работает. причин может быть куча. от ошибки в js и до невнимательноси пользователя и догадайся почему не работает. во-вторых автор должен разбираться почему не работает. и не все захотят лезть в чужой код и перебирать его в то время когда есть куча слайдеров и инструкций. Quote Link to post Share on other sites
GS3 Posted August 27, 2015 Report Share Posted August 27, 2015 форму не мертвый. просто во-первых без ссылки и просмотра кода никто не скажет почему не работает. причин может быть куча. от ошибки в js и до невнимательноси пользователя и догадайся почему не работает. во-вторых автор должен разбираться почему не работает. и не все захотят лезть в чужой код и перебирать его в то время когда есть куча слайдеров и инструкций.А вы пробовали сделать хотя бы по одной инструкции? В интернете их 3, то не работают, то я сам должен придумать куда засунуть код. Я, конечно, всё понимаю, но можно нормально объяснять (я не гуру PHP и тем более Симплы, хоть в принципе и не так тяжело всё тут). Тут же я попросил помочь того, кто сделал или было подобное, а ответа, увы, нет. Quote Link to post Share on other sites
mishanya Posted August 27, 2015 Report Share Posted August 27, 2015 А вы пробовали сделать хотя бы по одной инструкции? В интернете их 3, то не работают, то я сам должен придумать куда засунуть код. Я, конечно, всё понимаю, но можно нормально объяснять (я не гуру PHP и тем более Симплы, хоть в принципе и не так тяжело всё тут). Тут же я попросил помочь того, кто сделал или было подобное, а ответа, увы, нет. я не делал, мне не особо нужно =). к сожалению не кто писал видимо не думали об инструкциях. как говориться даренному коню в зубы не смотрят или как-то так. если никто не отвечает может никому и не удалось поставить. сейчас попробую поставить. что выйдет отпишу Quote Link to post Share on other sites
GS3 Posted August 27, 2015 Report Share Posted August 27, 2015 я не делал, мне не особо нужно =). к сожалению не кто писал видимо не думали об инструкциях. как говориться даренному коню в зубы не смотрят или как-то так. если никто не отвечает может никому и не удалось поставить. сейчас попробую поставить. что выйдет отпишуБыл бы очень благодарен Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.