public function setProductTemplateAction($productId)
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
            return $response;
        }

        $product = ProductQuery::create()->findPk($productId);

        if ($product != null) {
            $template_id = \intval($this->getRequest()->get('template_id', 0));

            $this->dispatch(
                TheliaEvents::PRODUCT_SET_TEMPLATE,
                new ProductSetTemplateEvent($product, $template_id, $this->getCurrentEditionCurrency()->getId())
            );
        }

        return $this->redirectToEditionTemplate();
    }
public function setProductTemplateAction($productId)
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
            return $response;
        }

        $product = ProductQuery::create()->findPk($productId);

        if ($product != null) {
            $template_id = \intval($this->getRequest()->get('template_id', 0));

            $this->dispatch(
                TheliaEvents::PRODUCT_SET_TEMPLATE,
                new ProductSetTemplateEvent($product, $template_id, $this->getCurrentEditionCurrency()->getId())
            );
        }

        return $this->redirectToEditionTemplate();
    }
public function setProductTemplateAction ( $ productId ) { // Check current user authorization if ( null !== $ response = $ this -> checkAuth ( $ this -> resourceCode , array ( ) , AccessManager :: UPDATE ) ) { return $ response ; } $ product = ProductQuery :: create ( ) -> findPk ( $ productId ) ; if ( $ product != null ) { $ template_id = \ intval ( $ this -> getRequest ( ) -> get ( 'template_id' , 0 ) ) ; $ this -> dispatch ( TheliaEvents :: PRODUCT_SET_TEMPLATE , new ProductSetTemplateEvent ( $ product , $ template_id , $ this -> getCurrentEditionCurrency ( ) -> getId ( ) ) ) ; } return $ this -> redirectToEditionTemplate ( ) ; }
Change product template for a given product.

@param  int                                              $productId
@return mixed|\Symfony\Component\HttpFoundation\Response
Change product template for a given product .