I created addon and jsp tag, which is located at : bin\custom\Myaddon\acceleratoraddon\web\webroot\WEB-INF\tags\desctop\product\productList.tag
Here is code of productList.tag:
<%@ tag body-content="empty" trimDirectiveWhitespaces="true" %>
<%@ attribute name="product" required="true" type="de.hybris.platform.commercefacades.product.data.ProductData" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="ycommerce" uri="http://hybris.com/tld/ycommercetags" %>
<div class="addmybutton">
<form id="add_to_list_form" action="${addToListUrl}" method="post">
<input name="code" type="hidden" value="${product.code}"/>
<input name="isPostponed" type="hidden" value="false"/>
<input type="hidden" name="CSRFToken" value="${CSRFToken.token}">
<button id="add_to_list_submit_button" type="submit" class="b-btn b-btn--red i-fs14"><spring:theme
code="text.addToMyList"/></button>
</form>
</div>
How i can make this jsp tag appear inside the jsp page (or any jsp tag) which locates in storefront?
For instance, if I want to add my jsp tag to productLayout1Page.jsp (which automatically created when we create storefront extention).
Location of productLayout1Page.jsp: bin\custom\myModule\myModulestorefront\web\webroot\WEB-INF\views\responsive\pages\product\productLayout1Page.jsp
Here is a code of productLayout1Page.jsp:
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="template" tagdir="/WEB-INF/tags/responsive/template"%>
<%@ taglib prefix="cms" uri="http://hybris.com/tld/cmstags"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/responsive/product"%>
</cms:pageSlot>
<product:productDetailsPanel />
<cms:pageSlot position="CrossSelling" var="comp" element="div" class="productDetailsPageSectionCrossSelling">
<cms:component component="${comp}" element="div" class="productDetailsPageSectionCrossSelling-component"/>
</cms:pageSlot>
<cms:pageSlot position="Section2" var="comp" element="div" class="productDetailsPageSection2">
<cms:component component="${comp}" element="div" class="productDetailsPageSection2-component"/>
</cms:pageSlot>
<cms:pageSlot position="Section3" var="comp" element="div" class="productDetailsPageSection3">
<cms:component component="${comp}" element="div" class="productDetailsPageSection3-component"/>
</cms:pageSlot>
<cms:pageSlot position="UpSelling" var="comp" element="div" class="productDetailsPageSectionUpSelling">
<cms:component component="${comp}" element="div" class="productDetailsPageSectionUpSelling-component"/>
</cms:pageSlot>
<product:productPageTabs />
<cms:pageSlot position="Section4" var="comp" element="div" class="productDetailsPageSection4">
<cms:component component="${comp}" element="div" class="productDetailsPageSection4-component"/>
</cms:pageSlot>
I should add code only to my addon. All changes should appear on storefront only after ant all
.
If you want to edit html content of a page without making changes to the storefronts files, you have 2 options:
In a lot of cases it is almost inevitable to change the content of the jsp files in the storefront.