@RequestMapping(value = "/productDetails.do", method = RequestMethod.GET)
  public String viewProductDetails(
      @RequestParam(value = "productId", required = true) final Long productId, ModelMap modelMap) {
    Product product = productService.getProductDetails(productId);

    List<String> models = new ArrayList<String>();

    models.add(product.getModel());

    List<com.ombillah.ecom4j.remix.domain.Products.Product> products =
        remixService.getRemixProducts(models);

    if (CollectionUtils.isEmpty(products)) {
      // this is for demonstration only to display a similar result!
      products =
          remixService.getProductOfCategory(
              product.getMake(), product.getCategory().getCategoryId());
    }

    if (!CollectionUtils.isEmpty(products)) {
      List<String> skus = new ArrayList<String>();
      skus.add(Integer.toString(products.get(0).getSku()));
      List<Review> reviews = remixService.getRemixReviews(skus);

      modelMap.put("remixProduct", products.get(0));
      modelMap.put("reviews", reviews);
    }

    return "productDetails";
  }
Esempio n. 2
0
 @RequestMapping(value = {"/home.do", "/"})
 public String displayHomePage(ModelMap map) {
   List<Product> featuredProducts = productService.getFeaturedProducts();
   map.put("featuredProducts", featuredProducts);
   return "homePage";
 }