Jump to content

Edit History

jeremiezip

jeremiezip

Hello guys,

In 1.6 don't forget to change the query of indexing attribute:

In override of blocklayered module, look at the public function "IndexAttribute".

Add the following lines in the query (same from above) 

JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product_attribute`= pac.`id_product_attribute` AND sa.`quantity` > 0)

So this is the result in my version of Prestashop 1.6 :

Db::getInstance()->execute('
	INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`, `id_shop`)
	SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group, product_attribute_shop.`id_shop`
	FROM '._DB_PREFIX_.'product_attribute pa'.
	Shop::addSqlAssociation('product_attribute', 'pa').'
	INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute
	INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute)
	INNER JOIN '._DB_PREFIX_.'attribute_group ag ON ag.id_attribute_group = a.id_attribute_group
	JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product_attribute`= pac.`id_product_attribute` AND sa.`quantity` > 0)
	'.(is_null($id_product) ? '' : 'AND pa.id_product = '.(int)$id_product).'
	GROUP BY a.id_attribute, pa.id_product , product_attribute_shop.`id_shop`'
);

After that, clear cache and reindex attributes filters.

jeremiezip

jeremiezip

Hello guys,

In 1.6 don't forget to change de query of indexing attribute:

In override of blocklayered module, look at the public function "IndexAttribute".

Add the following lines in the query (same from above) 

JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product_attribute`= pac.`id_product_attribute` AND sa.`quantity` > 0)

So this is the result in my version of Prestashop 1.6 :

Db::getInstance()->execute('
	INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`, `id_shop`)
	SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group, product_attribute_shop.`id_shop`
	FROM '._DB_PREFIX_.'product_attribute pa'.
	Shop::addSqlAssociation('product_attribute', 'pa').'
	INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute
	INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute)
	INNER JOIN '._DB_PREFIX_.'attribute_group ag ON ag.id_attribute_group = a.id_attribute_group
	JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.`id_product_attribute`= pac.`id_product_attribute` AND sa.`quantity` > 0)
	'.(is_null($id_product) ? '' : 'AND pa.id_product = '.(int)$id_product).'
	GROUP BY a.id_attribute, pa.id_product , product_attribute_shop.`id_shop`'
);

After that, clear cache and reindex attributes filters.

×
×
  • Create New...