src/project/OfficeBrain/CustomBundle/SearchBundle/Controller/SearchController.php line 230

Open in your IDE?
  1. <?php
  2. namespace App\project\OfficeBrain\CustomBundle\SearchBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  4. use Symfony\Component\Config\Definition\Exception\Exception;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\JsonResponse;
  8. use Symfony\Component\Security\Core\SecurityContext;
  9. use Symfony\Component\Translation\Translator;
  10. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  11. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  12. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  13. use Nelmio\ApiDocBundle\Annotation\ApiDoc;
  14. use Doctrine\ORM\Query\ResultSetMapping;
  15. use App\project\OfficeBrain\CustomBundle\SearchBundle\Form\Type\ProductSearchType;
  16. use App\project\OfficeBrain\CustomBundle\SearchBundle\Form\Data\ProductSearchData;
  17. use App\OfficeBrain\Bundle\CategoryBundle\Entity\CultureCategory;
  18. use App\OfficeBrain\Bundle\ProductBundle\Entity\CultureAttributeMaster;
  19. use App\OfficeBrain\Bundle\ProductBundle\Entity\AttributeValues;
  20. use App\OfficeBrain\Bundle\SearchBundle\Helper\SearchHelper;
  21. use App\OfficeBrain\Bundle\SolrBundle\Helper\StandardHelper;
  22. use App\OfficeBrain\Bundle\SearchBundle\Controller\SearchController as BaseSearchController;
  23. use App\OfficeBrain\Bundle\CoreBundle\Cache\RedisCacheService;
  24. use Symfony\Component\DependencyInjection\ContainerInterface;
  25. use App\OfficeBrain\Bundle\SearchBundle\Manager\Service\SearchManager;
  26. use App\project\OfficeBrain\CustomBundle\SearchBundle\Manager\Service\SearchManager as CustomSearchManager;
  27. use App\OfficeBrain\Bundle\CoreBundle\Service\SessionManager;
  28. use App\OfficeBrain\Bundle\SearchBundle\Manager\Service\BrowseCategoryManager;
  29.    /**
  30.     * Default Search Controller
  31.     *
  32.     * @author Employee Id: 4861
  33.     *
  34.     * Desciption: This is a search controler returns search results
  35.     *
  36.     * @param NULL
  37.     *
  38.     * @return Html Response
  39.     *
  40.     * @throws NULL
  41.     *
  42.     * @Route("/{_locale}")
  43.     */
  44. class SearchController extends BaseSearchController
  45. {
  46.     /**
  47.      *
  48.      * @author Employee Id: 4861
  49.      *
  50.      * Desciption: To set member variables default value
  51.      *
  52.      * @param NULL
  53.      *
  54.      * @return null
  55.      *
  56.      * @throws NULL
  57.      **/
  58.     
  59.     public function __construct(ContainerInterface $containerSearchManager $searchManagerCustomSearchManager $customSearchManagerSessionManager $sessionManagerBrowseCategoryManager $browserCategoryManager)
  60.     {
  61.         parent::__construct($container$searchManager$sessionManager);
  62.         $this->statsh_cache_wrapper=RedisCacheService::create();
  63.         $this->container $container;
  64.         $this->searchManager $searchManager->getSolrSearchExtended();
  65.         $this->customSearchManager $customSearchManager->getSolrSearchExtended();
  66.         $this->browserCategoryManager $browserCategoryManager->getBrowserCategoryExtended();
  67.     }
  68.     
  69.     /**
  70.      *
  71.      * @author Employee Id: 4861
  72.      *
  73.      * Desciption: To unset member variables
  74.      *
  75.      * @param NULL
  76.      *
  77.      * @return null
  78.      *
  79.      * @throws NULL
  80.      */
  81.     public function __destruct()
  82.     {
  83.         parent::__destruct();
  84.         unset($this->statsh_cache_wrapper);
  85.     }
  86.     /**
  87.      *
  88.      * @author Employee Id: 4861
  89.      *
  90.      * Desciption: Create various objects required action in this class
  91.      *
  92.      * @param NULL
  93.      *
  94.      * @return NULL
  95.      *
  96.      * @throws NULL
  97.      */
  98.     public function initAction(Request $request)
  99.     {
  100.         parent::initAction($request);
  101.         $this->request $request;
  102.         $this->projectSetting $this->request->get('project_setting');
  103.         // $this->searchManager = $this->get('office_brain_custom_bundle_search_manager'); // symfony 4
  104.         // $this->searchManager = $this->serviceContainer->get('office_brain_custom_bundle_search_manager_extended');
  105.         $this->searchManager $this->customSearchManager;
  106.         $this->productSearchForm ProductSearchType::class;
  107.         $this->twigManager $this->get('twig');
  108.     } 
  109.     /**
  110.      *
  111.      * @author Employee Id: 5460
  112.      *
  113.      * Desciption: Bind request paramater with form
  114.      *
  115.      * @param Array paramaters
  116.      *
  117.      * @return NULL
  118.      *
  119.      * @throws NULL
  120.      */
  121.     private function prepareSearchForm($searchArray)
  122.     {
  123.         $this->productSearchData = new ProductSearchData($this->entityManager$this->languageId);
  124.         $this->form $this->createForm(ProductSearchType::class, $this->productSearchData, array('csrf_protection' => false,'allow_extra_fields' => true'searchData' => $searchArray));
  125.         $this->form->submit($searchArray);
  126.     }
  127.     /**
  128.      * @author Employee Id: 5460
  129.      *
  130.      * List products 
  131.      *
  132.      * @param string tag slug
  133.      *
  134.      * @return if result found return tag products else null
  135.      *
  136.      * @Route("/tag-product-list/{tagSlug}", name="office_brain_search_bundle_tag_product_list", options={"expose"=true}, methods={"GET"})
  137.      *
  138.      * @Template("project/OfficeBrain/CustomBundle/SearchBundle/Search/search.html.twig")
  139.      */
  140.     public function tagProductListAction(Request $request$tagSlug)
  141.     {
  142.         $this->initAction($request);
  143.         $searchQuery $this->searchManager->getSearchArray();
  144.         $searchQuery['product_search']['tagSlug'] = $tagSlug;
  145.         /*echo "<pre>";
  146.         print_r($searchQuery);*/
  147.         
  148.         $renderFromModel =  $searchQuery['render_model'];
  149.         $this->prepareSearchForm($searchQuery['product_search']);
  150.         $this->responseArray['search_result_array'] = array();
  151.         if ($this->form->isValid()) {
  152.               $this->responseArray $this->searchManager->searchResult($this->form->getData());
  153.             if (!$this->request->get('page'null)) {
  154.                 $this->searchManager->setContinueShoppingUrl();
  155.                 $this->responseArray['search_attribute_filter_array'] = $this->searchManager->searchFilter($this->form->getData());
  156.             }
  157.         }
  158.         
  159.         $this->responseArray['attr_value_id'] =  $this->searchManager->getFilterAttributeValueId($this->request->query->get('color_filter_id''')); 
  160.         $this->responseArray['render_model'] = $renderFromModel;
  161.         
  162.         if ($this->request->isXmlHttpRequest()) {
  163.             if (is_array($this->responseArray['search_result_array']) && array_key_exists('data'$this->responseArray['search_result_array']) && ! count($this->responseArray['search_result_array']['data'])) {
  164.                 return new JsonResponse(array( 'status'=>'error','error_code' => 'END_OF_PAGINATION','error_message' => 'error_message' ));
  165.             }
  166.             return $this->responseArray;
  167.         }
  168.         
  169.         $this->responseArray['tag_slug'] = $tagSlug;
  170.         $this->responseArray['search_query'] = $searchQuery['search']['query'];
  171.         $this->responseArray['main_filter'] = $searchQuery['search']['main_filter'];
  172.         $this->responseArray['form'] = $this->form->createView();
  173.         $this->responseArray['save_search'] = $this->searchManager->getSaveSearch();
  174.         $recentSearch $this->request->query->get('is_filter''check');
  175.         if ($recentSearch == 'check') {
  176.             $this->searchManager->setRecentSearch();
  177.         }
  178.         
  179.         return $this->responseArray;
  180.     }
  181.     private function getRefererRouteName(Request $request){
  182.         $this->initAction($request);
  183.         $referer $this->request->headers->get('referer');
  184.         $referer_url_para parse_url($referer);
  185.         $lastPath $referer_url_para['path'];
  186.         if( isset($referer_url_para['scheme']) ){
  187.           $referer $referer_url_para['scheme'].'://'.$referer_url_para['host'].$referer_url_para['path'];
  188.         }
  189.         $basePath $this->request->getBaseUrl()?$this->request->getBaseUrl():( $referer_url_para['scheme'].'://'.$referer_url_para['host']);
  190.         $lastPath substr($refererstrpos($referer$basePath));
  191.         $lastPath str_replace($basePath''$lastPath);
  192.     
  193.         if(!$lastPath$lastPath '/';
  194.         $matcher $this->get('router')->getMatcher();
  195.         $parameters $matcher->match($lastPath);
  196.         $routeName $parameters['_route'];
  197.         return $routeName;
  198.     }
  199.      
  200.     /**
  201.      *
  202.      * @author Employee Id: 5460
  203.      *
  204.      * Desciption: Perform search based on search query in selected culture
  205.      *
  206.      * @param string search_query
  207.      *
  208.      * @return Html/json Response
  209.      *
  210.      * @throws if result found search result page else no record found error
  211.      *
  212.      * @Route("/search", name="office_brain_search_bundle_search", options={"expose"=true}, methods={"GET", "POST"})
  213.      *
  214.      * @Template("project/OfficeBrain/CustomBundle/SearchBundle/Search/search.html.twig")
  215.      * 
  216.      */
  217.     public function searchAction(Request $request)
  218.     {
  219.         $this->initAction($request);
  220.         // this is for you first and child category array
  221.         $youFirstMatchCat = array(); // this is match side filter with all category of you first
  222.         
  223.         $cateogryApiManager$this->serviceContainer->get("officebrain_category_api_manager");
  224.         $youFistcatId 16115;
  225.         $youFirstChidrenCat $cateogryApiManager->getChildrenCatByCatId($youFistcatId);
  226.         $youFirstChidrenCatarray_column($youFirstChidrenCat'pms_id');
  227.         array_push($youFirstChidrenCat,$youFistcatId);
  228.         // ---END -----
  229.         
  230.         
  231.         $categoryTagId=$this->request->query->get('tag_category_id''');
  232.         $tag=$this->request->query->get('tag_id''');
  233.         $searchQuery $this->searchManager->getSearchArray();
  234.         $renderFromModel =  $searchQuery['render_model'];
  235.         $tagSlug $this->request->get('tagSlug');
  236.         $searchQuery['product_search']['tagSlug'] = $tagSlug;
  237. //         if(empty($categoryId)==true)
  238. //         {
  239. //             $categoryId=$this->request->query->get('category_filter', '');
  240. //             $tag=$this->request->query->get('tag_filter', '');
  241. //             $searchQuery['product_search']['categoryId'] = $categoryId;
  242. //         }
  243. //         else
  244. //         {
  245. //             $categoryObj = $this->container->get('office_brain_category_manager');
  246. //             $subCategoryList = $categoryObj->getSubCategoryList($categoryId[0]);
  247. //             if( isset($subCategoryList['child']) ){
  248. //                 $categoryListJson = json_encode(array_keys($subCategoryList['child']));
  249. //             }else{
  250. //                 $caregoryArray[] = (int)$categoryId[0];
  251. //                 $categoryListJson = json_encode($caregoryArray);
  252. //             }
  253. //             $searchQuery['product_search']['categoryId'] = $categoryListJson;
  254. //         }
  255. //------------------kjethi ----------------
  256.         if($categoryTagId)
  257.         {
  258.             // $categoryObj = $this->container->get('office_brain_category_manager'); // symfony 4
  259.             // $categoryObj = $this->serviceContainer->get('office_brain_browse_category_extended');
  260.             $categoryObj $this->browserCategoryManager;
  261.             
  262.             $subCategoryList $categoryObj->getSubCategoryList($categoryTagId);
  263.             if( isset($subCategoryList['child']) ){
  264.                 $caregoryArrayarray_keys($subCategoryList['child']);
  265.                 array_push($caregoryArray,(int)$categoryTagId);
  266.                 $categoryListJson json_encode($caregoryArray);
  267.             }else{
  268.                 $caregoryArray[] = (int)$categoryTagId;
  269.                 $categoryListJson json_encode($caregoryArray);
  270.             }
  271.             $searchQuery['product_search']['categoryTagId'] = $categoryListJson;
  272.             
  273.             $routeName $this->getRefererRouteName($request);
  274.             
  275.             if($routeName == "office_brain_search_bundle_category_product_list" &&  trim($this->request->query->get('sort_by''')) == ''){
  276.                 $searchQuery['product_search']['sort'] = array(
  277.                     'field' => 'category||sorting_product_by_categoryid_'$categoryTagId.'_i',
  278.                     'order' => 'desc'
  279.                 );    
  280.             }
  281.                     
  282.         }
  283.         // you first
  284.         $catFilterArr = array();
  285.         if($categoryTagId){
  286.             $catFilterArr $caregoryArray;
  287.         }
  288.         
  289.         $categoryId=$this->request->query->get('category_filter''');
  290.         if(!is_array($categoryId)) {
  291.           $searchQuery['product_search']['categoryId'] = json_decode($categoryId);
  292.         } else {
  293.             $searchQuery['product_search']['categoryId'] = $categoryId;
  294.         }
  295.         
  296.         if(!empty($categoryId) && is_array($categoryId)){
  297.             // $catFilterArr = array_merge($catFilterArr,json_decode($categoryId));
  298.             $catFilterArr array_merge($catFilterArr,$categoryId);
  299.         }
  300.         $youFirstMatchCatarray_intersect($catFilterArr,$youFirstChidrenCat);
  301. //         foreach ($youFirstChidrenCat as $youFirstCatId){
  302. //             foreach ($catFilterArr as $catIdFilter){
  303. //                 if($catIdFilter == $youFirstCatId)
  304. //                 $youFirstFlag
  305. //             }
  306. //         }
  307.             
  308.         $tag=$this->request->query->get('tag_filter''');
  309.         if(!is_array($tag)) {
  310.           $searchQuery['product_search']['tag'] = json_decode($tag);
  311.         } else {
  312.             $searchQuery['product_search']['tag'] = $tag;
  313.         }
  314. // ------------------kjethi ----------------
  315.         
  316.         $min_price =$this->request->query->get('min_price''');
  317.         if($min_price!=""){
  318.             $searchQuery['product_search']['min_price'] = $min_price;
  319.         }
  320.         $max_price $this->request->query->get('max_price''');
  321.         if($max_price!=""){
  322.             $searchQuery['product_search']['max_price'] = $max_price;
  323.         }
  324.         $tag=$this->request->query->get('tag_filter''');
  325.         
  326.         $this->prepareSearchForm($searchQuery['product_search']);
  327.         $this->responseArray['search_result_array'] = array();
  328.         // echo "<pre>";
  329.         // foreach ($this->form->getErrors(true) as $error) {
  330.         //     $formField = $error->getOrigin()->getName(); // Get the form field name
  331.         //     $errorMessage = $error->getMessage(); // Get the error message
  332.         //     echo $formField . ': ' . $errorMessage . "\n";
  333.         // }
  334.         // exit;
  335.         if ($this->form->isValid()) {
  336.               $this->responseArray $this->searchManager->searchResult($this->form->getData());
  337.               if (!$this->request->get('page'null)) {
  338.                 $this->searchManager->setContinueShoppingUrl();
  339.                 $this->responseArray['search_attribute_filter_array'] = $this->searchManager->searchFilter($this->form->getData());
  340.             }else{
  341.                 $this->responseArray['search_attribute_filter_array'] = $this->searchManager->searchFilter($this->form->getData());
  342.             }
  343.             
  344.         }
  345.         
  346.         $this->responseArray['youFirstChidrenCat'] = $youFirstMatchCat;
  347.         
  348.       
  349.         
  350. //         $this->responseArray['search_attribute_filter_array']['Ideas_by_market_Cat'] = array(array("id"=>16115,"name"=>"Youfirst","count"=>310));
  351. //         echo "<pre>";print_r($this->responseArray['search_attribute_filter_array']);exit;
  352.         // -----------------------------------------------------------------------
  353.         if (!$this->request->isXmlHttpRequest()) {
  354.             // get IdeasByMarket cat from All search filter cat
  355.             $api_manager $this->serviceContainer->get('officebrain_category_api_manager');
  356.             $dataOfIdeas $api_manager->getIdeasByMarketCat();
  357.             
  358.             $dataOfIdeas_final array_column($dataOfIdeas'pms_id');
  359.             
  360. //             echo "<pre>";print_r($this->responseArray['search_attribute_filter_array']['categoryNameId']);exit;
  361.             if(isset($this->responseArray['search_attribute_filter_array'])){
  362.                 $this->responseArray['search_attribute_filter_array']['Ideas_by_market_Cat'] = array_filter($this->responseArray['search_attribute_filter_array']['categoryNameId'], function($array) use($dataOfIdeas_final){
  363.                     if (in_array($array['id'], $dataOfIdeas_final)) {
  364.                         return true ;
  365.                     }
  366.                     else{
  367.                         return false;
  368.                     }
  369.                 });
  370.             
  371.             
  372.                 $arr array_filter($this->responseArray['search_attribute_filter_array']['categoryNameId'], function($array) use($dataOfIdeas_final){
  373.                     if (in_array($array['id'], $dataOfIdeas_final)) {
  374.                         return false ;
  375.                     }
  376.                     else{
  377.                         return true;
  378.                     }
  379.                     });
  380.                     $this->responseArray['search_attribute_filter_array']['categoryNameId'] = $arr;
  381.             }
  382.             else{
  383.                 $this->responseArray['search_attribute_filter_array']['Ideas_by_market_Cat'] = null;
  384.                 $this->responseArray['search_attribute_filter_array']['categoryNameId'] = null;
  385.             }
  386.             $categoryArray = array();
  387.             foreach($this->responseArray['search_attribute_filter_array']['categoryNameId'] as $category){
  388.                 $categoryArray[$category['id']] = $category['name'];
  389.             }
  390.             $this->responseArray['category_list'] = $categoryArray;
  391.             /* Remove Categories From Category Filter */
  392.             $allCategoryIds array_column($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'], 'id');
  393.             $categoryIdsToRemove $this->serviceContainer->getParameter('category_remove_from_filter');
  394.             
  395.             foreach($categoryIdsToRemove as $catId){
  396.                 $keyToUnset array_search ($catId$allCategoryIds);
  397.                 if(isset($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'][$keyToUnset])){
  398.                     unset($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'][$keyToUnset]);
  399.                 }
  400.             }
  401.             /* Remove Categories From Category Filter */
  402.             /* EO - Category Brand Merging */
  403.             if(isset($this->responseArray['search_attribute_filter_array']['publicCustomTagText']) && is_array($this->responseArray['search_attribute_filter_array']['publicCustomTagText'])){
  404.                 $parentCategoryNamesArray array_column($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'], 'name');
  405.                 
  406.                 $brandSlugs = array('barware','circular-cup','dyln','ecovessel','halcyon','hitch','illusion','mag-lites','otaria','pul','reduce','snowfox','stojo','swig','takeya','vinglace','zing-line','mood','microhalt','bindle','hydrapak','made-in-usa','hidratespark','hip','maglite','oceanworks','perfect-shaker','polar-bottle','stojo-1','perf||ma');
  407.                 $brandFinalArray = array();
  408.                 $count 0;
  409.                 foreach($this->responseArray['search_attribute_filter_array']['publicCustomTagText'] as $brandData => $productCount){
  410.                     $brandArray explode('|'$brandData);
  411.                     if(in_array(trim($brandArray[5]), $brandSlugs) && !in_array(trim($brandArray[1]), $parentCategoryNamesArray)){
  412.                         $brandFinalArray[$count]['id'] = trim($brandArray[0]);
  413.                         $brandFinalArray[$count]['name'] = trim($brandArray[1]);
  414.                         $brandFinalArray[$count]['slug'] = trim($brandArray[5]);
  415.                         $brandFinalArray[$count]['count'] = $productCount;
  416.                         $brandFinalArray[$count]['type'] = 'brand';
  417.                         $count++;
  418.                     }
  419.                 }
  420.                 if(!empty($brandFinalArray)){
  421.                     $this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'] = array_merge($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'], $brandFinalArray);
  422.                     $price array_column($this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName'], 'name');
  423.                     array_multisort($priceSORT_ASC$this->responseArray['search_attribute_filter_array']['parentchildCategoryIdName']);
  424.                 }
  425.             }
  426.             
  427.             /* EO - Category Brand Merging */
  428.             $locale=$this->request->getLocale();
  429.             $search base64_encode(json_encode($searchQuery));
  430.             // $cacheSiteKey = array('SearchFilter',$search,$locale,$this->instanceId,$this->container->getParameter('kernel.environment')); // symfony 4
  431.             $cacheSiteKey = array('SearchFilter',$search,$locale,$this->instanceId,$this->projectSetting['kernelEnvironment']);
  432.             $this->moduleCachePrefix='__Search__:';
  433.             $cacheKey $this->moduleCachePrefix.RedisCacheService::generateKey($this->statsh_cache_wrapper,$cacheSiteKey);
  434.             $cacheData RedisCacheService::getCacheData($this->statsh_cache_wrapper,$cacheKey);
  435.             /*if($cacheData){
  436.                 $this->responseArray['filterHtml']= $cacheData;
  437.             }
  438.             else{ */
  439.                 $response $this->twigManager->render('project/OfficeBrain/CustomBundle/SearchBundle/Search/searchAttributeFilterList.html.twig'$this->responseArray);
  440.                 if(!empty($cacheKey))
  441.                 {
  442.                     RedisCacheService::saveCacheData($this->statsh_cache_wrapper,$cacheKey,$response); 
  443.                 }
  444.                 $this->responseArray['filterHtml'] = $response;
  445.           //  }
  446.         }
  447.         $this->responseArray['sub_category_list'] = $catFilterArr;
  448.         $this->responseArray['attr_value_id'] =  $this->searchManager->getFilterAttributeValueId($this->request->query->get('color_filter_id''')); 
  449.         $this->responseArray['render_model'] = $renderFromModel;
  450.         $this->responseArray['tag_slug'] = $tagSlug;
  451.         $this->responseArray['category_id'] = $categoryTagId;
  452.         
  453.         if ($this->request->isXmlHttpRequest()) {
  454.             $this->responseArray['copy_url'] = $this->serviceContainer->getParameter('base_url').$_SERVER['REQUEST_URI'];
  455.             if (is_array($this->responseArray['search_result_array']) && array_key_exists('data'$this->responseArray['search_result_array']) && ! count($this->responseArray['search_result_array']['data'])) {
  456.                 return new JsonResponse(array( 'status'=>'error','error_code' => 'END_OF_PAGINATION','error_message' => 'error_message' ));
  457.             }
  458.             return $this->responseArray;
  459.         }
  460.         
  461.         $this->responseArray['search_query'] = $searchQuery['search']['query'];
  462.         $this->responseArray['main_filter'] = $searchQuery['search']['main_filter'];
  463.         $this->responseArray['search_data'] = $searchQuery;
  464.         $this->responseArray['form'] = $this->form->createView();
  465.         $this->responseArray['save_search'] = $this->searchManager->getSaveSearch();
  466.         $recentSearch $this->request->query->get('is_filter''check');
  467.         if ($recentSearch == 'check') {
  468.             $this->searchManager->setRecentSearch();
  469.         }
  470.         //print_r($this->responseArray['search_attribute_filter_array']);die;
  471.         
  472.         return $this->responseArray;
  473.     } 
  474.     
  475.     /**
  476.      *
  477.      * @author Employee Id: 4861
  478.      *
  479.      * Desciption: Perform search to find attribute list for given search criteria
  480.      *
  481.      * @param string search_query
  482.      *
  483.      * @return json Response
  484.      *
  485.      * @throws if result found return attribute list along with product count else null
  486.      *
  487.      * @Route("/search-attribute-filter-list-without-ajax/{search}",
  488.      * name="office_brain_search_bundle_search_attribute_filter_list_withoutAjax",)
  489.      * @Template("project/OfficeBrain/CustomBundle/SearchBundle/Search/searchAttributeFilterList.html.twig")
  490.      *
  491.      */
  492.     public function searchAttributeFilterListWithoutAjaxAction(Request $request)
  493.     {
  494.         $this->initAction($request);
  495.         $search $this->request->get('search');
  496.         $searchQuery json_decode(base64_decode($search),true);
  497.         if(array_key_exists('browse-category-search',$searchQuery)){
  498.             $this->prepareSearchForm($searchQuery['product_search'],$searchQuery['browse-category-search']);
  499.             unset($searchQuery['browse-category-search']);
  500.         }
  501.         else{
  502.             $this->prepareSearchForm($searchQuery['product_search']);
  503.         }
  504.         $this->form->getData('browse-category-search');
  505.         $this->responseArray['search_attribute_filter_array'] = array();
  506.         if ($this->form->isValid()) {
  507.             $this->responseArray['search_attribute_filter_array'] = $this->searchManager->searchFilter($this->form->getData());
  508.         }
  509.         // -----------------------------------------------------------------------
  510.         $locale=$this->request->getLocale();
  511.         // $cacheSiteKey = array('SearchFilter',$search,$locale,$this->instanceId,$this->container->getParameter('kernel.environment')); symfony 4
  512.         $cacheSiteKey = array('SearchFilter',$search,$locale,$this->instanceId,$this->projectSetting['kernelEnvironment']);
  513.         $this->moduleCachePrefix='__Search__:';
  514.         $cacheKey $this->moduleCachePrefix.RedisCacheService::generateKey($this->statsh_cache_wrapper,$cacheSiteKey);
  515.         $cacheData RedisCacheService::getCacheData($this->statsh_cache_wrapper,$cacheKey);
  516.         if($cacheData){
  517.             return $cacheData;
  518.         }
  519.         $response $this->render('project/OfficeBrain/CustomBundle/SearchBundle/Search/searchAttributeFilterList.html.twig'$this->responseArray);
  520.          
  521.         if(!empty($cacheKey))
  522.         {
  523.             RedisCacheService::saveCacheData($this->statsh_cache_wrapper,$cacheKey,$response);
  524.         }
  525.         return $response;
  526.         // -----------------------------------------------------------------------
  527.         //}
  528.     }
  529. }