Class ProductPageController


  • @Controller
    @Scope("tenant")
    @RequestMapping("/**/p")
    public class ProductPageController
    extends AbstractPageController
    Controller for product details page.
    • Constructor Detail

      • ProductPageController

        public ProductPageController()
    • Method Detail

      • productDetail

        @RequestMapping(value="/{productCode:.*}",
                        method=GET)
        public java.lang.String productDetail​(@PathVariable("productCode")
                                              java.lang.String productCode,
                                              org.springframework.ui.Model model,
                                              javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response)
                                       throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException,
                                              java.io.UnsupportedEncodingException
        View product details page.
        Parameters:
        productCode - product code
        model - page model
        request - http request
        response - http response
        Returns:
        path to PDP page
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException - thrown in case the product with ID specified is not found
        java.io.UnsupportedEncodingException - thrown in case encoding is not supported
      • showZoomImages

        @RequestMapping(value="/{productCode:.*}/zoomImages",
                        method=GET)
        public java.lang.String showZoomImages​(@PathVariable("productCode")
                                               java.lang.String productCode,
                                               @RequestParam(value="galleryPosition",required=false)
                                               java.lang.String galleryPosition,
                                               org.springframework.ui.Model model,
                                               javax.servlet.http.HttpServletRequest request)
        Zoom images.
        Parameters:
        productCode - product code
        galleryPosition - position of the gallery
        model - page model
        Returns:
        path to zoom images fragment
      • showQuickView

        @RequestMapping(value="/{productCode:.*}/quickView",
                        method=GET)
        public java.lang.String showQuickView​(@PathVariable("productCode")
                                              java.lang.String productCode,
                                              org.springframework.ui.Model model,
                                              javax.servlet.http.HttpServletRequest request)
        Quick view.
        Parameters:
        productCode - product code
        model - page model
        request - http request
        Returns:
        path to quick view fragment
      • postReview

        @RequestMapping(value="/{productCode:.*}/review",
                        method={GET,POST})
        public java.lang.String postReview​(@PathVariable
                                           java.lang.String productCode,
                                           ReviewForm form,
                                           org.springframework.validation.BindingResult result,
                                           org.springframework.ui.Model model,
                                           javax.servlet.http.HttpServletRequest request,
                                           org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
                                    throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Post review.
        Parameters:
        productCode - the product code
        form - review form
        result - binding result
        model - page model
        request - htto request
        redirectAttrs - redirect attributes
        Returns:
        returns the path to PDP page
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException - in case setup of review page fails the error is thrown
      • reviewHtml

        @RequestMapping(value="/{productCode:.*}/reviewhtml/{numberOfReviews:.*}",
                        method=GET)
        public java.lang.String reviewHtml​(@PathVariable("productCode")
                                           java.lang.String productCode,
                                           @PathVariable("numberOfReviews")
                                           java.lang.String numberOfReviews,
                                           org.springframework.ui.Model model,
                                           javax.servlet.http.HttpServletRequest request)
        Show review.
        Parameters:
        productCode - the product code
        numberOfReviews - number of reviews
        model - page model
        request - http request
        Returns:
        the path to reviews page tab
      • writeReview

        @RequestMapping(value="/{productCode:.*}/writeReview",
                        method=GET)
        public java.lang.String writeReview​(@PathVariable
                                            java.lang.String productCode,
                                            org.springframework.ui.Model model)
                                     throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Write review dialog.
        Parameters:
        productCode - product code
        model - page model
        Returns:
        path to review page
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException - in case setup of review page fails the error is thrown
      • setUpReviewPage

        protected void setUpReviewPage​(org.springframework.ui.Model model,
                                       ProductModel productModel)
                                throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      • writeReview

        @RequestMapping(value="/{productCode:.*}/writeReview",
                        method=POST)
        public java.lang.String writeReview​(@PathVariable
                                            java.lang.String productCode,
                                            ReviewForm form,
                                            org.springframework.validation.BindingResult result,
                                            org.springframework.ui.Model model,
                                            javax.servlet.http.HttpServletRequest request,
                                            org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
                                     throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Write review.
        Parameters:
        productCode - the product code
        form - input form object
        result - binding result
        model - page model
        request - request object
        redirectAttrs - redirect attributes
        Returns:
        returns path to PDP page with review message on the model
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException - in case
      • handleUnknownIdentifierException

        @ExceptionHandler(de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException.class)
        public java.lang.String handleUnknownIdentifierException​(de.hybris.platform.servicelayer.exceptions.UnknownIdentifierException exception,
                                                                 javax.servlet.http.HttpServletRequest request)
        Unknown identifier error.
        Parameters:
        exception - exception o bject
        request - http request
        Returns:
        forward patch to a 404 error page
      • updatePageTitle

        protected void updatePageTitle​(ProductModel productModel,
                                       org.springframework.ui.Model model)
      • populateProductDetailForDisplay

        protected void populateProductDetailForDisplay​(TmaProductOfferingModel productModel,
                                                       org.springframework.ui.Model model,
                                                       javax.servlet.http.HttpServletRequest request)
                                                throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      • populateProductData

        protected void populateProductData​(ProductData productData,
                                           org.springframework.ui.Model model,
                                           javax.servlet.http.HttpServletRequest request)
      • sortVariantOptionData

        protected void sortVariantOptionData​(ProductData productData)
      • getGalleryImages

        protected java.util.List<java.util.Map<java.lang.String,​ImageData>> getGalleryImages​(ProductData productData)
      • getPageForProduct

        protected AbstractPageModel getPageForProduct​(java.lang.String productCode)
                                               throws de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
        Throws:
        de.hybris.platform.cms2.exceptions.CMSItemNotFoundException
      • getTmaPoService

        protected TmaPoService getTmaPoService()
      • initBinder

        @InitBinder
        public void initBinder​(org.springframework.web.bind.WebDataBinder binder)