How to design “best seller” badge for items

1.first create the item

2.Than add item to the field set

3. than go to specified item and add display name there

4. create the extension and add the below code

5.In the tpl file where badge is displaying add this <<span>>{{badge}}</span>

_.extend(CartLinesView.prototype, { getContext: _.wrap(CartLinesView.prototype.getContext, function(fn) { try{                console.log(‘this’, this) var original = fn.apply(this,_.toArray(arguments).slice(1)); var badge=this.model.attributes.item.attributes.custitemcartitembadge1; original.badge = badge; console.log(badge) }catch(e) { console.log(“err@barcode2View”,e); } return original })

Leave a comment

Your email address will not be published. Required fields are marked *