Example #1
0
 public function addToQueue($observer, $method, $data, $data_size)
 {
     if ($this->config->isQueueActive()) {
         $this->queue->add($observer, $method, $data, $data_size);
     } else {
         Mage::getSingleton($observer)->{$method}(new Varien_Object($data));
     }
 }
 /**
  * Rebuild all index data
  */
 public function reindexAll()
 {
     if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
         Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
         return;
     }
     $this->queue->runCron();
     return $this;
 }
 /**
  * @param null|int $storeId
  * @param null|int|array $productIds
  * @return Algolia_Algoliasearch_Model_Resource_Engine
  */
 protected function _rebuildProductIndex($storeId = NULL, $productIds = NULL)
 {
     $data = array('store_id' => $storeId, 'product_ids' => $productIds);
     $this->_queue->add('algoliasearch/observer', 'rebuildProductIndex', $data, 3);
     return $this;
 }