Welcome To The Connected Business Community Forum.
0 votes
33 views
Hi,

I'm working on getting the Add to Cart form to change the text on the button based on the available stock for an item. When the item has stock, the button will read, "Add to Cart." When there is 0 or less stock available, it will say, "Pre-Order." This would be implemented in helper.product.xml.config. However, when I try to implement it using code to check for stock, it will only use the "Out of Stock" option no matter how many are in stock. I've fooled around with several configurations but for some reason it doesn't seem to be working.

Here's the code I'm using:

<xsl:choose>
                                <xsl:when test="current()/ITEM_FREESTOCK > 0">
                                  <button title="Add To Shoppping Cart" type="submit" id="{concat('AddToCart_', $item_counter)}" class="btn btn-success addtocartbutton content"
                                     name="{concat('AddToCart_', $item_counter)}"
                                     data-contentkey="shoppingcart.cs.33"
                                     data-contentvalue="{FIELD/EDITCART_BUTTON_CAPTION}"
                                     data-contenttype="string resource"
                                     value="{FIELD/ADDTOCART_BUTTON_CAPTION}"
                                     >
                                  <i class="fa fa-shopping-cart"></i> <span class="cartlbl"> Add To Cart</span>
                                </button>
                                </xsl:when>
                            
                                <xsl:otherwise>
                                  <button title="Add To Shoppping Cart" type="submit" id="{concat('AddToCart_', $item_counter)}" class="btn btn-success addtocartbutton content"
                                     name="{concat('AddToCart_', $item_counter)}"
                                     data-contentkey="shoppingcart.cs.33"
                                     data-contentvalue="{FIELD/EDITCART_BUTTON_CAPTION}"
                                     data-contenttype="string resource"
                                     value="{FIELD/ADDTOCART_BUTTON_CAPTION}"
                                     >
                                  <i class="fa fa-shopping-cart"></i> <span class="cartlbl"> Pre-Order Now</span>
                                </button>
                                </xsl:otherwise>
                              </xsl:choose>

Any suggestions for getting this to work?
asked Sep 29, 2017 in eCommerce by AtlasEric (120 points) | 33 views

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
131 questions
164 answers
190 comments
47 users