use of com.salesmanager.core.model.content.ContentDescription in project shopizer by shopizer-ecommerce.
the class ShopContentController method displayContent.
@RequestMapping("/shop/pages/{friendlyUrl}.html")
public String displayContent(@PathVariable final String friendlyUrl, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception {
MerchantStore store = (MerchantStore) request.getAttribute(Constants.MERCHANT_STORE);
ContentDescription contentDescription = contentService.getBySeUrl(store, friendlyUrl);
Content content = null;
if (contentDescription != null) {
content = contentDescription.getContent();
if (!content.isVisible()) {
return "redirect:/shop";
}
// meta information
PageInformation pageInformation = new PageInformation();
pageInformation.setPageDescription(contentDescription.getMetatagDescription());
pageInformation.setPageKeywords(contentDescription.getMetatagKeywords());
pageInformation.setPageTitle(contentDescription.getTitle());
pageInformation.setPageUrl(contentDescription.getName());
request.setAttribute(Constants.REQUEST_PAGE_INFORMATION, pageInformation);
}
// TODO breadcrumbs
request.setAttribute(Constants.LINK_CODE, contentDescription.getSeUrl());
model.addAttribute("content", contentDescription);
if (!StringUtils.isBlank(content.getProductGroup())) {
model.addAttribute("productGroup", content.getProductGroup());
}
/**
* template *
*/
StringBuilder template = new StringBuilder().append(ControllerConstants.Tiles.Content.content).append(".").append(store.getStoreTemplate());
return template.toString();
}
Aggregations