Question

Reposting this question in a more appropriate SO site.
I am using Magento 1.6.2 and has configured multi-site to run different shops.
I tried to add custom attribute to products but the new attribute shows up on Advanced Search page for all multi sites.
I want the new custom attribute to be available only for one multi-site.
AFAIK, 'Use in Advanced Search' option of attribute property does not allow me to disable it for specific stores.
Is there a way to enable 'Use in Advanced Search' selectively for a multi-site?
Looking at code it seems like the attribute list is generated by getAttributes() inside Mage_CatalogSearch_Model_Advanced class.
I could see there is a addStoreFilter inside Mage_Catalog_Model_Resource_Product_Collection but I cant figure out how to create/use such a filter for Mage_Catalog_Model_Resource_Product_Attribute_Collection
From Mage_CatalogSearch_Model_Advanced

public function getAttributes()
{
    /* @var $attributes Mage_Catalog_Model_Resource_Eav_Resource_Product_Attribute_Collection */
    $attributes = $this->getData('attributes');
    if (is_null($attributes)) {
        $product = Mage::getModel('catalog/product');
        $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
            ->addHasOptionsFilter()
            ->addDisplayInAdvancedSearchFilter()
            ->addStoreLabel(Mage::app()->getStore()->getId())
            ->setOrder('main_table.attribute_id', 'asc')
            ->load();
        foreach ($attributes as $attribute) {
            $attribute->setEntity($product->getResource());
        }
        $this->setData('attributes', $attributes);
    }
    return $attributes;
}

Any help would be greatly appreciated. Thanks.

Was it helpful?

Solution

You can use the Multi Store Search fields extension (http://www.magentocommerce.com/magento-connect/multistore-search-fields.html) for this. With this extension you can select the attributes to use in the advanced search per website/store view.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top