/**
* Price increment/discount by groups, categories and prices
*
* NOTICE OF LICENSE
*
* This product is licensed for one customer to use on one installation (test stores and multishop included).
* Site developer has the right to modify this module to suit their needs, but can not redistribute the module in
* whole or in part. Any other use of this module constitues a violation of the user agreement.
*
* DISCLAIMER
*
* NO WARRANTIES OF DATA SAFETY OR MODULE SECURITY
* ARE EXPRESSED OR IMPLIED. USE THIS MODULE IN ACCORDANCE
* WITH YOUR MERCHANT AGREEMENT, KNOWING THAT VIOLATIONS OF
* PCI COMPLIANCY OR A DATA BREACH CAN COST THOUSANDS OF DOLLARS
* IN FINES AND DAMAGE A STORES REPUTATION. USE AT YOUR OWN RISK.
*
*  @author    idnovate.com <info@idnovate.com>
*  @copyright 2016 idnovate.com
*  @license   See above
*/

if (typeof updatePrice !== "undefined") {
	updatePrice = (function() {
	    var updatePriceCached = updatePrice;

	    return function(json) {
	        updatePriceCached.apply(this, arguments);
			if (combinationsFromController[$('#idCombination').val()] != undefined && combinationsFromController[$('#idCombination').val()]['price_rounded'] != undefined) {
				price_modified = combinationsFromController[$('#idCombination').val()]['price_rounded'];
				$('#our_price_display').text(formatCurrency(price_modified, currencyFormat, currencySign, currencyBlank));
			}

			if (combinationsFromController[$('#idCombination').val()] != undefined && combinationsFromController[$('#idCombination').val()]['old_price_rounded'] != undefined) {
				old_price = combinationsFromController[$('#idCombination').val()]['old_price_rounded'];
				$('#old_price_display span.price').text(formatCurrency(old_price, currencyFormat, currencySign, currencyBlank));
			}
		}
	})();
} else {
	updateDisplay = (function() {
	    var updateDisplayCached = updateDisplay;

	    return function(json) {
	        updateDisplayCached.apply(this, arguments);
			if (combinationsFromController[$('#idCombination').val()] != undefined && combinationsFromController[$('#idCombination').val()]['price_rounded'] != undefined) {
				price_modified = combinationsFromController[$('#idCombination').val()]['price_rounded'];
				$('#our_price_display').text(formatCurrency(price_modified, currencyFormat, currencySign, currencyBlank));
			}

			if (combinationsFromController[$('#idCombination').val()] != undefined && combinationsFromController[$('#idCombination').val()]['old_price_rounded'] != undefined) {
				old_price = combinationsFromController[$('#idCombination').val()]['old_price_rounded'];
				$('#old_price_display span.price').text(formatCurrency(old_price, currencyFormat, currencySign, currencyBlank));
			}
		}
	})();
}