[-] BO : FixBug #PSCFV-8234 Products tags not correctly indexed in search
This commit is contained in:
1 parent
108bd92c3b
commit
69066361a6
2 files changed
+23
No files matched your search
@@ -571,6 +571,14 @@ class SearchCore
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function removeProductsSearchIndex($products)
|
||||||
|
{
|
||||||
|
if (count($products)) {
|
||||||
|
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_index WHERE id_product IN ('.implode(',', $products).')');
|
||||||
|
ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'a.id_product IN ('.implode(',', $products).')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected static function setProductsAsIndexed(&$products)
|
protected static function setProductsAsIndexed(&$products)
|
||||||
{
|
{
|
||||||
if (count($products))
|
if (count($products))
|
||||||
|
|||||||
@@ -77,8 +77,23 @@ class AdminTagsControllerCore extends AdminController
|
|||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table))
|
if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table))
|
||||||
|
{
|
||||||
if (($id = (int)Tools::getValue($this->identifier)) && ($obj = new $this->className($id)) && Validate::isLoadedObject($obj))
|
if (($id = (int)Tools::getValue($this->identifier)) && ($obj = new $this->className($id)) && Validate::isLoadedObject($obj))
|
||||||
|
{
|
||||||
|
$previousProducts = $obj->getProducts();
|
||||||
|
$removedProducts = array();
|
||||||
|
|
||||||
|
foreach ($previousProducts as $product)
|
||||||
|
if (!in_array($product['id_product'], $_POST['products']))
|
||||||
|
$removedProducts[] = $product['id_product'];
|
||||||
|
|
||||||
|
if (Configuration::get('PS_SEARCH_INDEXATION'))
|
||||||
|
Search::removeProductsSearchIndex($removedProducts);
|
||||||
|
|
||||||
$obj->setProducts($_POST['products']);
|
$obj->setProducts($_POST['products']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return parent::postProcess();
|
return parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user