src/OfficeBrain/Bundle/CompareProductBundle/Controller/CompareProductController.php line 167

Open in your IDE?
  1. <?php
  2. namespace App\OfficeBrain\Bundle\CompareProductBundle\Controller;
  3. // use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  8. use Symfony\Component\HttpFoundation\Session\Session;
  9. use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
  10. use Symfony\Component\HttpFoundation\JsonResponse;
  11. use Symfony\Component\Translation\Translator;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use App\OfficeBrain\Bundle\CompareProductBundle\Form\CompareProductEmailToFriendType;
  14. use Symfony\Component\HttpFoundation\Request;
  15. use Symfony\Component\DependencyInjection\ContainerInterface;
  16. use App\OfficeBrain\Bundle\CoreBundle\Service\SessionManager;
  17. use App\OfficeBrain\Bundle\CoreBundle\Service\OBCommon;
  18. use Symfony\Component\HttpFoundation\RequestStack;
  19. use Symfony\Component\Routing\RouterInterface;
  20. use Symfony\Component\Validator\Validator\ValidatorInterface;
  21. use App\OfficeBrain\Bundle\CompareProductBundle\Manager\Service\CompareProductService;
  22. use App\OfficeBrain\Bundle\EmailBundle\Manager\Service\EmailService;
  23. /**
  24.  * 
  25.  * @author OfficeBrain 4074 <info@officebrain.com>
  26.  * 
  27.  * Desciption: This controller help user to compare various product
  28.  *
  29.  * @package: OfficeBrain eCommerce Product Web Client
  30.  * 
  31.  * @subpackage: Compare Product
  32.  * 
  33.  * @version 1.0
  34.  * 
  35.  */
  36. class CompareProductController extends AbstractController
  37. {
  38.     /**
  39.      *
  40.      * @author Employee Id: 4074
  41.      *
  42.      * Desciption: Define member variables with thier default value
  43.      *
  44.      * @param NULL
  45.      * 
  46.      * @return NULL
  47.      * 
  48.      * @throws NULL
  49.      * 
  50.      */
  51.     public function __construct(ContainerInterface $containerSessionManager $sessionManagerRequestStack $requestStackRouterInterface $routerValidatorInterface $validatorInterfaceCompareProductService $compareProductServiceEmailService $emailManager)
  52.     {
  53.         $this->request null;
  54.         $this->cultureId null;
  55.         $this->refererUrl null;
  56.         $this->productId null;
  57.         $this->cultureProductId null;
  58.         $this->responseArray = array();    
  59.         $this->projectSetting = array();
  60.         $this->comapreProductMaxLimit null;
  61.         $this->commonLibraryManager = new OBCommon($router$validatorInterface$requestStack);;
  62.         $this->compareProductManager $compareProductService->getCompareProductExtended();
  63.         $this->sessionManager $sessionManager;
  64.         $this->emailManager $emailManager->getEmailExtended();
  65.         $this->serviceContainer $container;
  66.     }
  67.     
  68.     /**
  69.      *
  70.      * @author Employee Id: 4074
  71.      *
  72.      * Desciption: Unset member variables
  73.      *
  74.      * @param NULL
  75.      * 
  76.      * @return NULL
  77.      * 
  78.      * @throws NULL
  79.      * 
  80.      */
  81.     public function __destruct()
  82.     {
  83.         unset($this->request);
  84.         unset($this->cultureId);
  85.         unset($this->refererUrl);
  86.         unset($this->productId);
  87.         unset($this->cultureProductId);
  88.         unset($this->responseArray);
  89.         unset($this->projectSetting);
  90.         unset($this->comapreProductMaxLimit);
  91.         unset($this->commonLibraryManager);
  92.         unset($this->compareProductManager);
  93.         unset($this->sessionManager);
  94.         unset($this->emailManager);
  95.     }
  96.     
  97.     /**
  98.      *
  99.      * @author Employee Id: 4074
  100.      *
  101.      * Desciption: Create and initialize various required object and member variables
  102.      *
  103.      * @param NULL
  104.      *
  105.      * @return NULL
  106.      *
  107.      * @throws NULL
  108.      *
  109.      */
  110.     private function initAction(Request $request)
  111.     {
  112.         $this->request $request;
  113.         $this->productId $this->request->get('productId'null);
  114.         $this->cultureProductId $this->request->get('cultureProductId'null);
  115.         $this->projectSetting $this->request->get('project_setting');
  116.         $this->cultureId $this->projectSetting['culture_id'];
  117.         $this->comapreProductMaxLimit $this->projectSetting['configuration_rule']['transaction']['compare_product']['inline_view']['option']['no_of_product'];
  118.     
  119.         // $this->sessionManager = $this->serviceContainer->get('office_brain_session_manager');
  120.         $this->sessionManager $this->sessionManager;
  121.         // $this->commonLibraryManager = $this->serviceContainer->get('office_brain_common_library');
  122.         $this->commonLibraryManager $this->commonLibraryManager;
  123.         $userId $this->projectSetting['user_id'];
  124.         // if ($userId>0) {
  125.         //    $this->compareProductManager = $this->serviceContainer->get('office_brain_compare_product_registered_extended');
  126.         //    // $this->compareProductManager = $this->get('office_brain_compare_product_manager'); // symfony 4
  127.         // } else {
  128.         //     $this->compareProductManager = $this->serviceContainer->get('office_brain_compare_product_guest_extended');
  129.         //     // $this->compareProductManager = $this->get('office_brain_compare_product_manager'); // symfony 4
  130.         // }
  131.            $this->compareProductManager $this->compareProductManager;
  132.         // $this->emailManager = $this->serviceContainer->get('office_brain_email_service');
  133.         $this->emailManager $this->emailManager;
  134.     
  135.         $this->responseArray['status'] = 'error';
  136.         $this->responseArray['product_id'] = $this->productId;
  137.         $this->mediaFilePath $this->serviceContainer->getParameter('cms.media_file_path');
  138.     }
  139.     
  140.     /**
  141.      *
  142.      * @author Employee Id: 4074
  143.      *
  144.      * Desciption: Show recently addded product for compare in quick list 
  145.      *
  146.      * @param NULL
  147.      *
  148.      * @return Html Response 
  149.      *
  150.      * @throws NULL
  151.      *
  152.      * @Route("/{_locale}/recent-product-compare-list",
  153.      *     name="office_brain_compareproductbundle_compareproduct_recentcompareproductlist",
  154.      *  options={"expose"=true}
  155.      * )
  156.      *
  157.      * @Method({"GET"})
  158.      * 
  159.      * @Template("OfficeBrain/Bundle/CompareProductBundle/CompareProduct/recentCompareProductList.html.twig")
  160.      * 
  161.      */
  162.     public function recentCompareProductListAction(Request $request)
  163.     {
  164.         $this->initAction($request);
  165.         // $this->responseArray['record_set'] = $this->compareProductManager->getCompareProduct();
  166.         // $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  167.         $this->responseArray['record_set'] = 0;
  168.         $this->responseArray['total_record'] = 3;
  169.         return $this->responseArray;
  170.     }
  171.     
  172.     /**
  173.      *
  174.      * @author Employee Id: 4074
  175.      *
  176.      * Desciption: This function allow user to compare selected product feature wise.  
  177.      *
  178.      * @param NULL
  179.      *
  180.      * @return Html Response
  181.      *
  182.      * @throws NULL
  183.      * 
  184.      * @Route("/{_locale}/compare-product",
  185.      *     name="office_brain_compareproductbundle_compareproduct_compareproduct"
  186.      * )
  187.      * 
  188.      * @Method({"GET", "POST"})
  189.      * 
  190.      * @Template("OfficeBrain/Bundle/CompareProductBundle/CompareProduct/compareProduct.html.twig")
  191.      * 
  192.      */
  193.     public function compareProductAction(Request $request)
  194.     {
  195.         $this->initAction($request);
  196.         $this->responseArray['record_set'] = $this->compareProductManager->getCompareProduct();
  197.         $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  198.         $this->responseArray['remaining_compare_product'] = $this->comapreProductMaxLimit $this->responseArray['total_record'];
  199.         $this->compareProductManager->setContinueShoppingUrl($this->commonLibraryManager->getRefererRouteName(), $this->commonLibraryManager->getRefererUrl());
  200.         return $this->responseArray;
  201.     }
  202.     
  203.     /**
  204.      *
  205.      * @author Employee Id: 4074
  206.      *
  207.      * Desciption: This function allow user to download compare product page as pdf.  
  208.      *
  209.      * @param integer productId
  210.      * @param integer cultureProductId
  211.      *
  212.      * @return application/pdf compare-product.pdf
  213.      *
  214.      * @throws NULL
  215.      *
  216.      * @Route("/{_locale}/compare-product-pdf",
  217.      *     name="office_brain_compareproductbundle_compareproduct_downloadcompareproductaspdf"
  218.      * )
  219.      * 
  220.      * @Method({"GET"})
  221.      * 
  222.      * @Template()
  223.      * 
  224.      */
  225.     public function downloadCompareProductAsPdfAction(Request $request)
  226.     {
  227.         $this->initAction($request);
  228.         $data=$this->request->get('data');
  229.         $this->responseArray['QtyValues'] = $data['qty_values'];
  230.         $this->responseArray['priceProd'] = $data['price'];
  231.         $this->responseArray['record_set'] = $this->compareProductManager->getCompareProduct();
  232.         $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  233.         $this->responseArray['remaining_compare_product'] = $this->comapreProductMaxLimit $this->responseArray['total_record'];
  234.         $response $this->render('OfficeBrain/Bundle/CompareProductBundle/CompareProduct/downloadCompareProductAsPdf.html.twig'$this->responseArray);
  235.         
  236.         return new Response(
  237.                 $this->serviceContainer->get('knp_snappy.pdf')->getOutputFromHtml($response->getContent()),
  238.                 200,
  239.                 array(
  240.                         'Content-Type'        => 'application/pdf',
  241.                         'Content-Disposition' => 'attachment; filename="compare-product.pdf"'
  242.                 )
  243.         );
  244.     }
  245.     
  246.     /**
  247.      *
  248.      * @author Employee Id: 4074
  249.      *
  250.      * Desciption: This function allow user add product to compare product feature.  
  251.      *
  252.      * @param integer productId
  253.      * @param integer cultureProductId
  254.      *
  255.      * @return Json Response
  256.      *
  257.      * @throws NULL
  258.      *
  259.      * @Route("/{_locale}/add-to-compare-product",
  260.      * name="office_brain_compareproductbundle_compareproduct_addproducttocompare",
  261.      *  options={"expose"=true}
  262.      * )
  263.      *
  264.      * @Method({"POST"})
  265.      * 
  266.      * @Template()
  267.      * 
  268.      */
  269.     public function addProductToCompareAction(Request $request)
  270.     {
  271.         $this->initAction($request);
  272.         if ($this->productId && $this->cultureProductId) {
  273.             $status $this->compareProductManager->setCompareProduct($this->productId$this->cultureProductId);
  274.             switch ($status) {
  275.                 case 'ERROR_MAX_LIMIT_REACHED':
  276.                         $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.max_product_compare', array('%no_of_compare_product%' => $this->comapreProductMaxLimit));
  277.                     break;
  278.                 case 'ERROR_PRODUCT_ALREADY_EXISTS':
  279.                         $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.product_already_exists');
  280.                     break;
  281.                 case 'SUCCESS':
  282.                         $this->responseArray['status'] = 'success';
  283.                         $this->responseArray['success_message'] = $this->serviceContainer->get('translator')->trans('product_compare.add_success_message');
  284.                         
  285.                         $this->refererUrl $this->commonLibraryManager->getRefererRouteName();
  286.                     break;
  287.             }
  288.         }
  289.         if ($this->refererUrl=='office_brain_compareproductbundle_compareproduct_compareproduct') {
  290.             $this->responseArray['page_url'] = $this->generateUrl('office_brain_compareproductbundle_compareproduct_compareproduct');
  291.         } else {
  292.             $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  293.         }
  294.         return new JsonResponse($this->responseArray);
  295.     }
  296.     
  297.     /**
  298.      *
  299.      * @author Employee Id: 4074
  300.      *
  301.      * Desciption: This function allow user to delete product from compare product section.  
  302.      *
  303.      * @param integer productId
  304.      * @param integer cultureProductId
  305.      *
  306.      * @return Json Response
  307.      *
  308.      * @throws NULL
  309.      *
  310.      * @Route("/{_locale}/compare-product-delete",
  311.      *     name="office_brain_compareproductbundle_compareproduct_deletecompareproduct",
  312.      *  options={"expose"=true}
  313.      * )
  314.      *
  315.      * @Method({"POST"})
  316.      * 
  317.      * @Template()
  318.      * 
  319.      */
  320.     public function deleteCompareProductAction(Request $request)
  321.     {
  322.         $this->initAction($request);
  323.         if ($this->productId && $this->cultureProductId) {
  324.             $status $this->compareProductManager->deleteCompareProduct($this->productId$this->cultureProductId);
  325.             switch ($status) {
  326.                 case 'ERROR_PRODUCT_ALREADY_EXISTS':
  327.                     $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.product_already_exists');
  328.                     break;
  329.                 case 'SUCCESS':
  330.                     $this->responseArray['status'] = 'success';
  331.                     $this->responseArray['success_message'] = $this->serviceContainer->get('translator')->trans('product_compare.remove_success_message');
  332.                     $this->refererUrl $this->commonLibraryManager->getRefererRouteName();
  333.                     break;
  334.             }
  335.         }
  336.        
  337.         if ($this->refererUrl=='office_brain_compareproductbundle_compareproduct_compareproduct') {
  338.             $this->sessionManager->set('compareProd_success_deleted',$this->serviceContainer->get('translator')->trans('product_compare.remove_success_message'));
  339.             $this->responseArray['page_url'] = $this->generateUrl('office_brain_compareproductbundle_compareproduct_compareproduct');
  340.         } else {
  341.             $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  342.         }
  343.         return new JsonResponse($this->responseArray);
  344.     }
  345.     
  346.     /**
  347.      *
  348.      * @author Employee Id: 4074
  349.      *
  350.      * Desciption: This function allow user to delete all products from compare product section.  
  351.      *
  352.      * @param NULL
  353.      *
  354.      * @return Json Response
  355.      *
  356.      * @throws NULL
  357.      *
  358.      * @Route("/{_locale}/compare-product-delete-all",
  359.      *     name="office_brain_compareproductbundle_compareproduct_deleteallcompareproduct",
  360.      *  options={"expose"=true}
  361.      * )
  362.      *
  363.      * @Method({"POST"})
  364.      * 
  365.      * @Template()
  366.      * 
  367.      */
  368.     public function deleteAllCompareProductAction(Request $request)
  369.     {
  370.         $this->initAction($request);
  371.     
  372.         $status $this->compareProductManager->deleteAllCompareProduct();
  373.         switch ($status) {
  374.             case 'ERROR_PRODUCT_ALREADY_EXISTS':
  375.                 $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.product_already_exists');
  376.                 break;
  377.             case 'SUCCESS':
  378.                 $this->responseArray['status'] = 'success';
  379.                 $this->responseArray['success_message'] = $this->serviceContainer->get('translator')->trans('product_compare.remove_success_message');
  380.                 $this->refererUrl $this->commonLibraryManager->getRefererRouteName();
  381.                 break;
  382.         }
  383.         
  384.         if ($this->refererUrl=='office_brain_compareproductbundle_compareproduct_compareproduct') {
  385.             $this->sessionManager->set('compareProd_success_deleted',$this->serviceContainer->get('translator')->trans('product_compare.remove_success_message'));
  386.             $this->responseArray['page_url'] = $this->generateUrl('office_brain_compareproductbundle_compareproduct_compareproduct');
  387.         } else {
  388.             $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  389.         }
  390.         return new JsonResponse($this->responseArray);
  391.     }
  392.     /**
  393.      *
  394.      * @author Employee Id: 4471
  395.      *
  396.      * Desciption: This function generate form which allow user send compare product page as email to friends.  
  397.      *
  398.      * @param NULL
  399.      *
  400.      * @return Html Response
  401.      *
  402.      * @throws NULL
  403.      *
  404.      * @Route("/{_locale}/compare-product-email-to-friend",
  405.      *     name="office_brain_compareproductbundle_compareproduct_emailtofriend",
  406.      * )
  407.      * 
  408.      * @Method({"GET"})
  409.      * 
  410.      * @Template("OfficeBrain/Bundle/CompareProductBundle/CompareProduct/emailToFriend.html.twig")
  411.      * 
  412.      */
  413.     public function emailToFriendAction(Request $request)
  414.     {
  415.         $this->initAction($request);
  416.         $this->responseArray = [];
  417.         //$this->responseArray['product_id'] = $data['productId'];
  418.         $this->responseArray['QtyValues'] = json_encode($this->request->get('QtyValues'));
  419.         $this->responseArray['priceProd'] = json_encode($this->request->get('priceProd'));
  420.         $this->form $this->createForm(CompareProductEmailToFriendType::class);
  421.         $this->responseArray['form'] = $this->form->createView();
  422.         
  423.         return $this->responseArray;
  424.     }
  425.     
  426.     /**
  427.      *
  428.      * @author Employee Id: 4471
  429.      *
  430.      * Desciption: This function allow user send compare product page as email to friends.  
  431.      *
  432.      * @param NULL
  433.      *
  434.      * @return Html Response
  435.      *
  436.      * @throws NULL
  437.      *
  438.      * @Route("/{_locale}/compare-product-email-to-friend-submit",
  439.      *     name="office_brain_compareproductbundle_compareproduct_emailtofriend_submit",
  440.      * )
  441.      * 
  442.      * @Method({"POST"})
  443.      * 
  444.      * @Template()
  445.      * 
  446.      */
  447.     public function submitMailEmailToFriendCompareProductAction(Request $request)
  448.     {
  449.         $this->initAction($request);
  450.         $this->form $this->createForm(CompareProductEmailToFriendType::class);
  451.         $this->form->handleRequest($this->request);
  452.         
  453.         if ($this->form->isValid()) {
  454.             $this->sendMailToFriend();
  455.             $this->responseArray['status'] = 'success';
  456.             $this->responseArray['close_modal'] = true;
  457.             $this->responseArray['success_message'] = $this->serviceContainer->get('translator')->trans('product_compare.email_msg_sucess');
  458.         } else {
  459.                $this->responseArray $this->commonLibraryManager->prepareFormJsonError($this->form);
  460.         }
  461.         return new JsonResponse($this->responseArray);
  462.     }
  463.     
  464.     /**
  465.      *
  466.      * @author Employee Id: 4471
  467.      *
  468.      * Desciption: This function allow user print compare product page.  
  469.      *
  470.      * @param NULL
  471.      *
  472.      * @return Html Response
  473.      *
  474.      * @throws NULL
  475.      *
  476.      * @Route("/{_locale}/compare-product-print",
  477.      *     name="office_brain_compareproductbundle_compareproduct_print",
  478.      * )
  479.      * 
  480.      * @Method({"GET"})
  481.      * 
  482.      * @Template("OfficeBrain/Bundle/CompareProductBundle/CompareProduct/printCompareProduct.html.twig")
  483.      * 
  484.      */
  485.     public function printCompareProductAction(Request $request)
  486.     {
  487.         $this->initAction($request);
  488.         //$this->responseArray = array();
  489.         $data   =   $this->request->get('result');
  490.         $data   =    json_decode("$data",true);
  491.         //$this->responseArray['product_id'] = $data['productId'];
  492.         $this->responseArray['QtyValues'] = $data['qty'];
  493.         $this->responseArray['priceProd'] = $data['price'];
  494.         $this->responseArray['record_set'] = $this->compareProductManager->getCompareProduct();
  495.         $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  496.         $this->responseArray['remaining_compare_product'] = $this->comapreProductMaxLimit $this->responseArray['total_record'];
  497.         
  498.         return $this->responseArray;
  499.     }
  500.     /**
  501.      *
  502.      * @author Employee Id: 4471
  503.      *
  504.      * Desciption: This function allow user check the product column quantity price  
  505.      *
  506.      * @param NULL
  507.      *
  508.      * @return Html Response
  509.      *
  510.      * @throws NULL
  511.      *
  512.      * @Route("/{_locale}/compare-product-price-listing",
  513.      *     name="office_brain_compareproductbundle_compareproduct_pricelisting"
  514.      * )
  515.      * 
  516.      * @Method({"POST"})
  517.      * 
  518.      * @Template()
  519.      * 
  520.      */
  521.     public function priceListingCompareProductAction(Request $request)
  522.     {
  523.         $this->initAction($request);
  524.         $recordSet $this->compareProductManager->getProductDetailById($this->productId$this->cultureId);
  525.         $this->responseArray['record_set'] = $recordSet[$this->productId];
  526.         unset($recordSet);
  527.         return $this->responseArray;
  528.     }
  529.     /**
  530.      *
  531.      * @author Employee Id: 4471
  532.      *
  533.      * Desciption: This function allow user check the product price by changing quantity  
  534.      *
  535.      * @param NULL
  536.      *
  537.      * @return Html Response
  538.      *
  539.      * @throws NULL
  540.      *
  541.      * @Route("/{_locale}/compare-product-price-qty",
  542.      *     name="office_brain_compareproductbundle_compareproduct_priceqty"
  543.      * )
  544.      * 
  545.      * @Method({"POST"})
  546.      * 
  547.      * @Template()
  548.      * 
  549.      */
  550.     public function priceQtyCompareProductAction(Request $request)
  551.     {
  552.         $this->initAction($request);
  553.         $this->qty $this->request->get('qty'null);
  554.         if ($this->qty === null) {
  555.             $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.error_message.require_quantity');
  556.         } elseif ($this->qty == || !$this->commonLibraryManager->isInteger($this->qty)) {
  557.             $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.error_message.invalid_quantity');
  558.         } elseif ($this->productId && $this->qty) {
  559.             $price $this->compareProductManager->getProductPriceByQty($this->productId$this->cultureId$this->qty);
  560.             
  561.             if ($price != null) {
  562.                 $this->responseArray['status'] = 'success';
  563.                 $this->responseArray['price'] = $price;
  564.             } else {
  565.                 $recordSet $this->compareProductManager->getProductDetailById($this->productId$this->cultureId);
  566.                 $this->responseArray['error_message'] = $this->serviceContainer->get('translator')->trans('product_compare.error_message.invalid_lowest_quantity', array('%min_quantity%'=>$this->commonLibraryManager->getLowestProductQty($recordSet[$this->productId]['pricing'])));
  567.                 unset($recordSet);
  568.             }
  569.         }
  570.         return new JsonResponse($this->responseArray);
  571.     }
  572.     /**
  573.      *
  574.      * @author Employee Id: 4074
  575.      *
  576.      * Desciption: This function allow user go back to page from where he/she came to compare product page.  
  577.      *
  578.      * @param NULL
  579.      *
  580.      * @return 302 Redirection Response
  581.      *
  582.      * @throws NULL
  583.      *
  584.      * @Route("/{_locale}/continue-shopping-from-compare-product",
  585.      *     name="office_brain_compareproductbundle_compareproduct_continueshopping"
  586.      * )
  587.      * 
  588.      * @Method({"GET"})
  589.      * 
  590.      */
  591.     public function continueShoppingAction(Request $request)
  592.     {
  593.         return $this->redirect($this->generateUrl('office_brain_searchbundle_search_continueshopping'));
  594.         /*
  595.         $this->initAction($request);
  596.         return $this->redirect($this->compareProductManager->getContinueShoppingUrl());
  597.         */
  598.     }
  599.     
  600.     
  601.     /**
  602.      *
  603.      * @author Employee Id: 4074
  604.      *
  605.      * Desciption: Prepare email html response and send to friend
  606.      *
  607.      * @param NULL
  608.      *
  609.      * @return NULL
  610.      *
  611.      * @throws NULL
  612.      *
  613.      */
  614.     private function sendMailToFriend()
  615.     {
  616.         $eventKey 'send_mail_to_friend';
  617.         
  618.         $this->responseArray['QtyValues'] = json_decode($this->request->get('QtyValues'));
  619.         $this->responseArray['priceProd'] = json_decode($this->request->get('priceProd'));
  620.         
  621.         $this->responseArray['record_set'] = $this->compareProductManager->getCompareProduct();
  622.         $this->responseArray['total_record'] = $this->compareProductManager->getTotalCount();
  623.         
  624.         $response $this->render('OfficeBrain/Bundle/CompareProductBundle/CompareProduct/mailTempleteEmailToFriendCompareProduct.html.twig'$this->responseArray);
  625.         
  626.         $templateParameterArray = array(
  627.             'message' => $this->form['message']->getData(),
  628.             'send_email_to_friend_template' => $response->getContent()
  629.         );
  630.         
  631.         $toEmailData $this->form['to_email']->getData();
  632.         $toEmailAry explode(","$toEmailData);
  633.         if(count($toEmailAry) > ){
  634.             foreach ($toEmailAry as $toEmail){
  635.                 $this->emailManager->sendMail($eventKey$toEmail$templateParameterArray$this->cultureId $this->form['from_email']->getData());
  636.             }
  637.         }
  638.         
  639.         unset($eventKey);
  640.         unset($response);
  641.         unset($templateParameterArray);
  642.     }
  643. }