on 08-14-2016 9:28 AM
Hi experts, I have a requirement that I want to add wishlist link at homepage by using addon extension .When ever click on wishlist link it returns jsp page.Through addon it does not renders the storefront.Means it renders only when you changes directly at storefront,but I want to do this by Addon . How to achieve this?Please share if you have any idea.
Thank you..
Hi Sindhu, I can give you idea about render a component in add on. So you can refer this and you can use component wherever you want.
youraddon-items.xml:
<itemtype code="YourComponent" autocreate="true"
generate="true" extends="SimpleCMSComponent" >
<description>Represents component.</description>
</itemtype>
Make new page template using following impex:
INSERT_UPDATE PageTemplate;$contentCV[unique=true];uid[unique=true];name;frontendTemplateName;
;;yourPageTemplate;Your page;layout/yourResultPage;
# Add Velocity templates that are in the CMS Cockpit. These give a better layout for editing pages
# The FileLoaderValueTranslator loads a File into a String property. The templates could also be inserted in-line in this file.
INSERT_UPDATE PageTemplate;$contentCV[unique=true];uid[unique=true];velocityTemplate[translator=de.hybris.platform.commerceservices.impex.impl.FileLoaderValueTranslator]
;;yourPageTemplate ;$siteResource/structure-view/structure_yourPageTemplate.vm
# Search Results Grid Page Template
INSERT_UPDATE ContentSlotName;name[unique=true];template(uid,$contentCV)[unique=true][default='YourPageTemplate'];validComponentTypes(code);compTypeGroup(code)
;yourComponentSlot;;;wide
INSERT_UPDATE ContentSlotForTemplate;$contentCV[unique=true];uid[unique=true];position[unique=true];pageTemplate(uid,$contentCV)[unique=true][default='YourPageTemplate'];contentSlot(uid,$contentCV)[unique=true];allowOverwrite
;;YourComponentSlot-yourpage;yourComponentSlot;;yourComponentSlot;true
INSERT_UPDATE YourComponent;$contentCV[unique=true];uid[unique=true];name;actions(uid,$contentCV);&componentRef
;;yourComponent; Component;;yourComponent
INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active;cmsComponents(&componentRef);;;
;;yourComponentSlot;Slot for component;true;yourComponent;;;
Make controller for clicking your link and it will return a jsp containing your component: So for add on you have to make entry in
youradd-web-spring.xml:
<bean name="yourPageController" class="web.src.com.YourPageController"/>
<!-- add the url to controller mapping to the existing SimpleUrlHandlerMapping bean -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/yourmapping/**">yourPageController</prop>
</props>
</property>
</bean>
And your controller will have that request mapping and accept that mapping and return the jsp:
@Controller
@RequestMapping(value = "yourmapping")
public class YourPageController extends AbstractPageController
{
@RequestMapping(method = RequestMethod.GET)
public String yourFunction( final HttpServletRequest request,
final Model model) throws CMSItemNotFoundException
{
return "addon:/youraddon/pages/layout/yourResultPage";
}
}
If you want to know more please see this link: link text
and another link text
Hope this will help you, if yes please accept answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you added your jsp page at correct location: "youraddon\acceleratoraddon\web\webroot\WEB-INF\views"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jsp page not rendering it gives 404 exception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After add on installation your add on JSP should be copied to storefront/WEB-INF/addons/youraddonname/views/desktop/cms/youraddonjsp.jsp . If it is copied correctly again if you see that error will clearly say that JSP file which you are returning from your addon controller is pointing to wrong path.
But jsp page rendering is not happening at storefront.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.