Jump to content

Rapid search with multiboutique mode


Recommended Posts

Hello,

 

i would like to configure my rapid search module to obtain results for only one boutique.

When I search one item in one boutique, it gives me results found in all boutiques.

 

Do you have an idea to solve this problem ?

 

Thank you.

Link to comment
Share on other sites

You should try adding another parameter to search::find(), like

AND product_shop.id_shop = '.$this->context->shop->id.'

In this query

 

		$results = $db->executeS('
		SELECT cp.`id_product`
		FROM `'._DB_PREFIX_.'category_product` cp
		'.(Group::isFeatureActive() ? 'INNER JOIN `'._DB_PREFIX_.'category_group` cg ON cp.`id_category` = cg.`id_category`' : '').'
		INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
		INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
		'.Shop::addSqlAssociation('product', 'p', false).'
		WHERE c.`active` = 1
		AND product_shop.`active` = 1
		AND product_shop.`visibility` IN ("both", "search")
		AND product_shop.indexed = 1
		'.$sql_groups);
Link to comment
Share on other sites

Thank you for your answer, I don't know php language, but I tried :

$sql .= ' FROM '._DB_PREFIX_.'product p
            LEFT JOIN '._DB_PREFIX_.'product_attribute pa
                ON pa.id_product = p.id_product
            LEFT JOIN '._DB_PREFIX_.'product_lang pl
                ON p.id_product = pl.id_product
            '.Shop::addSqlAssociation('product', 'p', true, null, true).'
            LEFT JOIN '._DB_PREFIX_.'category_lang cl
                ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang AND cl.id_shop = product_shop.id_shop)
            LEFT JOIN '._DB_PREFIX_.'manufacturer m
                ON m.id_manufacturer = p.id_manufacturer
            LEFT JOIN '._DB_PREFIX_.'lang l
                ON l.id_lang = pl.id_lang
            WHERE product_shop.indexed = 0
            AND product_shop.visibility IN ("both", "search")
            '.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
            AND product_shop.`active` = 1
            AND pl.`id_shop` = product_shop.`id_shop`
            AND product_shop.indexed = 1
            AND product_shop.id_shop = '.$this->context->shop->id.'
            LIMIT '.(int)$limit;

        return Db::getInstance()->executeS($sql);

It doesn't work, but as I don't understand what I write, it seems quite normal.

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...