Skip to Content
author's profile photo Former Member
Former Member

How to add componenet to the storefront by usig addon extension

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..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2016 at 12:59 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2016 at 04:09 PM

    Thank you so much

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 16, 2016 at 09:45 AM

    But jsp page rendering is not happening at storefront.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Can you tell us what is the error ... ??? Did you installed that add on correctly check it once... ?? After installation of add on your add on related controller class should be called after that add on JSP will be rendered,Check whether that controller is getting called or not... ???

  • author's profile photo Former Member
    Former Member
    Posted on Aug 16, 2016 at 01:46 PM

    Jsp page not rendering it gives 404 exception

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 16, 2016 at 02:33 PM

    Have you added your jsp page at correct location: "youraddon\acceleratoraddon\web\webroot\WEB-INF\views"?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.