Algolia_Algoliasearch_Helper_Data::saveConfigurationToAlgolia PHP Method

saveConfigurationToAlgolia() public method

public saveConfigurationToAlgolia ( $storeId, $saveToTmpIndicesToo = false )
    public function saveConfigurationToAlgolia($storeId, $saveToTmpIndicesToo = false)
    {
        $this->algolia_helper->resetCredentialsFromConfig();
        if (!($this->config->getApplicationID() && $this->config->getAPIKey())) {
            return;
        }
        if ($this->config->isEnabledBackend($storeId) === false) {
            $this->logger->log('INDEXING IS DISABLED FOR ' . $this->logger->getStoreName($storeId));
            return;
        }
        $this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
        $this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
        $this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
        foreach ($this->config->getAutocompleteSections() as $section) {
            if ($section['name'] === 'products' || $section['name'] === 'categories' || $section['name'] === 'pages' || $section['name'] === 'suggestions') {
                continue;
            }
            $this->algolia_helper->setSettings($this->additionalsections_helper->getIndexName($storeId) . '_' . $section['name'], $this->additionalsections_helper->getIndexSettings($storeId));
        }
        $this->product_helper->setSettings($storeId, $saveToTmpIndicesToo);
    }

Usage Example

 public function saveSettings($isFullProductReindex = false)
 {
     foreach (Mage::app()->getStores() as $store) {
         /* @var $store Mage_Core_Model_Store */
         if ($store->getIsActive()) {
             $saveToTmpIndicesToo = $isFullProductReindex && $this->config->isQueueActive($store->getId());
             $this->helper->saveConfigurationToAlgolia($store->getId(), $saveToTmpIndicesToo);
         }
     }
 }