getApplicationID() public method

public getApplicationID ( $storeId = null )
 /**
  * Rebuild all index data.
  */
 public function reindexAll()
 {
     if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
         /** @var Mage_Adminhtml_Model_Session $session */
         $session = Mage::getSingleton('adminhtml/session');
         $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
         return;
     }
     $this->queue->runCron();
     return $this;
 }
 /**
  * Call algoliasearch.xml To load js / css / phtml.
  */
 public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
 {
     if ($this->config->isEnabledFrontEnd()) {
         if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
             if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
                 $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
                 if ($this->config->isDefaultSelector()) {
                     $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_with_topsearch');
                 } else {
                     $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_no_topsearch');
                 }
             }
         }
     }
     return $this;
 }
 /**
  * Only used when reindexing everything. Otherwise Model/Indexer/Algolia will take care of the rest.
  */
 public function rebuildIndex($storeId = null, $productIds = null)
 {
     if ($this->config->isEnabledBackend(Mage::app()->getStore()->getId()) === false) {
         return parent::rebuildIndex($storeId, $productIds);
     }
     if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
         /** @var Mage_Adminhtml_Model_Session $session */
         $session = Mage::getSingleton('adminhtml/session');
         $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
         return null;
     }
     /* Avoid Indexing twice */
     if (is_array($productIds) && $productIds > 0) {
         return $this;
     }
     $this->engine->rebuildProducts($storeId);
     return $this;
 }
Example #4
0
 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);
 }
 /**
  * Rebuild all index data.
  */
 public function reindexAll()
 {
     if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
         /** @var Mage_Adminhtml_Model_Session $session */
         $session = Mage::getSingleton('adminhtml/session');
         $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
         $this->logger->log('ERROR Credentials not configured correctly');
         return;
     }
     $this->logger->start('PRODUCTS FULL REINDEX');
     $this->engine->rebuildProducts();
     $this->logger->stop('PRODUCTS FULL REINDEX');
     return $this;
 }
 public function resetCredentialsFromConfig()
 {
     if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
         $this->client = new \AlgoliaSearch\Client($this->config->getApplicationID(), $this->config->getAPIKey());
     }
 }