Get a new price level in Item model – SCA

Jira Code: VG-21

Get a new price level named Sale price in the item model.

Javascript

Item.KeyMapping.js: Add the following code to this file.

		   _salePrice: function (item)
			{
				  var saleprice = item.get('pricelevel13');
				 
				  return saleprice;		
			}

			// @property {String} _comparePriceAgainstFormated This method a formatted version of the method _comparePriceAgainst
		,   _salePrice_formatted: function (item)
			{
				 var saleprice = item.get('pricelevel13_formatted');
				
				if (saleprice)
				{
					if (saleprice.priceschedule)
					{
						return item.get('pricelevel13_formatted');
					}
					else
					{
						return item.get('pricelevel13_formatted');
					}
				}
				else
				{
					return item.get('pricelevel13_formatted');
				}
			}

Item.Model.js : Add the following code to the getPrice method.
if (this.get('_salePrice'))
				{
					//@class ItemPrice
					//@property {Number} compare_price
					result.sale_price = this.get('_salePrice');
					//@property {String} compare_price_formatted
					result.sale_price_formatted = this.get('_salePrice_formatted');
					//@class Item.Model
				}


Leave a comment

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