The following information will tell you how to use quantity break tokens in a template.
Step-by-step guide
The following table shows the tokens that can be used in a template to retrieve quantity break information for the current product:
Token | Data Type Returned | Description |
---|---|---|
HasQuantityBreaks | bool (true/false) | Whether or not the current product has quantity breaks defined. |
QuantityBreaks | QuantityBreakInformation* (see below) | A list of all the quantity breaks for the current product. Prices are INC or EX tax, determined by settings on the customer. |
QuantityBreaksExGST | QuantityBreakInformation* (see below) | A list of all the quantity breaks for the current product. Prices are EX tax. |
QuantityBreaksIncGST | QuantityBreakInformation* (see below) | A list of all the quantity breaks for the current product. Prices are INC tax. |
QuantityBreakInformation - a list of quantity breaks that include the following fields:
Field | Data Type | Description |
---|---|---|
Break | int (integer) | The starting quantity break number. |
BreakEnd | int (integer) | The ending quantity break number. |
Price | decimal | The price of the quantity break. |
BreakRange | string | A formatted representation of the quantity range values. |
Example template that shows the quantity breaks for a product:
Razor syntax example - Version 4 Template
@{ Product product = Model.Product; } @if(product.HasQuantityBreaks) { <div class="product-content-price-paper-bulkinfo"> <span>Bulk quantity discounts available.</span> <span class="paper-extend-button-show product-content-price-paper-bulkinfo-link right">See Details</span> <span class="paper-extend-button-hide product-content-price-paper-bulkinfo-link right" style="display:none;">Hide Details</span> <div class="product-content-price-paper-bulkinfo-extend paper-expand-box"> <table class="table-paper" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th class="text-left">Qty</th> <th class="text-right">Unit $ (ex. GST)</th> </tr> @foreach(var qtyBreakItem in Model.Product.QuantityBreaks) { <tr> <td class='text-left'>@(qtyBreakItem.BreakRange)</td> <td class='text-right'>$@(qtyBreakItem.Price.ToString("0.00"))</td> </tr> } </table> </div> </div> }
CSSRepeat Example - Version 2 & 3 templates
<h3>[Product.Description] ([Product.ProductCode] | [Product.CustomerProductCode])</h3> <hr /> <h5>Quantity Breaks</h5> Product.HasLiveQuantityBreaks = [Product.HasLiveQuantityBreaks]<br /> Product.HasQuantityBreaks = [Product.HasQuantityBreaks]<br /> <table border="1" style="border-collapse: collapse"> <tr> <th>Type</th> <th>Range</th> <th>Price</th> <th>All properties</th> </tr> <!--CSSREPEAT:Product--> <!--CSSREPEAT:Product.LiveQuantityBreaks--> <tr> <td>LIVE</td> <td>[Product.LiveQuantityBreaks.BreakRange]</td> <td>$ [Product.LiveQuantityBreaks.Price]</td> <td> [Product.LiveQuantityBreaks.Break]<br /> [Product.LiveQuantityBreaks.BreakEnd]<br /> $ [Product.LiveQuantityBreaks.Price]<br /> [Product.LiveQuantityBreaks.BreakRange]<br /> </td> </tr> <!--CSSENDREPEAT:Product.LiveQuantityBreaks--> <!--CSSREPEAT:Product.QuantityBreaks--> <tr style="background-color: #FFEEEE"> <td>NON-LIVE</td> <td>[Product.QuantityBreaks.BreakRange]</td> <td>$ [Product.QuantityBreaks.Price]</td> <td> [Product.QuantityBreaks.Break]<br /> [Product.QuantityBreaks.BreakEnd]<br /> $ [Product.QuantityBreaks.Price]<br /> [Product.QuantityBreaks.BreakRange]<br /> </td> </tr> <!--CSSENDREPEAT:Product.QuantityBreaks--> <!--CSSREPEAT:Product.QuantityBreaksIncGST--> <tr style="background-color: #CCFFCC"> <td>NON-LIVE IncGST</td> <td>[Product.QuantityBreaksIncGST.BreakRange]</td> <td>$ [Product.QuantityBreaksIncGST.Price]</td> <td> [Product.QuantityBreaksIncGST.Break]<br /> [Product.QuantityBreaksIncGST.BreakEnd]<br /> $ [Product.QuantityBreaksIncGST.Price]<br /> [Product.QuantityBreaksIncGST.BreakRange]<br /> </td> </tr> <!--CSSENDREPEAT:Product.QuantityBreaksIncGST--> <!--CSSREPEAT:Product.QuantityBreaksExGST--> <tr style="background-color: #CCCCFF"> <td>NON-LIVE ExGST</td> <td>[Product.QuantityBreaksExGST.BreakRange]</td> <td>$ [Product.QuantityBreaksExGST.Price]</td> <td> [Product.QuantityBreaksExGST.Break]<br /> [Product.QuantityBreaksExGST.BreakEnd]<br /> $ [Product.QuantityBreaksExGST.Price]<br /> [Product.QuantityBreaksExGST.BreakRange]<br /> </td> </tr> <!--CSSENDREPEAT:Product.QuantityBreaksExGST--> <!--CSSENDREPEAT:Product--> </table>
Related articles