Skip to Content
0
Former Member
Jan 31, 2018 at 09:18 AM

Add To Cart button not displaying in PDP but displayed in PLP

714 Views

Hi experts, I am unable to see AddToCart button in PDP, but it's getting displayed in PLP and am successfully able to checkout, But I couldn't figure out where the problem was Since my cms-content looked fine for me,

This is how my PDP looks,
alt text

Here goes my cms-content snippet
alt text

HERE'S A BIT MORE DETAIL FOR CLEAR UNDERSTANDING,
productaddtocartpanel.tag

 <spring:htmlEscape defaultHtmlEscape="true" />
 
 <div class="qty">
     <c:if test="${product.purchasable}">
         <label for="qtyInput">
             <spring:theme code="basket.page.quantity"/>
         </label>
         <input type="text" maxlength="3" size="1" id="qtyInput" name="qtyInput" class="qty" value="1">
     </c:if>
     
     <c:if test="${product.stock.stockLevel gt 0}">
         <c:set var="productStockLevel">${product.stock.stockLevel} 
             <spring:theme code="product.variants.in.stock"/>
         </c:set>
     </c:if>
     <c:if test="${product.stock.stockLevelStatus.code eq 'lowStock'}">
         <c:set var="productStockLevel">
             <spring:theme code="product.variants.only.left" arguments="${product.stock.stockLevel}"/>
         </c:set>
     </c:if>
     <c:if test="${product.stock.stockLevelStatus.code eq 'inStock' and empty product.stock.stockLevel}">
         <c:set var="productStockLevel">
             <spring:theme code="product.variants.available"/>
         </c:set>
     </c:if>
 
     <ycommerce:testId code="productDetails_productInStock_label">
         <p class="stock_message">${productStockLevel}</p>
     </ycommerce:testId>
     
     <product:productFutureAvailability product="${product}" futureStockEnabled="${futureStockEnabled}" />
     
 </div>
 
 
 
 <div id="actions-container-for-${fn:escapeXml(component.uid)}" class="productAddToCartPanelContainer clearfix">
     <ul class="productAddToCartPanel clearfix">
         <c:if test="${multiDimensionalProduct}" >
             <c:url value="${product.url}/orderForm" var="productOrderFormUrl"/>
             <a href="${productOrderFormUrl}" class="button negative" id="productOrderButton" ><spring:theme code="order.form" /></a>
         </c:if>
         <action:actions element="li" styleClass="productAddToCartPanelItem" parentComponent="${component}"/>
     </ul>
 </div>  

And also addtocartaction.jsp

 <%@ page trimDirectiveWhitespaces="true" %>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
 <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
 <%@ taglib prefix="ycommerce" uri="http://hybris.com/tld/ycommercetags"%>
 <%@ taglib prefix="product" tagdir="/WEB-INF/tags/responsive/product" %>
 
 <spring:htmlEscape defaultHtmlEscape="true" />
 
 <c:url value="${url}" var="addToCartUrl"/>
 <spring:url value="${product.url}/configuratorPage/{/configuratorType}" var="configureProductUrl" htmlEscape="false">
     <spring:param name="configuratorType"  value="${configuratorType}"/>
 </spring:url>
 
 <product:addToCartTitle/>
 
 <form:form method="post" id="configureForm" class="configure_form" action="${configureProductUrl}">
 <c:if test="${product.purchasable}">
     <input type="hidden" maxlength="3" size="1" id="qty" name="qty" class="qty js-qty-selector-input" value="1">
 </c:if>
 <input type="hidden" name="productCodePost" value="${fn:escapeXml(product.code)}"/>
 
 <c:if test="${empty showAddToCart ? true : showAddToCart}">
     <c:set var="buttonType">button</c:set>
     <c:if test="${product.purchasable and product.stock.stockLevelStatus.code ne 'outOfStock' }">
         <c:set var="buttonType">submit</c:set>
     </c:if>
     <c:choose>
         <c:when test="${fn:contains(buttonType, 'button')}">
             <c:if test="${product.configurable}">
                 <button id="configureProduct" type="button" class="btn btn-primary btn-block js-enable-btn outOfStock" disabled="disabled">
                     <spring:theme code="basket.configure.product"/>
                 </button>
             </c:if>
         </c:when>
         <c:otherwise>
             <c:if test="${product.configurable}">
                 <button id="configureProduct" type="${buttonType}" class="btn btn-primary btn-block js-enable-btn" disabled="disabled"
                         name="configure">
                     <spring:theme code="basket.configure.product"/>
                 </button>
             </c:if>
         </c:otherwise>
     </c:choose>
 </c:if>
 </form:form>
 <form:form method="post" id="addToCartForm" class="add_to_cart_form" action="${addToCartUrl}">
 <c:if test="${product.purchasable}">
     <input type="hidden" maxlength="3" size="1" id="qty" name="qty" class="qty js-qty-selector-input" value="1">
 </c:if>
 <input type="hidden" name="productCodePost" value="${fn:escapeXml(product.code)}"/>
 
 <c:if test="${empty showAddToCart ? true : showAddToCart}">
     <c:set var="buttonType">button</c:set>
     <c:if test="${product.purchasable and product.stock.stockLevelStatus.code ne 'outOfStock' }">
         <c:set var="buttonType">submit</c:set>
     </c:if>
     
     <spring:theme var="addToCartProblemText" code="product.variants.out.of.stock"/>
     <c:if test="${product.internalOnly and !user.isInternal}">
     <c:set var="buttonType">button</c:set>
     <spring:theme var="addToCartProblemText" code="text.addToCart.unavailable"/>
     </c:if>
     
     <c:choose>
         <c:when test="${fn:contains(buttonType, 'button')}">
             <button type="${buttonType}" class="btn btn-primary btn-block js-add-to-cart btn-icon glyphicon-shopping-cart outOfStock" disabled="disabled">
                 <spring:theme code="product.variants.out.of.stock"/>
             </button>
         </c:when>
         <c:otherwise>
             <ycommerce:testId code="addToCartButton">
             <c:if test="${product.internalOnly and user.isInternal}">
     
                 <button id="addToCartButton" type="${buttonType}" class="btn btn-primary btn-block js-add-to-cart js-enable-btn btn-icon glyphicon-shopping-cart" disabled="disabled">
                     <spring:theme code="basket.add.to.basket"/>
                 </button>
                 </c:if>
             </ycommerce:testId>
         </c:otherwise>
     </c:choose>
 </c:if>
 
 
 </form:form>  

Plz Lemme know where I should correct!!!....Thanks in advance

Attachments

10320-cmsc.png (49.7 kB)
10321-pdp.png (216.5 kB)