<?php

namespace OfficeBrain\CustomBundle\OrderBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Translation\Translator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use OfficeBrain\Bundle\UserBundle\Form\ContactBookType;
use OfficeBrain\Bundle\UserBundle\Entity\ContactBook;
use OfficeBrain\Bundle\OrderBundle\Form\OrderAddGuestShippingType;
use OfficeBrain\Bundle\OrderBundle\Form\GuestUserType;
use OfficeBrain\Bundle\OrderBundle\Form\GuestInfoType;
use OfficeBrain\Bundle\OrderBundle\Controller\OrderController as BaseOrderController;


/**
 *
 * @Route("", defaults={"rule_service"="rule_charges"})
 */
class OrderController extends BaseOrderController
{
	/**
	 *
	 * @author Employee Id: 5497
	 * Create various objects required action in this class
	 * @return NULL
	 */
	public function initAction()
	{
		parent::initAction();
		
		$this->promoCouponManager = $this->get('office_brain_promo_coupon_manager');
		$this->couponUsersManager = $this->get('office_brain_coupon_users_manager');
		$this->orderManager = $this->get('office_brain_order_manager');
	}
	
	
	/**
	* To get cart product list
	*
	* @Route("/{_locale}/cart-list",
	* 	name="office_brain_orderbundle_order_cartlist"
	* )
	* @Template("OfficeBrainOrderBundle:Order:cartList.html.twig")
	*/
	public function cartListAction()
	{
		$this->initAction();
		if($this->userId==0 && $this->projectSetting['configuration_rule']['transaction']['shopping_cart']['guest_user']['status'] != 1){
			$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route')));
			return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
		}
	
		$this->responseArray['total_record'] = $this->orderManager->getTotalCount();
		$this->deliveryStatus= $this->orderManager->checkProductDeliveryDate();
		$this->responseArray['shopping_cart_list'] = $this->orderManager->getCartList();//echo "<pre>";print_r($this->responseArray['shopping_cart_list']);exit;

		$this->displayInactiveProductMessage($this->responseArray['shopping_cart_list']);
		
		$this->orderManager->setContinueShoppingUrl($this->commonLibraryManager->getRefererRouteName(), $this->commonLibraryManager->getRefererUrl());
		return $this->responseArray;
	}
	
    /**
     * To get dicount code
     *
     * @Route("/{_locale}/redeem-cart-discount-code",
     * name="office_brain_orderbundle_order_cartlist_discountcode",
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainCustomBundleOrderBundle:Order:cartDiscountList.html.twig")
     */
    public function cartDiscountCodeAction()
    {
    	$this->initAction();

    	if($this->userId==0){
    		$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route')));
    		$this->responseArray['page_redirect'] = $this->generateUrl('office_brain_userbundle_login_login');
    	} else {
    		//validate coupon code
    		$resMsg = $this->promoCouponManager->validateCouponCode();
    		if($resMsg == 'INVALID_PROMO_CODE') {
    			return new JsonResponse(array('error' => 'Please insert valid coupon code', 'page_url' => $this->generateUrl('office_brain_orderbundle_order_cartlist', array())));
    		}
    		elseif($resMsg == 'EXPIRED_PROMO_CODE') {
    			return new JsonResponse(array('error' => 'Coupon code is expired', 'page_url' => $this->generateUrl('office_brain_orderbundle_order_cartlist', array())));
    		}
    		elseif($resMsg == 'EXIST_PROMO_CODE') {
    			return new JsonResponse(array('error' => 'Coupon code is already applied', 'page_url' => $this->generateUrl('office_brain_orderbundle_order_cartlist', array())));
    		}
    		elseif($resMsg == 'VALID_PROMO_CODE') {
    			$this->responseArray['total_record'] = $this->orderManager->getTotalCount();
    			$this->deliveryStatus= $this->orderManager->checkProductDeliveryDate();
    			$this->responseArray['shopping_cart_list'] = $this->orderManager->getCartList();//echo "<pre>";print_r($this->responseArray['shopping_cart_list']);exit;
    			$this->orderManager->setContinueShoppingUrl($this->commonLibraryManager->getRefererRouteName(), $this->commonLibraryManager->getRefererUrl());
    		}
    	}
		
    	return $this->responseArray;
    }
    
    /**
     * To get dicount code
     *
     * @Route("/{_locale}/remove-cart-discount-code",
     * name="office_brain_orderbundle_order_removediscountcode",
     * options={"expose"=true}
     * )
     */
    public function removeDiscountCodeAction()
    {
    	$this->initAction();

    	if($this->userId==0){
    		$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route')));
    		$this->responseArray['page_redirect'] = $this->generateUrl('office_brain_userbundle_login_login');
    		$this->responseArray['status'] = 'error';
    		$this->responseArray['message'] = 'Please remove valid coupon Code';
    	} else {
    		$this->promoCouponManager->removeCouponCode();
    		$this->responseArray['status'] = 'success';
    		$this->responseArray['page_redirect'] = $this->generateUrl('office_brain_orderbundle_order_cartlist');
    		$this->responseArray['message'] = 'Coupon Code is removed successfully';
    	}

    	return new JsonResponse($this->responseArray);
    }
    
    /**
     * Description : Use to render the Shipping address for Session Quote List
     * @return type : json
     * @throws Exception: Null
     *
     * @Route("/{_locale}/get-total-quantatity-by-product-id-order/{product_id}",
     * name="office_brain_requestquotebundle_requestquote_gettotalquantatiybyproductid",
     * options={"expose"=true}
     * )
     * @Method({"GET"})
     * @Template("OfficeBrainOrderBundle:Order:getTotalQuantatiyByProductId.html.twig")
     */
    public function getTotalQuantatiyByProductIdAction()
    {
    	$this->initAction();
    	$productId = $this->request->get ( 'product_id' );
    	$aryRequestQuote = $this->orderManager->getCartList()[$productId]['color'];
    	$quantity = 0;
    	foreach($aryRequestQuote as $imprintDetail)
    	{
    		foreach ($imprintDetail['quantity'] as $quantityVal)
    		{
    			$quantity = $quantity + $quantityVal;
    		}
    	}
    	return array (
    			'total_quantity' => $quantity
    	);
    }
    
    /**
     * To get cart product list
     *
     * @Route("/{_locale}/checkout-detail",
     * 	name="office_brain_orderbundle_order_checkoutdetail"
     * )
     * @Template("OfficeBrainOrderBundle:Order:checkoutDetail.html.twig")
     */
    public function checkoutDetailAction()
    {
    	$this->initAction();
    	$this->responseArray['total_record'] = $this->orderManager->getTotalCount();
    	if($this->responseArray['total_record']>0){
    		$this->deliveryStatus= $this->orderManager->checkProductDeliveryDate();
    		
    		$this->responseArray['data'] = $this->userContactBookManager->getContactBookByEmail($this->user->getEmail(),2);
    		$this->responseArray['ob_project_setting'] = $this->projectSetting;
    		
    		if($this->deliveryStatus['status'] == 'delay' || $this->deliveryStatus['status'] == 'is_deleted')
    		{
    			$this->responseArray['checkout_product_list'] = $this->orderManager->getCartList();
    			return $this->responseArray;
    			return $this->redirect($this->generateUrl('office_brain_orderbundle_order_cartlist'));
    		}
    		else
    		{
    			$this->responseArray['checkout_product_list'] = $this->orderManager->getCartList();
    			
    			$this->displayInactiveProductMessage($this->responseArray['checkout_product_list']);

    			return $this->responseArray;
    		}
    	}else{
    		return $this->redirect($this->generateUrl('office_brain_orderbundle_order_cartlist'));
    	}
    }
    
    /**
     * @author Employee Id: 5633
     * Description : Use to submit guest user info form.
     * @param 1 : No paramater
     * @return type : Form view and data.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/order-details/{order_id}",
     * name="office_brain_orderbundle_order_orderdetails",
     * defaults={"order_id"=null},
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:orderDetails.html.twig")
     *
     */
    public function orderDetailsAction()
    {	
    	$this->initAction();
    	if($this->userId==0 && $this->projectSetting['configuration_rule']['transaction']['shopping_cart']['guest_user']['status'] != 1){
    		$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route'),array('order_id'=>$this->request->get('order_id'))));
    		return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
    	}
    	$orderDetail = $this->orderManager->isOrderExists();
    	$culture = $orderDetail->getCulture();
    	$this->responseArray['order'] = $orderDetail;
    	$this->responseArray['data'] = $this->orderManager->getProductList(0, $culture);
    	$this->responseArray['instance_type']= $this->instanceType;
    	return $this->responseArray;
    
    }
    
    /**
     * @author Employee Id: 5633
     * Description : Use to submit guest user info form.
     * @param 1 : No paramater
     * @return type : Form view and data.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/view-order-details/{order_id}",
     * name="office_brain_orderbundle_order_vieworderdetails",
     * defaults={"order_id"=null},
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:viewOrderDetails.html.twig")
     *
     */
    public function viewOrderDetailsAction()
    {  
    	$this->initAction();
    	
    	if($this->userId==0){
    		$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route'),array('order_id'=>$this->request->get('order_id'))));
    		return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
    	}
    	$orderId = $this->request->get ( 'order_id' );
    	$coupCode = $this->promoCouponManager->getCounpCodeByOrder($orderId);
    	if (empty($coupCode)) {
    		$coupCode =0;
    		$coupcodeName = '';
    	}else{
    		$coupcodeName = $this->promoCouponManager->getPromoCouponById($coupCode[0]->getCouponId());
    		$coupcodeName = $coupcodeName->getCouponName();
    	}
    	
    	$coupCode = $this->promoCouponManager->getOrderLineDiscountDetail($coupCode);
    	
    	
    	
    	$orderDetail = $this->orderManager->isOrderExists();
    	if($orderDetail->getOrderItemLine()){
    		foreach($orderDetail->getOrderItemLine() as $item_line){
    			$item_line->setProductDetailConfiguration(unserialize(base64_decode($item_line->getProductDetailConfiguration())));
    		}
    	}
    	$culture = $orderDetail->getCulture();
    	$this->responseArray['order'] = $orderDetail;
    	$this->responseArray['data'] = $this->orderManager->getProductList(0, $culture);
    	$this->responseArray['couponinfo'] = $coupCode;
    	$this->responseArray['couponName'] = $coupcodeName;
    	$this->responseArray['instance_type']= $this->instanceType;

    	return $this->responseArray;
    
    }
    
    /**
     * @author Employee Id: 5633
     * Description : Use to submit guest user info form.
     * @param 1 : No paramater
     * @return type : Form print data.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/print-order-details/{order_id}",
     * name="office_brain_custombundle_orderbundle_order_printorderdetails",
     * defaults={"order_id"=null},
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainCustomBundleOrderBundle:Order:printOrderDetails.html.twig")
     *
     */
    public function printOrderDetailsAction()
    {
    	$this->initAction();
    	$orderId = $this->request->get ( 'order_id' );
    	$coupCode = $this->promoCouponManager->getCounpCodeByOrder($orderId);
    	if (empty($coupCode)) {
    		$coupCode =0;
    		$coupcodeName = '';
    	}else{
    		$coupcodeName = $this->promoCouponManager->getPromoCouponById($coupCode[0]->getCouponId());
    		$coupcodeName = $coupcodeName->getCouponName();
    	}
    	
    	$coupCode = $this->promoCouponManager->getOrderLineDiscountDetail($coupCode);
    	
    	
    	
    	$orderDetail = $this->orderManager->isOrderExists();
    	if($orderDetail->getOrderItemLine()){
    		foreach($orderDetail->getOrderItemLine() as $item_line){
    			$item_line->setProductDetailConfiguration(unserialize(base64_decode($item_line->getProductDetailConfiguration())));
    		}
    	}
    	$culture = $orderDetail->getCulture();
    	$this->responseArray['order'] = $orderDetail;
    	$this->responseArray['data'] = $this->orderManager->getProductList(0, $culture);
    	$this->responseArray['couponinfo'] = $coupCode;
    	$this->responseArray['couponName'] = $coupcodeName;
    	$this->responseArray['instance_type']= $this->instanceType;
    
    	return $this->responseArray;
    
    }
    
    /**
     * @author Employee Id: 4203
     * @Route("/{_locale}/payment-success",
     * name="office_brain_orderbundle_payment_paymentsuccess"
     * )
     * @Template("OfficeBrainOrderBundle:Order:paymentSuccess.html.twig")
     */
    
    public function paymentSuccessAction(){
    	$this->initAction();
    	$result = $this->orderManager->addOrderDetail();
    	if ($this->erpIntegration && $this->erpIntegration['orderManagement'] == 1 && !empty($this->queueApiManager)) {
    		$this->queueApiManager->mapQueue("create", $result['data']);
    	}
    	if(isset($_COOKIE['virtualLogofyCartSequenceId'])){
    		$response = new Response();
    		$response->headers->setCookie(new Cookie('virtualLogofyCartSequenceId', "" , time() - (10 * 365 * 24 * 60 * 60), '/', null, false, false));
    	}
    	if(array_key_exists('error',$result)){
    		return array('id'=>$result['data']->getId(),'instance_id' => $this->instanceId);
    	}else{
    		return array('id'=>0);
    	}
    
    }
    
    /**
     * @author Employee Id: 4217
     * Description : Use to display order list
     * @param 1 : No paramater
     * @return type : Form view and data.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/order-list",
     * name="office_brain_orderbundle_order_orderlist",
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:orderList.html.twig")
     *
     */
    public function orderListAction()
    {
    	$this->initAction();
    	$this->prepareSearchParameterArray();
    	if( $this->userId==0){
    		if ($this->request->isXmlHttpRequest()) {
    			$this->responseArray['status'] = 'error';
    			$this->responseArray['error_type'] = 'loginError';
    			$this->responseArray['page_url'] = $this->generateUrl('office_brain_userbundle_login_login');
    			return new JsonResponse($this->responseArray);
    		}else{
    			$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route')));
    			return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
    		}
    	}
    	$this->prepareSearchParameterArray();
    	//$this->page = 1;
    	//$this->recordsPerPage = 1;
    	$this->responseArray['records_per_page'] = $this->recordsPerPage;
    	$this->responseArray['page'] = $this->page;
    	$this->responseArray['status'] = 'success';
    	$this->responseArray['data'] = $this->orderManager->getOrderList($this->searchParameterArray, $this->searchKeyWordsArray, $this->page, $this->recordsPerPage);
    
    	return $this->responseArray;
    }
    
    /**
     * @author Employee Id: 4217
     * OB eCommerce Product - preapre  search parameter
     */
    private function prepareSearchParameterArray()
    {
    	$this->option = $this->request->get('option', null);
    	$this->keywords = $this->request->get('keywords', null);
    	$this->searchKeyWordsArray[$this->option]=trim($this->keywords);
    
    	$this->start_date = $this->request->get('start_date', null);
    	$this->end_date = $this->request->get('end_date', null);
    	$this->searchParameterArray['start_date'] = $this->start_date;
    	$this->searchParameterArray['end_date'] = $this->end_date;
    	
    	$this->responseArray['start_date'] = $this->start_date;
    	$this->responseArray['end_date'] = $this->end_date;
    	$this->responseArray['keywords'] = $this->keywords;
    }
    
    private function displayInactiveProductMessage($cartProduts) {
    	$skuList = array();
    	foreach($cartProduts as $itemLine) {
    		if ($itemLine['active'] == '' or $itemLine['active'] == false) {
    			$skuList[] = $itemLine['sku_code'];
    		}
    	}
    	array_unique($skuList);

    	if (count($skuList) > 0) {
    		$this->get('session')->getFlashBag()->set('error_message', 'One or more products(SKU: '.implode(',',$skuList).') added into cart are no longer active, please contact goldstar team for further assistnace. You can remove these items and continue shopping.');
    	}
    }
    
    /**
     * Description : Use to render Shipping by Type (Statndard/Split)
     * @param 1 : No paramater
     * @return type : Ajax response in view.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/order-select-checkout-shipping-type",
     * name="office_brain_orderbundle_order_selectCheckoutShippingType",
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:selectCheckoutShippingType.html.twig")
     *
     */
    public function selectCheckoutShippingTypeAction()
    {
    	$this->initAction();
    	$this->responseArray['total_record'] = $this->orderManager->getTotalCount();
    	if($this->responseArray['total_record']>0){
    		$productsInfo = array();
    		$cartData = $this->orderManager->getCartList();
    		$productsInfo = $this->orderManager->getShippingTypeList($cartData);
    		
    		$this->responseArray['userId'] = $this->userId;
    		$this->responseArray['edit'] = 0;
    		$this->responseArray['order_type'] = 'decorative';
    		$this->responseArray['config'] = $productsInfo['config'];
    		unset($productsInfo['config']);
    		
    		foreach($cartData as $k=>$cartData) {
    			$productsInfo[$cartData['cart_id']]['shipping_estimator'] = 'no';
    			$shipdetail = $this->shippingEstimatorManager->checkShippingDetailAvailable($cartData['cart_id']);
    			if ($shipdetail == true) {
    				$productsInfo[$cartData['cart_id']]['shipping_estimator'] = 'yes';
    			}
    			
    			$productsInfo[$cartData['cart_id']]['color_info'] = $this->orderManager->checkForAttribute($this->responseArray[$cartData['cart_id']]['product_attributes']);
    			$this->responseArray['cart_id'][] = $cartData['cart_id'];
    			$this->responseArray['product_id'][] = $cartData['product_id'];
    		}
    		$this->responseArray['shipping_array'] = $productsInfo;
    		$this->responseArray['config']['cart_id'] = implode(',',$this->responseArray['cart_id']);
    		$this->responseArray['config']['product_id'] = implode(',',$this->responseArray['product_id']);
//     		$this->responseArray['ob_project_setting'] = $this->projectSetting;
//     		$this->responseArray['checkout_product_list'] = $this->orderManager->getCartList();
    		
    		unset($this->responseArray['cart_id']);
    		unset($this->responseArray['status']);
    		//dump($this->responseArray);exit;
    		return $this->responseArray;
    	}
    	else{
    		return $this->redirect($this->generateUrl('office_brain_orderbundle_order_checkoutdetail'));
    	}
    }
    
    /**
     * Description : Use to remove shipping and render twig
     * @param 1 : No paramater
     * @return type : Ajax response in view.
     * @throws Exception: Null
     *
     * @Route("/{_locale}/remove-checkout-shipping-by-counter-order",
     * name="office_brain_orderbundle_order_removeCheckoutShippingByCounter",
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:removeCheckoutShippingByCounter.html.twig")
     * @Method({"POST","GET"})
     */
    public function removeCheckoutShippingByCounterAction()
    {
    	$this->initAction();
    	$cartData = $this->orderManager->getCartList();
    	$data = $this->orderManager->removeCheckoutShippingCounterById($cartData);
    	$productId = $data['data'][0]['product_id'];
    	//echo count($data['shipping_array']);exit;
    	$data['shipping_estimator'] = 'no';
    	
    	if($productId != '' && (!(empty($productId))))
    	{
    		$productIds= explode(',',$productId);
    	}
    	if($cartId != '' && (!(empty($cartId))))
    	{
    		$cartIds= explode(',',$cartId);
    	}
    	if(is_array($productIds)) {
    		foreach($productIds as $key => $pid) {
    			if($cartIds[$key] > 0)
    			{
    				$data['shipping_array'][$cartIds[$key]]['shipping_estimator'] = 'no';
    			}
    			$shipdetail = $this->shippingEstimatorManager->checkShippingDetailAvailable($pid);
    			if ($shipdetail == true)
    			{
    				$data['shipping_array'][$cartIds[$key]]['shipping_estimator'] = 'yes';
    				$data['shipping_estimator'] = 'yes';
    			}
    		}
    	}
    	
    	$data['userId'] = $this->userId;//dump($data);exit;
    	return $data;
    }
    
    /**
     * Description : Use to set session data for order
     * @param 1 : No paramater
     * @return type : json
     * @throws Exception: Null
     *
     * @Route("/{_locale}/set-product-to-shipping",
     * name="office_brain_orderbundle_order_setproducttoshipping",
     * options={"expose"=true}
     * )
     * @Method({"POST"})
     * @Template("OfficeBrainOrderBundle:Order:setProductToCart.html.twig")
     */
    public function setProductToShippingAction()
    {
    	$this->initAction();
    	
    	if( $this->userId==0 ){
    		$this->get('session')->set('_security.main.target_path', $this->generateUrl($this->request->get('_route')));
    		return $this->redirect($this->generateUrl('office_brain_userbundle_login_login'));
    	}
    	else
    	{
    		$this->validationManager->setProjectConfiguration($this->productDetailconfigurationRule);
    		$this->validationManager->setRules('shipping_method', 'shippingCheckoutMethod','shippingMethod');
    		
    		if($this->validationManager->isValid()){
    			$status = $this->orderManager->setShippingAddToCart();
    			switch ($status)
    			{
    				case 'SUCCESS':
    					$this->responseArray['status'] = 'success';
    					$this->responseArray['success_message'] = $this->get('translator')->trans('order.add_success_message');
    					break;
    				default:
    					$this->generateUrl('office_brain_orderbundle_order_checkoutdetail');
    			}
    			$this->responseArray['total_product'] = $this->orderManager->getTotalCount();
    		}
    		else
    		{
    			$this->responseArray['status'] = 'error';
    			$this->responseArray['error_data'] = $this->validationManager->isError();
    			return new JsonResponse($this->responseArray);
    		}
    		return new JsonResponse($this->responseArray);
    	}
    }
    
    
    /**
     * To get checkout review order product list
     *
     * @Route("/{_locale}/review-order-update",
     * 	name="office_brain_orderbundle_review_order_update",
     * options={"expose"=true}
     * )
     * @Template("OfficeBrainOrderBundle:Order:reviewOrderUpdate.html.twig")
     */
    public function reviewOrderUpdateAction()
    {
    	$this->initAction();
    	$this->responseArray['total_record'] = $this->orderManager->getTotalCount();
    	if($this->responseArray['total_record']>0){
    		$this->deliveryStatus= $this->orderManager->checkProductDeliveryDate();
    		
    		$this->responseArray['data'] = $this->userContactBookManager->getContactBookByEmail($this->user->getEmail(),2);
    		$this->responseArray['ob_project_setting'] = $this->projectSetting;
    		
    		if($this->deliveryStatus['status'] == 'delay' || $this->deliveryStatus['status'] == 'is_deleted')
    		{
    			$this->responseArray['checkout_product_list'] = $this->orderManager->getCartList();
    			return $this->responseArray;
    			return $this->redirect($this->generateUrl('office_brain_orderbundle_order_cartlist'));
    		}
    		else
    		{
    			$this->responseArray['checkout_product_list'] = $this->orderManager->getCartList();
    			
    			$this->displayInactiveProductMessage($this->responseArray['checkout_product_list']);
    			return $this->responseArray;
    		}
    	}else{
    		return $this->redirect($this->generateUrl('office_brain_orderbundle_order_cartlist'));
    	}
    }
}
