/** * Index all products */ private function indexAllAction() { $products = ProductQuery::create()->findByVisible(1); $count = 0; foreach ($products as $product) { OpenSearchServerSearchHelper::indexProduct($product); $count++; } $this->getRequest()->getSession()->getFlashBag()->add('oss', $this->getTranslator()->trans('%count products have been indexed.', array('%count' => $count), OpenSearchServerSearch::MODULE_DOMAIN)); return $this->redirectToHome(); }
public function indexProduct(ProductUpdateEvent $event) { OpenSearchServerSearchHelper::indexProduct($event->getProduct()); }
/** * Index all products */ private function indexAllAction() { $products = ProductQuery::create()->findByVisible(1); $count = 0; foreach ($products as $product) { OpenSearchServerSearchHelper::indexProduct($product); $count++; } $route = '/admin/module/OpenSearchServerSearch'; $this->getRequest()->getSession()->getFlashBag()->add('oss', $this->getTranslator()->trans('%count products have been indexed.', array('%count' => $count), OpenSearchServerSearch::MODULE_DOMAIN)); $this->redirect(URL::getInstance()->absoluteUrl($route)); }