Jump to content

Navegación por facetas no funcionan los filtros de asociación (SOLUCIONADO)


Recommended Posts

Hola a todos, tengo problemas con mi tienda. Tengo dos categorías principales en mi tienda: colecciones y artistas, cada uno con sus respectivas sub-categorías. Todos los productos cuando los doy de alta los asocio en una colección y a un artista. Tengo configurado el bloque de navegación por facetas para que me muestre los productos de las subcategorías de tal forma que cuando le den clic a colecciones me aparezcan todos los productos de todas las colecciones.

 

El problema es que al seleccionar cualquier categoría no las filtra, deja todos los productos igual, Sólo me funcionan los filtros de precio. ¿Qué puede estar pasando?

Edited by MilyRoquiz (see edit history)
Link to comment
Share on other sites

La versión de prestashop que tengo es la 1.6.1.4. Al parecer hay un problema cuando se usa el cache de archivos. Para poder corregir el error edite el archivo: modules/blocklayered/blocklayered.php y agregué al método que ejecuta la consulta de productos los parámetros "true, false". 

 

El código queda así:

 

$this->products = Db::getInstance()->executeS('
SELECT
p.*,
'.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
'.$alias_where.'.id_category_default,
pl.*,
image_shop.`id_image` id_image,
il.legend,
m.name manufacturer_name,
'.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').'
DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new,
stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').'
FROM '._DB_PREFIX_.'cat_filter_restriction cp
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
'.Shop::addSqlAssociation('product', 'p').
(Combination::isFeatureActive() ?
' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
'.Product::sqlStock('p', 0).'
WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")
ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'.
' LIMIT '.(((int)$this->page - 1) * $n.','.$n), true, false);
 
Es probable que se necesite añadir en otras partes, pero por ahora eso solucionó mi problema.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...