View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


How to show identifier instead of name for Discounts in WebPOS Order Lines


This How To shows how can be used a discounts identifier instead o name in order lines.

In this example we want to show discounts name + discount percentage instead of only name for manual discounts. For this purpose, we will create an identifier which will contain "name + percent value".

Add Identifier to Discount

First we will create a function to get the identifier for chosen discount:

OB.Model.Discounts.discountRules['20E4EC27397344309A2185097392D964'] = {
  addManual: function (receipt, line, promotion) {
    addPercentage(receipt, line, promotion);
  getIdentifier: function (rule, discount) {
    return ( || rule.get('printName') || rule.get('name')) + ' - ' + discount.percentage + ' %';

Set Identifier

Once we've created the function, it result will be assigned to the identifier. Before this how to, the identifier value didn't exist for discounts, so we can use it safely. The next code is implemented in "addPromotion" function to assign identifier value:

if (discountRule.getIdentifier) {
  disc.identifier = discountRule.getIdentifier(rule, discount);
} else {
  disc.identifier = || rule.get('printName') || rule.get('name');

And finally, for the "OB.UI.RenderOrderLineDiscount" component the content assign command will be changed from

this.$.discountName.setContent('-- ' +;


this.$.discountName.setContent('-- ' +;

Retrieved from ""

This page has been accessed 394 times. This page was last modified on 13 November 2015, at 12:10. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.