
its only one file changes
catalog\model\catalog -> and replce product.php
I hope that this is it.

THIS is repair of price_filter archive pack!
My themes:
Fleen Theme
My vqmods:
Remove description tab - Remove related products tab - Remove title from category page
My themes:
Fleen Theme
My vqmods:
Remove description tab - Remove related products tab - Remove title from category page
who has price filter already and needed to correct filtring. Options in the same group is like a OR and options between groups are AND
My themes:
Fleen Theme
My vqmods:
Remove description tab - Remove related products tab - Remove title from category page
My themes:
Fleen Theme
My vqmods:
Remove description tab - Remove related products tab - Remove title from category page
IT DOESNT WORK!
Code: Select all
public function getCategoryPriceRange($category_id) {
$minmax = array();
$query = 'SELECT MIN(price) AS min, MAX(price) AS max FROM ' . DB_PREFIX . 'product P
join ' . DB_PREFIX . 'product_to_category POC
on POC.product_id = P.product_id
where POC.category_id = ' . (int)$category_id . ' AND P.status = 1' ;
$results = $this->db->query($query);
$minmax = $results->row;
if(empty($minmax['min']) and empty($minmax['max'])){
return null;
}
$minmax = array(
'minimum' => floor($minmax['min']),
'maximum' => floor($minmax['max'])
);
return $minmax;
}
Code: Select all
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (pf.product_id = p.product_id)";
Code: Select all
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf_1 ON (p2c.product_id = pf_1.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
$fid_array = array();
$filters = explode(',', $data['filter_filter']);
foreach ($filters as $filter_id) {
$fid_array[] = (int)$filter_id;
}
$query = $this->db->query("SELECT COUNT(DISTINCT filter_group_id) AS num_fgid FROM " . DB_PREFIX . "filter_description WHERE filter_id IN(" . implode(',', $fid_array) . ")");
if(!empty($query->row['num_fgid'])) {
for ($thisgrp = 2; $thisgrp <= $query->row['num_fgid']; $thisgrp++) {
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf_" . $thisgrp . " ON (p2c.product_id = pf_" . $thisgrp . ".product_id) ";
}
}
Code: Select all
$implode = array();
$filters = explode(',', $data['filter_filter']);
foreach ($filters as $filter_id) {
$implode[] = (int)$filter_id;
}
$sql .= " AND pf.filter_id IN (" . implode(',', $implode) . ")";
Code: Select all
$query = $this->db->query("SELECT fd.filter_group_id, fd.filter_id, n.num_sel_filters_in_grp FROM " . DB_PREFIX . "filter_description fd left join (SELECT filter_group_id, count(filter_group_id) as num_sel_filters_in_grp FROM " . DB_PREFIX . "filter_description WHERE filter_id IN (" . implode(',', $fid_array) . ") GROUP BY filter_group_id) as n on fd.filter_group_id = n.filter_group_id WHERE filter_id IN (" . implode(',', $fid_array) . ") GROUP BY fd.filter_group_id, fd.filter_id");
if ($query->num_rows) {
$g_count = 0;
$f_count = 0;
$last_fgid = -1;
foreach ($query->rows as $frow) {
$f_count += 1;
if ($frow['filter_group_id'] != $last_fgid) {
$g_count += 1;
$f_count = 1;
$last_fgid = $frow['filter_group_id'];
$sql .= " AND (pf_" . $g_count . ".filter_id = " . $frow['filter_id'];
}
else {
if ($frow['num_sel_filters_in_grp'] > 1) {
$sql .= " OR pf_" . $g_count . ".filter_id = " . $frow['filter_id'];
}
}
if ($f_count == $frow['num_sel_filters_in_grp']) {
$sql .= ")";
}
}
}
Code: Select all
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (pf.product_id = p.product_id)";
Code: Select all
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf_1 ON (p2c.product_id = pf_1.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
$fid_array = array();
$filters = explode(',', $data['filter_filter']);
foreach ($filters as $filter_id) {
$fid_array[] = (int)$filter_id;
}
$query = $this->db->query("SELECT COUNT(DISTINCT filter_group_id) AS num_fgid FROM " . DB_PREFIX . "filter_description WHERE filter_id IN(" . implode(',', $fid_array) . ")");
if(!empty($query->row['num_fgid'])) {
for ($thisgrp = 2; $thisgrp <= $query->row['num_fgid']; $thisgrp++) {
$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf_" . $thisgrp . " ON (p2c.product_id = pf_" . $thisgrp . ".product_id) ";
}
}
Code: Select all
$implode = array();
$filters = explode(',', $data['filter_filter']);
foreach ($filters as $filter_id) {
$implode[] = (int)$filter_id;
}
$sql .= " AND pf.filter_id IN (" . implode(',', $implode) . ")";
Code: Select all
$query = $this->db->query("SELECT fd.filter_group_id, fd.filter_id, n.num_sel_filters_in_grp FROM " . DB_PREFIX . "filter_description fd left join (SELECT filter_group_id, count(filter_group_id) as num_sel_filters_in_grp FROM " . DB_PREFIX . "filter_description WHERE filter_id IN (" . implode(',', $fid_array) . ") GROUP BY filter_group_id) as n on fd.filter_group_id = n.filter_group_id WHERE filter_id IN (" . implode(',', $fid_array) . ") GROUP BY fd.filter_group_id, fd.filter_id");
if ($query->num_rows) {
$g_count = 0;
$f_count = 0;
$last_fgid = -1;
foreach ($query->rows as $frow) {
$f_count += 1;
if ($frow['filter_group_id'] != $last_fgid) {
$g_count += 1;
$f_count = 1;
$last_fgid = $frow['filter_group_id'];
$sql .= " AND (pf_" . $g_count . ".filter_id = " . $frow['filter_id'];
}
else {
if ($frow['num_sel_filters_in_grp'] > 1) {
$sql .= " OR pf_" . $g_count . ".filter_id = " . $frow['filter_id'];
}
}
if ($f_count == $frow['num_sel_filters_in_grp']) {
$sql .= ")";
}
}
}
Code: Select all
<script type="text/javascript"><!--
$(document).ready(function() {
$('.box-filter li ul li input[type=\'checkbox\']').live('click', function() {
filter = [];
$('.box-filter input[type=\'checkbox\']:checked').each(function(element) {
filter.push(this.value);
});
location = '<?php echo $action; ?>&filter=' + filter.join(',');
});
});
//--></script>
his work but the problem is,when user click the product ridirect from the hompage where is inside the latest module filters function not show/not come out is mean filters dont have in that product.. but if user click the product from categorie filters will show.... for sure....1. Go to Catalog > Filters and select Insert to create a filter group. Assign a filter group name (e.g. Color) and add filter name values (e.g. Blue, Red, Yellow).
2. Go to Catalog > Categories and Edit a category. Under the Data tab add the filters you want to be able to apply to that category (e.g. Color > Blue, Color > Red).
3. Go to Catalog > Products and Edit a product. Under the Links tab add the filters which apply to the product (e.g. Color > Blue). Apply to as many products as applicable.
4. Go to Extensions > Modules > Filter. If not installed select Install. Click Edit. Click the Add Module button and under Layout select Category and set Status to Enabled. Set whatever position and sort order you would like.
Code: Select all
count(filter_group_id)
Code: Select all
(count(filter_group_id)/count(DISTINCT language_id))
Users browsing this forum: No registered users and 59 guests