<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id>OpenAuction Pro - 20140221</id>
	<version>1.5.6.1</version>
	<vqmver>2.4.1</vqmver>
	<author>www.opencartcooladdons.com</author>

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT! PLEASE READ THE BELOW! -->
<!-- IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT! PLEASE READ THE BELOW! -->
<!-- IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT!! PLEASE READ THE BELOW BEFORE PROCEEDING FURTHER! IMPORTANT! PLEASE READ THE BELOW! -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- 1. You have paid for and fully understood the intended usage of the software for "OpenCart", functioning as an "Auction" utility without any hidden malware -->
<!-- 2. You have agreed that by using the "OpenAuction Pro", "The Developer" shall not be held responsible for any damages; loss of data or loss of assets/jobs -->
<!-- 3. You have agreed that by amending the XML core file or any of its packaged content, the license; support; maintenance and warranty deem completely voided -->
<!-- 4. "The Developer", "Licensor", or "www.opencartcooladdons.com", reserves the right to provide limited support to its "Licensees" on 30-day warranty period -->
<!-- 5. "The Developer", "Licensor", or "www.opencartcooladdons.com", reserves the right to negate any refund request on voided/after warranty, or lack of proof -->
<!-- 6. "The Developer", "Licensor", or "www.opencartcooladdons.com", reserves the right to modify its price, licensing, or package content without prior notice -->
<!-- 7. "OpenAuction Pro" is owned by "www.opencartcooladdons.com", copy; reproduction or distribution of its content constitutes to copyright and legal breach -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<file name="admin/language/english/english.php">
		<operation error="log" info="New Auction texts for Date and Time formatting">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_day']                = 'd';
			$_['text_hour']               = 'h';
			$_['text_minute']             = 'm';
			$_['text_second']             = 's';
			$_['text_ok']                 = 'OK';
			]]></add>
		</operation>

		<operation error="log" info="New Auction tabs in Catalog Product form and Sales Auction form">
			<search position="after"><![CDATA[
			// Tab
			]]></search>
			<add><![CDATA[
			$_['tab_auction']             = 'Auction';
			$_['tab_auction_detail']      = 'Auction Details';
			$_['tab_auction_setting']     = 'Auction Settings';
			$_['tab_bid_history']         = 'Bid History';
			$_['tab_similar_auction']     = 'Similar Auctions';
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/catalog/product.php">
		<operation error="log" info="New Auction texts in Catalog Product listing and form">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction']              = 'Auction';
			$_['text_auction_no_active']    = 'No active auctions';
			$_['text_auction_notes']        = '<span class="help">&nbsp;&nbsp;&nbsp;<img src="view/image/information.png" height="16" width="16" alt="Note" title="Note" />&nbsp;Option selection is not applicable in Auctions, please write in the Product Description instead e.g. color, size, etc.</span><br />';
			$_['text_auction_add_label']    = 'Auction This Product';
			$_['text_auction_del_label']    = 'Delete This Auction';
			$_['text_auction_new_auction']  = 'New Auction';
			$_['text_auction_getstarted']   = 'Getting started...';
			$_['text_auction_goinggoing']   = 'Going... Going...';
			$_['text_auction_bid']          = 'bid';
			$_['text_auction_bids']         = 'bids';
			$_['text_auction_starting_in']  = 'Starting in';
			$_['text_auction_left']         = 'left';
			]]></add>
		</operation>

		<operation error="log" info="New Auction column in Catalog Product listing">
			<search position="after"><![CDATA[
			// Column
			]]></search>
			<add><![CDATA[
			$_['column_auctions']           = 'Auction(s)';
			]]></add>
		</operation>

		<operation error="log" info="New Auction entries in Catalog Product form">
			<search position="after"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			$_['entry_auction_name']        = '<span class="required">*</span> Auction:<br /><span class="help">Give it a name!</span>';
			$_['entry_auction_quantity']    = '<span class="required">*</span> Reserved Quantity:<br /><span class="help">Quantity auto-deducts from Data > Quantity (if Subtract = Yes)</span>';
			$_['entry_auction_starting']    = '<span class="required">*</span> Start Date/Time:<br /><span class="help">Auction becomes available for bidding from this time onwards</span>';
			$_['entry_auction_ending']      = '<span class="required">*</span> End Date/Time:<br /><span class="help">Original end time</span>';
			$_['entry_auction_startprice']  = '<span class="required">*</span> Starting Price:<br /><span class="help">Base price on the total reserved quantity</span>';
			$_['entry_auction_resrvprice']  = 'Reserve Price:<br /><span class="help">Minimum acceptable amount to be considered as won</span>';
			$_['entry_auction_buyprice']    = 'Buyout Price:<br /><span class="help">Immediate sale price if this amount is reached</span>';
			$_['entry_auction_mincrement']  = '<span class="required">*</span> Minimum Increment per Bid:<br /><span class="help">Minimum increment from the last highest bid</span>';
			$_['entry_auction_autobid']     = '(<b>Pro only</b>) Allow Auto-Bidding:<br /><span class="help">Allow customers to set auto-bidding on with a limit while away from keyboard, works very well with Auto-Extension</span>';
			]]></add>
		</operation>

		<operation error="log" info="New Auction validation error messages">
			<search position="after"><![CDATA[
			// Error
			]]></search>
			<add><![CDATA[
			$_['error_product_deletefail']  = '<span class="error">Cannot delete product: Product is attached to %s auction(s) with live bids!</span>';
			$_['error_auction_prod_enable'] = '<span class="error">&nbsp;&nbsp;&nbsp;&nbsp;<img src="view/image/error.png" height="16" width="16" alt="Error" title="Error" />&nbsp;Unable to save Auction(s): Data > Status is not enabled!</span><br />';
			$_['error_auction_stock_minus'] = '<span class="error">&nbsp;&nbsp;&nbsp;&nbsp;<img src="view/image/error.png" height="16" width="16" alt="Error" title="Error" />&nbsp;Unable to save Auction(s): Data > Quantity must not be negative!</span><br />';
			$_['error_auction_deletefail']  = '<span class="error">&nbsp;&nbsp;&nbsp;&nbsp;<img src="view/image/error.png" height="16" width="16" alt="Error" title="Error" />&nbsp;Unable to delete Auction: Auction has already started!</span><br />';
			$_['error_auction_updatefail']  = '<span class="error">&nbsp;&nbsp;&nbsp;&nbsp;<img src="view/image/error.png" height="16" width="16" alt="Error" title="Error" />&nbsp;Unable to update Auction: Auction has already started!</span><br />';
			$_['error_auction_name']        = '<span class="error">Auction Name must be greater than %s and lesser than %s characters!</span>';
			$_['error_auction_quantity']    = '<span class="error">Reserved Quantity must be more than zero!</span>';
			$_['error_auction_starting']    = '<span class="error">Start Date/Time must be a valid date/time and not earlier than now or later than %s to %s hour(s)!</span>';
			$_['error_auction_ending']      = '<span class="error">End Date/Time must be a valid date/time and between %s and %s hour(s) later than the Start Date/Time!</span>';
			$_['error_auction_startprice']  = '<span class="error">Starting Price must be more than zero and not more than %s!</span>';
			$_['error_auction_rsrvprice']   = '<span class="error">Reserve Price must not be lesser than the Starting Price and not more than %s!</span>';
			$_['error_auction_buyprice']    = '<span class="error">Buyout Price must not be lesser than the Starting Price or Reserve Price and not more than %s!</span>';
			$_['error_auction_mincrement']  = '<span class="error">Minimum Increment per Bid must be more than zero and not more than %s!</span>';
			$_['modal_auction_confirm']     = 'Confirmation';
			$_['modal_auction_warning']     = 'Warning';
			$_['modal_auction_add_confirm'] = 'Creating an auction will temporarily disable normal sales on the product until this auction is over! (stacks with other Auctions)<br /><br /><span style="color: #0000FF; font-weight: bold;">Confirm proceed with auction creation?</span>';
			$_['modal_auction_del_confirm'] = 'Auction is starting soon! <span style="color: #FF0000; font-weight: bold;">Are you sure you want to delete it?</span>';
			$_['modal_auction_add_prd_chk'] = 'Cannot create new auction: Product is not enabled!<br /><br />Product status = /%s/ (must be enabled!)<br /><br /><span style="color: #FF0000; font-weight: bold;">Check Data > Status</span>';
			$_['modal_auction_add_stk_chk'] = 'Cannot create new auction: Product is out of stock!<br /><br />Product stock = /%s/ (minimum 1 required!)<br /><br /><span style="color: #FF0000; font-weight: bold;">Check Data > Quantity</span>';
			$_['modal_auction_chstock_chk'] = 'Product stock is not sufficient! Lower reserved quantity or<br /><br /><span style="color: #FF0000; font-weight: bold;">Check Data > Quantity</span><br /><br /><span style="color: #0000FF; font-weight: bold;">Reverting to previous reserved quantity...</span>';
			$_['modal_auction_chstock_min'] = 'Reserved quantity cannot be lesser than 1!<br /><br /><span style="color: #0000FF; font-weight: bold;">Reverting to previous reserved quantity...</span>';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/catalog/product_list.tpl">
		<operation error="log" info="Add new Auction column in Catalog Product listing">
			<search position="before"><![CDATA[
			<td class="left"><?php if ($sort == 'p.price') { ?>
			]]></search>
			<add><![CDATA[
			<td class="left"><?php if ($sort == 'total_auctions') { ?>
			  <a href="<?php echo $sort_total_auctions; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_auctions; ?></a>
			  <?php } else { ?>
			  <a href="<?php echo $sort_total_auctions; ?>"><?php echo $column_auctions; ?></a>
			  <?php } ?>
			</td>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction filter input in Catalog Product listing">
			<search position="before"><![CDATA[
			<td align="left"><input type="text" name="filter_price" value="<?php echo $filter_price; ?>" size="8"/></td>
			]]></search>
			<add><![CDATA[
			<td><input type="text" name="filter_auction_name" value="<?php echo $filter_auction_name; ?>" /></td>
			]]></add>
		</operation>

		<operation error="log" info="Display new Auction records per Product in Catalog Product listing">
			<search position="before"><![CDATA[
			<td class="left"><?php if ($product['special']) { ?>
			]]></search>
			<add><![CDATA[
			<td class="left" width="30%">
				<?php if ($product['auctions']) { ?>
				<?php $auction_rows = count($product['auctions']); ?>
				<?php foreach ($product['auctions'] as $auction_row => $auction) { ?>
				<div id="list-auction-<?php echo $product['product_id']; ?>-<?php echo $auction_row; ?>" title="<?php echo $auction['auction_name']; ?>" style="overflow-x: hidden; overflow-y: hidden;<?php if ($auction_row) { echo ' display: none;'; } ?>">
					<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
						<td width="12%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">
						  <?php echo $auction_row + 1 . ' of ' . $auction_rows . '.'; ?>
						</td>
						<td width="43%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">
						  <?php echo $auction['auction_name']; ?>
						</td>
						<td width="12%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">
						  <?php echo '&times; ' . $auction['reserved_quantity']; ?>
						</td>
						<td width="33%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">
						  <span id="live-auction-<?php echo $product['product_id']; ?>-<?php echo $auction_row; ?>" style="color: #B00000; font-weight: normal;"></span>
						</td>
					</tr></table>
				</div>
				<?php } ?>
				<?php } else { ?>
				<?php echo $text_auction_no_active; ?>
				<?php } ?>
				<?php if (isset($error_product_deletefail[$product['product_id']])) { ?><?php echo $error_product_deletefail[$product['product_id']]; ?><?php } ?>
			</td>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction filter javascript in Catalog Product listing">
			<search position="before"><![CDATA[
			var filter_price = $('input[name=\'filter_price\']').attr('value');
			]]></search>
			<add><![CDATA[
			var filter_auction_name = $('input[name=\'filter_auction_name\']').attr('value');
			if (filter_auction_name) {
				url += '&filter_auction_name=' + encodeURIComponent(filter_auction_name);
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction auto-complete javascript in Catalog Product listing">
			<search position="before"><![CDATA[
			$('input[name=\'filter_name\']').autocomplete({
			]]></search>
			<add><![CDATA[
			$('input[name=\'filter_auction_name\']').autocomplete({
				delay: 0,
				source: function(request, response) {
					$.ajax({
						url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_auction_name=' +  encodeURIComponent(request.term),
						dataType: 'json',
						success: function(json) {		
							response($.map(json, function(item) {
								return {
									label: item.auction_name,
									value: item.product_id
								}
							}));
						}
					});
				}, 
				select: function(event, ui) {
					$('input[name=\'filter_auction_name\']').val(ui.item.label);
					return false;
				},
				focus: function(event, ui) {
					return false;
				}
			});
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction action triggers javascript in Catalog Product listing">
			<search position="before"><![CDATA[
			<?php echo $footer; ?>
			]]></search>
			<add><![CDATA[
			<script src="view/javascript/sha1.hash.js" type="text/javascript" charset="utf-8"></script>
			<script type="text/javascript"><!--
			var statusAuctionStarting   = parseInt(<?php echo $auction_status_ids['starting']; ?>);
			var statusAuctionRelisting  = parseInt(<?php echo $auction_status_ids['relisting']; ?>);
			var statusAuctionInProgress = parseInt(<?php echo $auction_status_ids['inprogress']; ?>);
			var statusAuctionExtended   = parseInt(<?php echo $auction_status_ids['extended']; ?>);
			var statusAuctionWon        = parseInt(<?php echo $auction_status_ids['won']; ?>);
			var statusAuctionExpired    = parseInt(<?php echo $auction_status_ids['expired']; ?>);
			var statusAuctionSold       = parseInt(<?php echo $auction_status_ids['sold']; ?>);
			var statusAuctionVoided     = parseInt(<?php echo $auction_status_ids['voided']; ?>);
			var textAuctionDay          = '<?php echo $text_day; ?>';
			var textAuctionHour         = '<?php echo $text_hour; ?>';
			var textAuctionMinute       = '<?php echo $text_minute; ?>';
			var textAuctionSecond       = '<?php echo $text_second; ?>';
			var textAuctionStarting     = '<?php echo $text_auction_statuses['starting']; ?>';
			var textAuctionRelisting    = '<?php echo $text_auction_statuses['relisting']; ?>';
			var textAuctionInProgress   = '<?php echo $text_auction_statuses['inprogress']; ?>';
			var textAuctionExtended     = '<?php echo $text_auction_statuses['extended']; ?>';
			var textAuctionWon          = '<?php echo $text_auction_statuses['won']; ?>';
			var textAuctionExpired      = '<?php echo $text_auction_statuses['expired']; ?>';
			var textAuctionSold         = '<?php echo $text_auction_statuses['sold']; ?>';
			var textAuctionVoided       = '<?php echo $text_auction_statuses['voided']; ?>';
			var textAuctionGetStarted   = '<?php echo $text_auction_getstarted; ?>';
			var textAuctionGoingGoing   = '<?php echo $text_auction_goinggoing; ?>';
			var textAuctionBid          = '<?php echo $text_auction_bid; ?>';
			var textAuctionBids         = '<?php echo $text_auction_bids; ?>';
			var textAuctionStartingIn   = '<?php echo $text_auction_starting_in; ?>';
			var textAuctionLeft         = '<?php echo $text_auction_left; ?>';
			var serverTimeNow           = parseInt(<?php echo time(); ?>);
			var clientTimeNow           = parseInt(Math.floor(new Date().getTime() / 1000));
			var serverClientTimeDiff    = parseInt(serverTimeNow - clientTimeNow);
			var lastPollingTime         = parseInt(clientTimeNow + serverClientTimeDiff);
			var countDownTimer          = new Array();
			var lastSetInterval         = new Array();
			var pollAuctionData         = new Array();
			var defaultPollingInterval  = 1000;
			var defaultPollingTimeout   = 300000;
			var defaultDailyInterval    = 900000;
			var defaultHourlyInterval   = 60000;
			var defaultMinuteInterval   = 5000;
			var defaultIntervalTime     = 1000;
			var defaultRecallTime       = 500;
			var defaultAnimationTime    = 1000;
			var defaultAnimationFast    = 500;
			var defaultCountDownTime    = 15;
			var defaultCountDownFast    = 3;
			var defaultRowCyclingTime   = 3000;
			function countDownTimeBreaker(no_of_seconds) {
				var time_remaining = '';
				var time_remaining_d = 0;
				var time_remaining_h = 0;
				var time_remaining_m = 0;
				var time_remaining_s = 0;
				if (no_of_seconds > 86400) {
					time_remaining_d = Math.floor(no_of_seconds / 60 / 60 / 24);
					time_remaining_h = Math.floor(no_of_seconds / 60 / 60) - (time_remaining_d * 24);
					if (time_remaining_h > 0) {
						time_remaining = '' + time_remaining_d + textAuctionDay + ' ' + time_remaining_h + textAuctionHour;
					} else {
						time_remaining = '' + time_remaining_d + textAuctionDay;
					}
					return time_remaining;
				} else if (no_of_seconds > 3600) {
					time_remaining_h = Math.floor(no_of_seconds / 60 / 60);
					time_remaining_m = Math.floor(no_of_seconds / 60) - (time_remaining_h * 60);
					if (time_remaining_m > 0) {
						time_remaining = '' + time_remaining_h + textAuctionHour + ' ' + time_remaining_m + textAuctionMinute;
					} else {
						time_remaining = '' + time_remaining_h + textAuctionHour;
					}
					return time_remaining;
				} else if (no_of_seconds > 60) {
					time_remaining_m = Math.floor(no_of_seconds / 60);
					time_remaining_s = Math.floor(no_of_seconds) - (time_remaining_m * 60);
					if (time_remaining_s > 0) {
						time_remaining = '' + time_remaining_m + textAuctionMinute + ' ' + time_remaining_s + textAuctionSecond;
					} else {
						time_remaining = '' + time_remaining_m + textAuctionMinute;
					}
					return time_remaining;
				} else {
					time_remaining = '' + no_of_seconds + textAuctionSecond;
					return time_remaining;
				}
			}
			function countDownTimeInterval(no_of_seconds) {
				if (no_of_seconds > 86400) {
					return defaultDailyInterval;
				} else if (no_of_seconds > 3600) {
					return defaultHourlyInterval;
				} else if (no_of_seconds > 600) {
					return defaultMinuteInterval;
				} else {
					return defaultIntervalTime;
				}
			}
			function cycleAuctionList(product_id, auction_row, total_rows) {
				var next_auction_row = auction_row + 1;
				if (next_auction_row > total_rows) {
					next_auction_row = 0;
				}
				$('#list-auction-' + product_id + '-' + auction_row).fadeOut();
				$('#list-auction-' + product_id + '-' + next_auction_row).fadeIn();
				setTimeout(function(){cycleAuctionList(product_id, next_auction_row, total_rows)}, defaultRowCyclingTime);
			}
			function clearCountDownTimer(product_id, auction_row) {
				clearInterval(countDownTimer[product_id][auction_row]);
				countDownTimer[product_id][auction_row] = null;
				lastSetInterval[product_id][auction_row] = null;
			}
			function countDownAuction(recall, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id) {
				var script_time_to_use = parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff);
				var is_active_auction = 0;
				var interval_countdown = 0;
				var display_countdown = '';
				var time_difference = 0;
				if (recall) {
					// void current timer immediately to prevent function overlap with recall
					clearCountDownTimer(product_id, auction_row);
					// do an almost-immediate function recall for latest display updates
					countDownTimer[product_id][auction_row] = setInterval(function(){countDownAuction(0, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id)}, defaultRecallTime);
					lastSetInterval[product_id][auction_row] = defaultRecallTime;
				} else {
					if (auction_status_id == statusAuctionVoided) {
						display_countdown = textAuctionVoided;
					} else if (auction_status_id == statusAuctionSold) {
						display_countdown = textAuctionSold;
					} else if (auction_status_id == statusAuctionExpired) {
						display_countdown = textAuctionExpired;
					} else if (auction_status_id == statusAuctionWon) {
						display_countdown = textAuctionWon;
					} else if (auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended) {
						time_difference = parseInt(real_ending_time - script_time_to_use);
						if (time_difference > 0) {
							display_countdown = countDownTimeBreaker(time_difference) + ' ' + textAuctionLeft + ' [' + total_no_of_bid + ' ' + (total_no_of_bid > 1 ? textAuctionBids : textAuctionBid) + ']';
						} else {
							display_countdown = textAuctionGoingGoing;
						}
						is_active_auction++;
					} else if (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting) {
						time_difference = parseInt(starting_time - script_time_to_use);
						if (time_difference > 0) {
							display_countdown = textAuctionStartingIn + ' ' + countDownTimeBreaker(time_difference);
						} else {
							display_countdown = textAuctionGetStarted;
						}
						is_active_auction++;
					}
					$('#live-auction-' + product_id + '-' + auction_row).html(display_countdown);
					if (is_active_auction) {
						if (time_difference <= defaultCountDownFast && time_difference >= 0 && (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting || auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended)) {
							$('#live-auction-' + product_id + '-' + auction_row).stop(true, true).queue(function(){$(this).effect('pulsate', {times: 2}, defaultAnimationFast); $(this).dequeue();});
						} else if (time_difference <= defaultCountDownTime && time_difference >= 0 && (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting || auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended)) {
							$('#live-auction-' + product_id + '-' + auction_row).stop(true, true).queue(function(){$(this).effect('pulsate', {times: 1}, defaultAnimationTime); $(this).dequeue();});
						} else {
							$('#live-auction-' + product_id + '-' + auction_row).stop(true, true);
						}
						// helps resetting timer to normal state after a function recall
						interval_countdown = parseInt(countDownTimeInterval(time_difference));
						if (lastSetInterval[product_id][auction_row] != interval_countdown) {
							clearCountDownTimer(product_id, auction_row);
							countDownTimer[product_id][auction_row] = setInterval(function(){countDownAuction(0, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id)}, interval_countdown);
							lastSetInterval[product_id][auction_row] = interval_countdown;
						}
					} else {
						$('#live-auction-' + product_id + '-' + auction_row).stop(true, true);
						clearCountDownTimer(product_id, auction_row);
					}
				}
			}
			function pollAuctionGlobal(auction_ids) {
				var auth = encodeURIComponent(Sha1.hash(String(parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff))));
				var curl = '../index.php?route=product/auction/auctionglobalpoll&auth=' + auth + '&auction_ids=' + auction_ids + '&last_polled=' + lastPollingTime + '&admin=1';
				lastPollingTime = parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff);
				$.ajax({
					url: curl,
					dataType: 'json',
					cache: false,
					success: function(auctions) {
						if (auctions instanceof Array && auctions.length > 0) {
							for (var auction_record = 0; auction_record < auctions.length; auction_record++) {
								var auction_id = parseInt(auctions[auction_record].auction_id);
								var total_no_of_bid = parseInt(auctions[auction_record].total_no_of_bid);
								var real_ending_time = parseInt(auctions[auction_record].real_ending_time);
								var auction_status_id = parseInt(auctions[auction_record].auction_status_id);
								if (auction_id) {
									var product_id = parseInt(pollAuctionData[auction_id].product_id);
									var auction_row = parseInt(pollAuctionData[auction_id].auction_row);
									var starting_time = parseInt(pollAuctionData[auction_id].starting_time);
									countDownAuction(1, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id);
								}
							}
						}
					}
				});
			}
			<?php foreach ($products as $product) { ?>
			<?php if ($product['auctions']) { ?>
			countDownTimer[<?php echo $product['product_id']; ?>] = new Array();
			lastSetInterval[<?php echo $product['product_id']; ?>] = new Array();
			<?php foreach ($product['auctions'] as $auction_row => $auction) { ?>
			countDownTimer[<?php echo $product['product_id']; ?>][<?php echo $auction_row; ?>] = setInterval(function(){countDownAuction(0, <?php echo $product['product_id']; ?>, <?php echo $auction_row; ?>, <?php echo $auction['starting_time']; ?>, <?php echo $auction['total_no_of_bid']; ?>, <?php echo $auction['real_ending_time']; ?>, <?php echo $auction['auction_status_id']; ?>)}, defaultIntervalTime);
			lastSetInterval[<?php echo $product['product_id']; ?>][<?php echo $auction_row; ?>] = defaultIntervalTime;
			pollAuctionData[<?php echo $auction['auction_id']; ?>] = {product_id: <?php echo $product['product_id']; ?>, auction_row: <?php echo $auction_row; ?>, starting_time: <?php echo $auction['starting_time']; ?>};
			<?php } ?>
			<?php if ($auction_row) { ?>
			setTimeout(function(){cycleAuctionList(<?php echo $product['product_id']; ?>, 0, <?php echo $auction_row; ?>)}, defaultRowCyclingTime);
			<?php } ?>
			<?php } ?>
			<?php } ?>
			<?php if ($auction_ids) { ?>
			setInterval(function(){pollAuctionGlobal('<?php echo implode(',', $auction_ids); ?>')}, defaultPollingInterval);
			setTimeout(function(){location.reload(true)}, defaultPollingTimeout);
			<?php } ?>
			//--></script>
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/catalog/product_form.tpl">
		<operation error="log" info="Add new Auction form in Catalog Product form">
			<search position="before"><![CDATA[
			</form>
			]]></search>
			<add><![CDATA[
			<div id="tab-auction">
			  <div id="vtab-auction" class="vtabs">
				<span id="auction-add"><?php echo $text_auction_add_label; ?>&nbsp;<img src="view/image/add.png" alt="<?php echo $text_auction_add_label; ?>" title="<?php echo $text_auction_add_label; ?>" onclick="addAuctionConfirm();" /></span>
				<?php $auction_row = 0; ?>
				<?php foreach ($product_auctions as $product_auction) { ?>
				<a href="#tab-auction-<?php echo $product_auction['auction_row']; ?>" id="auction-<?php echo $product_auction['auction_row']; ?>" style="<?php if ($error_auction_array && isset($error_auction_array[$product_auction['auction_row']])) { ?>color: #FF0000;<?php } ?><?php if ($product_auction['auction_id']) { ?> font-weight: normal;<?php } ?>"></a>
				<?php } ?>
			  </div>
			  <div id="dialog-auction" style="display: none;"></div>
			  <?php echo $text_auction_notes; ?>
			  <?php if ($error_auction_prod_enable) { ?><?php echo $error_auction_prod_enable; ?><?php } ?>
			  <?php if ($error_auction_stock_minus) { ?><?php echo $error_auction_stock_minus; ?><?php } ?>
			  <?php foreach ($product_auctions as $product_auction) { ?>
			  <?php $auction_row = $product_auction['auction_row']; ?>
			  <div id="tab-auction-<?php echo $auction_row; ?>" class="vtabs-content">
				<?php if (isset($error_auction_deletefail[$auction_row])) { ?><?php echo $error_auction_deletefail[$auction_row]; ?><?php } ?>
				<?php if (isset($error_auction_updatefail[$auction_row])) { ?><?php echo $error_auction_updatefail[$auction_row]; ?><?php } ?>
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][auction_row]" value="<?php echo $auction_row; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][product_auction_id]" value="<?php echo $product_auction['product_auction_id']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][auction_id]" value="<?php echo $product_auction['auction_id']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][auction_status_id]" value="<?php echo $product_auction['auction_status_id']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][total_no_of_bid]" value="<?php echo $product_auction['total_no_of_bid']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<input type="hidden" name="product_auction[<?php echo $auction_row; ?>][real_ending_time]" value="<?php echo $product_auction['real_ending_time']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
				<table class="form">
				  <tr>
					<td><?php echo $entry_auction_name; ?></td>
					<td><?php foreach ($languages as $language) { ?><input type="text" name="product_auction[<?php echo $auction_row; ?>][auction_name][<?php echo $language['language_id']; ?>]" size="50" maxlength="64" value="<?php echo isset($product_auction['auction_name'][$language['language_id']]) ? $product_auction['auction_name'][$language['language_id']] : ''; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />&nbsp;<img src="view/image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" title="<?php echo $language['name']; ?>" /><?php if (isset($error_auction_name[$auction_row][$language['language_id']])) { ?><?php echo $error_auction_name[$auction_row][$language['language_id']]; ?><?php } ?><br /><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_quantity; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][reserved_quantity]" size="2" maxlength="4" value="<?php echo $product_auction['reserved_quantity']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> onfocus="trackAuctionRsvQty(this.value);" onchange="changeAuctionRsvQty(this, this.value);" /><?php if (isset($error_auction_quantity[$auction_row])) { ?><?php echo $error_auction_quantity[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_starting; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][starting_time]" maxlength="16" value="<?php echo $product_auction['starting_time']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> class="datetime" /><?php if (isset($error_auction_starting[$auction_row])) { ?><?php echo $error_auction_starting[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_ending; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][ending_time]" maxlength="16" value="<?php echo $product_auction['ending_time']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> class="datetime" /><?php if (isset($error_auction_ending[$auction_row])) { ?><?php echo $error_auction_ending[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_startprice; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][starting_price]" maxlength="20" value="<?php echo $product_auction['starting_price']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> /><?php if (isset($error_auction_startprice[$auction_row])) { ?><?php echo $error_auction_startprice[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_resrvprice; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][reserve_price]" maxlength="20" value="<?php echo $product_auction['reserve_price']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> /><?php if (isset($error_auction_rsrvprice[$auction_row])) { ?><?php echo $error_auction_rsrvprice[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_buyprice; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][buyout_price]" maxlength="20" value="<?php echo $product_auction['buyout_price']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> /><?php if (isset($error_auction_buyprice[$auction_row])) { ?><?php echo $error_auction_buyprice[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <tr>
					<td><?php echo $entry_auction_mincrement; ?></td>
					<td><input type="text" name="product_auction[<?php echo $auction_row; ?>][min_increment]" maxlength="5" value="<?php echo $product_auction['min_increment']; ?>"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> /><?php if (isset($error_auction_mincrement[$auction_row])) { ?><?php echo $error_auction_mincrement[$auction_row]; ?><?php } ?></td>
				  </tr>
				  <?php if ($auto_bidding || $product_auction['allow_auto_bid']) { ?>
				  <tr>
					<td><?php echo $entry_auction_autobid; ?></td>
					<td><?php if ($product_auction['allow_auto_bid']) { ?>
					<input type="radio" name="product_auction[<?php echo $auction_row; ?>][allow_auto_bid]" value="1" checked="checked"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
					<?php echo $text_yes; ?>
					<input type="radio" name="product_auction[<?php echo $auction_row; ?>][allow_auto_bid]" value="0"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="product_auction[<?php echo $auction_row; ?>][allow_auto_bid]" value="1"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
					<?php echo $text_yes; ?>
					<input type="radio" name="product_auction[<?php echo $auction_row; ?>][allow_auto_bid]" value="0" checked="checked"<?php echo isset($product_auction['auction_disabled']) ? $product_auction['auction_disabled'] : ''; ?> />
					<?php echo $text_no; ?>
					<?php } ?>
					</td>
				  </tr>
				  <?php } ?>
				</table>
			  </div>
			  <?php $auction_row++; ?>
			  <?php } ?>
			</div>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction tab in Catalog Product form">
			<search position="before" index="1"><![CDATA[
			$('#tabs a').tabs();
			]]></search>
			<add><![CDATA[
			$('#tabs').append('<a href="#tab-auction" id="auction"><?php echo $tab_auction; ?></a>');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction button and action triggers javascript in Catalog Product form">
			<search position="before"><![CDATA[
			<?php echo $footer; ?>
			]]></search>
			<add><![CDATA[
			<script src="view/javascript/sha1.hash.js" type="text/javascript" charset="utf-8"></script>
			<script type="text/javascript"><!--
			var auctionRow              = parseInt(<?php echo count($product_auctions); ?>);
			var statusAuctionStarting   = parseInt(<?php echo $auction_status_ids['starting']; ?>);
			var statusAuctionRelisting  = parseInt(<?php echo $auction_status_ids['relisting']; ?>);
			var statusAuctionInProgress = parseInt(<?php echo $auction_status_ids['inprogress']; ?>);
			var statusAuctionExtended   = parseInt(<?php echo $auction_status_ids['extended']; ?>);
			var statusAuctionWon        = parseInt(<?php echo $auction_status_ids['won']; ?>);
			var statusAuctionExpired    = parseInt(<?php echo $auction_status_ids['expired']; ?>);
			var statusAuctionSold       = parseInt(<?php echo $auction_status_ids['sold']; ?>);
			var statusAuctionVoided     = parseInt(<?php echo $auction_status_ids['voided']; ?>);
			var textAuctionDay          = '<?php echo $text_day; ?>';
			var textAuctionHour         = '<?php echo $text_hour; ?>';
			var textAuctionMinute       = '<?php echo $text_minute; ?>';
			var textAuctionSecond       = '<?php echo $text_second; ?>';
			var textOK                  = '<?php echo $text_ok; ?>';
			var textYes                 = '<?php echo $text_yes; ?>';
			var textNo                  = '<?php echo $text_no; ?>';
			var textEnabled             = '<?php echo $text_enabled; ?>';
			var textDisabled            = '<?php echo $text_disabled; ?>';
			var textAuctionAddLabel     = '<?php echo $text_auction_add_label; ?>';
			var textAuctionDelLabel     = '<?php echo $text_auction_del_label; ?>';
			var textAuctionNewCreated   = '<?php echo $text_auction_new_auction; ?>';
			var textAuctionStarting     = '<?php echo $text_auction_statuses['starting']; ?>';
			var textAuctionRelisting    = '<?php echo $text_auction_statuses['relisting']; ?>';
			var textAuctionInProgress   = '<?php echo $text_auction_statuses['inprogress']; ?>';
			var textAuctionExtended     = '<?php echo $text_auction_statuses['extended']; ?>';
			var textAuctionWon          = '<?php echo $text_auction_statuses['won']; ?>';
			var textAuctionExpired      = '<?php echo $text_auction_statuses['expired']; ?>';
			var textAuctionSold         = '<?php echo $text_auction_statuses['sold']; ?>';
			var textAuctionVoided       = '<?php echo $text_auction_statuses['voided']; ?>';
			var textAuctionGetStarted   = '<?php echo $text_auction_getstarted; ?>';
			var textAuctionGoingGoing   = '<?php echo $text_auction_goinggoing; ?>';
			var textAuctionBid          = '<?php echo $text_auction_bid; ?>';
			var textAuctionBids         = '<?php echo $text_auction_bids; ?>';
			var textAuctionStartingIn   = '<?php echo $text_auction_starting_in; ?>';
			var textAuctionLeft         = '<?php echo $text_auction_left; ?>';
			var modalAuctionConfirm     = '<?php echo $modal_auction_confirm; ?>';
			var modalAuctionWarning     = '<?php echo $modal_auction_warning; ?>';
			var modalAuctionAddConfirm  = '<?php echo $modal_auction_add_confirm; ?>';
			var modalAuctionDelConfirm  = '<?php echo $modal_auction_del_confirm; ?>';
			var modalAuctionAddProdChk  = '<?php echo $modal_auction_add_prd_chk; ?>';
			var modalAuctionAddStokChk  = '<?php echo $modal_auction_add_stk_chk; ?>';
			var modalAuctionChStockChk  = '<?php echo $modal_auction_chstock_chk; ?>';
			var modalAuctionChStockMin  = '<?php echo $modal_auction_chstock_min; ?>';
			var entryAuctionName        = '<?php echo $entry_auction_name; ?>';
			var entryAuctionQuantity    = '<?php echo $entry_auction_quantity; ?>';
			var entryAuctionStarting    = '<?php echo $entry_auction_starting; ?>';
			var entryAuctionEnding      = '<?php echo $entry_auction_ending; ?>';
			var entryAuctionStartPrice  = '<?php echo $entry_auction_startprice; ?>';
			var entryAuctionResrvPrice  = '<?php echo $entry_auction_resrvprice; ?>';
			var entryAuctionBuyPrice    = '<?php echo $entry_auction_buyprice; ?>';
			var entryAuctionMincrement  = '<?php echo $entry_auction_mincrement; ?>';
			var entryAuctionAutoBid     = '<?php echo $entry_auction_autobid; ?>';
			var valueAuctionStarting    = '<?php echo date('Y-m-d H:', (int)(time() + 3600)) . '00'; ?>';
			var valueAuctionEnding      = '<?php echo date('Y-m-d H:', (int)(time() + 3600 + 86400)) . '00'; ?>';
			var buttonAuctionDelete     = '&nbsp;<img src="view/image/delete.png" alt="' + textAuctionDelLabel + '" title="' + textAuctionDelLabel + '" />';
			var buttonAuctionGetStarted = '&nbsp;<img src="view/image/starting.gif" alt="' + textAuctionGetStarted + '" title="' + textAuctionGetStarted + '" />';
			var buttonAuctionGoingGoing = '&nbsp;<img src="view/image/drumming.gif" alt="' + textAuctionGoingGoing + '" title="' + textAuctionGoingGoing + '" />';
			var buttonAuctionInProgress = '&nbsp;<img src="view/image/inprogress.png" alt="' + textAuctionInProgress + '" title="' + textAuctionInProgress + '" />';
			var buttonAuctionWon        = '&nbsp;<img src="view/image/auction.png" alt="' + textAuctionWon + '" title="' + textAuctionWon + '" />';
			var buttonAuctionExpired    = '&nbsp;<img src="view/image/sad.png" alt="' + textAuctionExpired + '" title="' + textAuctionExpired + '" />';
			var buttonAuctionSold       = '&nbsp;<img src="view/image/success.png" alt="' + textAuctionSold + '" title="' + textAuctionSold + '" />';
			var buttonAuctionVoided     = '&nbsp;<img src="view/image/attention.png" alt="' + textAuctionVoided + '" title="' + textAuctionVoided + '" />';
			var serverTimeNow           = parseInt(<?php echo time(); ?>);
			var clientTimeNow           = parseInt(Math.floor(new Date().getTime() / 1000));
			var serverClientTimeDiff    = parseInt(serverTimeNow - clientTimeNow);
			var lastPollingTime         = parseInt(clientTimeNow + serverClientTimeDiff);
			var countDownTimer          = new Array();
			var lastSetInterval         = new Array();
			var pollAuctionData         = new Array();
			var defaultPollingInterval  = 1000;
			var defaultPollingTimeout   = 300000;
			var defaultDailyInterval    = 900000;
			var defaultHourlyInterval   = 60000;
			var defaultMinuteInterval   = 5000;
			var defaultIntervalTime     = 1000;
			var defaultRecallTime       = 500;
			var defaultAnimationTime    = 1000;
			var defaultAnimationFast    = 500;
			var defaultCountDownTime    = 15;
			var defaultCountDownFast    = 3;
			var auctionTrackedQty       = 0;
			countDownTimer[<?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>] = new Array();
			lastSetInterval[<?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>] = new Array();
			function countDownTimeBreaker(no_of_seconds) {
				var time_remaining = '';
				var time_remaining_d = 0;
				var time_remaining_h = 0;
				var time_remaining_m = 0;
				var time_remaining_s = 0;
				if (no_of_seconds > 86400) {
					time_remaining_d = Math.floor(no_of_seconds / 60 / 60 / 24);
					time_remaining_h = Math.floor(no_of_seconds / 60 / 60) - (time_remaining_d * 24);
					if (time_remaining_h > 0) {
						time_remaining = '' + time_remaining_d + textAuctionDay + ' ' + time_remaining_h + textAuctionHour;
					} else {
						time_remaining = '' + time_remaining_d + textAuctionDay;
					}
					return time_remaining;
				} else if (no_of_seconds > 3600) {
					time_remaining_h = Math.floor(no_of_seconds / 60 / 60);
					time_remaining_m = Math.floor(no_of_seconds / 60) - (time_remaining_h * 60);
					if (time_remaining_m > 0) {
						time_remaining = '' + time_remaining_h + textAuctionHour + ' ' + time_remaining_m + textAuctionMinute;
					} else {
						time_remaining = '' + time_remaining_h + textAuctionHour;
					}
					return time_remaining;
				} else if (no_of_seconds > 60) {
					time_remaining_m = Math.floor(no_of_seconds / 60);
					time_remaining_s = Math.floor(no_of_seconds) - (time_remaining_m * 60);
					if (time_remaining_s > 0) {
						time_remaining = '' + time_remaining_m + textAuctionMinute + ' ' + time_remaining_s + textAuctionSecond;
					} else {
						time_remaining = '' + time_remaining_m + textAuctionMinute;
					}
					return time_remaining;
				} else {
					time_remaining = '' + no_of_seconds + textAuctionSecond;
					return time_remaining;
				}
			}
			function countDownTimeInterval(no_of_seconds) {
				if (no_of_seconds > 86400) {
					return defaultDailyInterval;
				} else if (no_of_seconds > 3600) {
					return defaultHourlyInterval;
				} else if (no_of_seconds > 600) {
					return defaultMinuteInterval;
				} else {
					return defaultIntervalTime;
				}
			}
			function clearCountDownTimer(product_id, auction_row) {
				clearInterval(countDownTimer[product_id][auction_row]);
				countDownTimer[product_id][auction_row] = null;
				lastSetInterval[product_id][auction_row] = null;
			}
			function countDownAuction(recall, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id) {
				var script_time_to_use = parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff);
				var auction_row_for_label = 0;
				var is_active_auction = 0;
				var interval_countdown = 0;
				var display_countdown = '';
				var action_button = '';
				var time_difference = 0;
				if (recall) {
					// void current timer immediately to prevent function overlap with recall
					clearCountDownTimer(product_id, auction_row);
					// do an almost-immediate function recall for latest display updates
					countDownTimer[product_id][auction_row] = setInterval(function(){countDownAuction(0, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id)}, defaultRecallTime);
					lastSetInterval[product_id][auction_row] = defaultRecallTime;
				} else {
					if (auction_status_id == statusAuctionVoided) {
						display_countdown = textAuctionVoided;
						action_button = buttonAuctionVoided;
					} else if (auction_status_id == statusAuctionSold) {
						display_countdown = textAuctionSold;
						action_button = buttonAuctionSold;
					} else if (auction_status_id == statusAuctionExpired) {
						display_countdown = textAuctionExpired;
						action_button = buttonAuctionExpired;
					} else if (auction_status_id == statusAuctionWon) {
						display_countdown = textAuctionWon;
						action_button = buttonAuctionWon;
					} else if (auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended) {
						time_difference = parseInt(real_ending_time - script_time_to_use);
						if (time_difference > 0) {
							display_countdown = countDownTimeBreaker(time_difference) + ' ' + textAuctionLeft + ' [' + total_no_of_bid + ' ' + (total_no_of_bid > 1 ? textAuctionBids : textAuctionBid) + ']';
							action_button = buttonAuctionInProgress;
						} else {
							display_countdown = textAuctionGoingGoing;
							action_button = buttonAuctionGoingGoing;
						}
						is_active_auction++;
					} else if (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting) {
						time_difference = parseInt(starting_time - script_time_to_use);
						if (time_difference > 0) {
							display_countdown = textAuctionStartingIn + ' ' + countDownTimeBreaker(time_difference);
							action_button = buttonAuctionDelete;
							action_button = action_button.replace('/>', 'onclick="delAuctionConfirm(' + auction_row + '); return false;" />');
						} else {
							display_countdown = textAuctionGetStarted;
							action_button = buttonAuctionGetStarted;
						}
						is_active_auction++;
					} else {
						auction_row_for_label = auction_row + 1;
						display_countdown = textAuctionNewCreated + ' ' + auction_row_for_label;
						action_button = buttonAuctionDelete;
						action_button = action_button.replace('/>', 'onclick="delAuctionConfirm(' + auction_row + '); return false;" />');
					}
					$('#auction-' + auction_row).html('<font id="live-auction-' + auction_row + '">' + display_countdown + '</font>');
					$('#auction-' + auction_row).append(action_button);
					if (is_active_auction) {
						if (time_difference <= defaultCountDownFast && time_difference >= 0 && (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting || auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended)) {
							$('#live-auction-' + auction_row).stop(true, true).queue(function(){$(this).effect('pulsate', {times: 2}, defaultAnimationFast); $(this).dequeue();});
						} else if (time_difference <= defaultCountDownTime && time_difference >= 0 && (auction_status_id == statusAuctionStarting || auction_status_id == statusAuctionRelisting || auction_status_id == statusAuctionInProgress || auction_status_id == statusAuctionExtended)) {
							$('#live-auction-' + auction_row).stop(true, true).queue(function(){$(this).effect('pulsate', {times: 1}, defaultAnimationTime); $(this).dequeue();});
						} else {
							$('#live-auction-' + auction_row).stop(true, true);
						}
						// helps resetting timer to normal state after a function recall
						interval_countdown = parseInt(countDownTimeInterval(time_difference));
						if (lastSetInterval[product_id][auction_row] != interval_countdown) {
							clearCountDownTimer(product_id, auction_row);
							countDownTimer[product_id][auction_row] = setInterval(function(){countDownAuction(0, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id)}, interval_countdown);
							lastSetInterval[product_id][auction_row] = interval_countdown;
						}
					} else {
						$('#live-auction-' + auction_row).stop(true, true);
						clearCountDownTimer(product_id, auction_row);
					}
				}
			}
			function pollAuctionGlobal(auction_ids) {
				var auth = encodeURIComponent(Sha1.hash(String(parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff))));
				var curl = '../index.php?route=product/auction/auctionglobalpoll&auth=' + auth + '&auction_ids=' + auction_ids + '&last_polled=' + lastPollingTime + '&admin=1';
				lastPollingTime = parseInt(Math.floor(new Date().getTime() / 1000) + serverClientTimeDiff);
				$.ajax({
					url: curl,
					dataType: 'json',
					cache: false,
					success: function(auctions) {
						if (auctions instanceof Array && auctions.length > 0) {
							for (var auction_record = 0; auction_record < auctions.length; auction_record++) {
								var auction_id = parseInt(auctions[auction_record].auction_id);
								var total_no_of_bid = parseInt(auctions[auction_record].total_no_of_bid);
								var real_ending_time = parseInt(auctions[auction_record].real_ending_time);
								var auction_status_id = parseInt(auctions[auction_record].auction_status_id);
								if (auction_id) {
									var product_id = parseInt(pollAuctionData[auction_id].product_id);
									var auction_row = parseInt(pollAuctionData[auction_id].auction_row);
									var starting_time = parseInt(pollAuctionData[auction_id].starting_time);
									countDownAuction(1, product_id, auction_row, starting_time, total_no_of_bid, real_ending_time, auction_status_id);
								}
							}
						}
					}
				});
			}
			function addAuctionConfirm() {
				var enabled = parseInt($('select[name=\'status\']').val());
				var subtract = parseInt($('select[name=\'subtract\']').val());
				var quantity = parseInt($('input[name=\'quantity\']').val());
				var error_message = '';
				var jQueryButtons = {};
				if (isNaN(enabled) || enabled == 0) {
					error_message = modalAuctionAddProdChk.replace('%s', enabled);
					error_message = error_message.replace('/0/', textDisabled);
					jQueryButtons[textOK] = function(){$(this).dialog('close');};
					$('#dialog-auction').html(error_message).dialog({
						resizable: false,
						height: 200,
						width: 400,
						modal: true,
						title: modalAuctionWarning,
						buttons: jQueryButtons
					});
				} else if (subtract && (isNaN(quantity) || quantity < 1)) {
					error_message = modalAuctionAddStokChk.replace('/%s/', quantity);
					jQueryButtons[textOK] = function(){$(this).dialog('close');};
					$('#dialog-auction').html(error_message).dialog({
						resizable: false,
						height: 200,
						width: 400,
						modal: true,
						title: modalAuctionWarning,
						buttons: jQueryButtons
					});
				} else {
					<?php if (!$normal_sales) { ?>
					jQueryButtons[textYes] = function(){
						$(this).dialog('close');
						if (subtract) {
							quantity--;
							$('input[name=\'quantity\']').val(quantity);
						}
						addAuction();
					};
					jQueryButtons[textNo] = function(){$(this).dialog('close');};
					$('#dialog-auction').html(modalAuctionAddConfirm).dialog({
						resizable: false,
						height: 200,
						width: 400,
						modal: true,
						title: modalAuctionConfirm,
						buttons: jQueryButtons
					});
					<?php } else { ?>
					if (subtract) {
						quantity--;
						$('input[name=\'quantity\']').val(quantity);
					}
					addAuction();
					<?php } ?>
				}
			}
			function delAuctionConfirm(auction_row) {
				var auction_id = parseInt($('input[name=\'product_auction[' + auction_row + '][auction_id]\']').val());
				var jQueryButtons = {};
				if (!isNaN(auction_id)) {
					jQueryButtons[textYes] = function(){$(this).dialog('close');delAuction(auction_row);};
					jQueryButtons[textNo] = function(){$(this).dialog('close');};
					$('#dialog-auction').html(modalAuctionDelConfirm).dialog({
						resizable: false,
						height: 150,
						width: 400,
						modal: true,
						title: modalAuctionConfirm,
						buttons: jQueryButtons
					});
				} else {
					delAuction(auction_row);
				}
			}
			function trackAuctionRsvQty(rqty) {
				auctionTrackedQty = rqty;
				return;
			}
			function changeAuctionRsvQty(field, rqty) {
				var subtract = parseInt($('select[name=\'subtract\']').val());
				var quantity = parseInt($('input[name=\'quantity\']').val());
				var rquantity = parseInt(rqty);
				var rqtydiff = 0;
				var error_message = '';
				var jQueryButtons = {};
				if (subtract || rquantity <= 0 || isNaN(rquantity)) {
					rqtydiff = rquantity - parseInt(auctionTrackedQty);
					quantity = quantity - rqtydiff;
					if (quantity < 0 || rquantity < 1 || isNaN(rquantity)) {
						if (quantity < 0) {
							error_message = modalAuctionChStockChk;
						} else {
							error_message = modalAuctionChStockMin;
						}
						jQueryButtons[textOK] = function(){
							$(this).dialog('close');
							$(field).val(auctionTrackedQty);
							$(field).focus();
							return false;
						};
						$('#dialog-auction').html(error_message).dialog({
							resizable: false,
							height: 200,
							width: 400,
							modal: true,
							title: modalAuctionWarning,
							buttons: jQueryButtons
						});
					} else {
						$('input[name=\'quantity\']').val(quantity);
						return;
					}
				} else {
					return;
				}
			}
			function addAuction() {
				var html = '';
				var action_button = '';
				var auction_row_label = 0;
				while ($('#tab-auction-' + auctionRow).length) {
					auctionRow++;
				}
				html += '<div id="tab-auction-' + auctionRow + '" class="vtabs-content">';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][auction_row]" value="' + auctionRow + '" />';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][product_auction_id]" value="" />';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][auction_id]" value="" />';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][auction_status_id]" value="" />';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][total_no_of_bid]" value="" />';
				html += '<input type="hidden" name="product_auction[' + auctionRow + '][real_ending_time]" value="" />';
				html += '<table class="form">';
				html += '<tr>';
				html += '<td>' + entryAuctionName + '</td>';
				html += '<td><?php foreach ($languages as $language) { ?><input type="text" name="product_auction[' + auctionRow + '][auction_name][<?php echo $language['language_id']; ?>]" size="50" maxlength="64" value="" />&nbsp;<img src="view/image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" title="<?php echo $language['name']; ?>" /><br /><?php } ?></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionQuantity + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][reserved_quantity]" size="2" maxlength="4" value="1" onfocus="trackAuctionRsvQty(this.value);" onchange="changeAuctionRsvQty(this, this.value);" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionStarting + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][starting_time]" maxlength="16" value="' + valueAuctionStarting + '" class="datetime" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionEnding + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][ending_time]" maxlength="16" value="' + valueAuctionEnding + '" class="datetime" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionStartPrice + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][starting_price]" maxlength="20" value="" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionResrvPrice + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][reserve_price]" maxlength="20" value="" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionBuyPrice + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][buyout_price]" maxlength="20" value="" /></td>';
				html += '</tr>';
				html += '<tr>';
				html += '<td>' + entryAuctionMincrement + '</td>';
				html += '<td><input type="text" name="product_auction[' + auctionRow + '][min_increment]" maxlength="20" value="" /></td>';
				html += '</tr>';
				<?php if ($auto_bidding) { ?>
				html += '<tr>';
				html += '<td>' + entryAuctionAutoBid + '</td>';
				html += '<td><input type="radio" name="product_auction[' + auctionRow + '][allow_auto_bid]" value="1" checked="checked" />' + textYes;
				html += '<input type="radio" name="product_auction[' + auctionRow + '][allow_auto_bid]" value="0" />' + textNo + '</td>';
				html += '</tr>';
				<?php } ?>
				html += '</table>';
				html += '</div>';
				$('#tab-auction').append(html);
				auction_row_label = auctionRow + 1;
				action_button = buttonAuctionDelete;
				action_button = action_button.replace('/>', 'onclick="delAuctionConfirm(' + auctionRow + '); return false;" />');
				$('#auction-add').after('<a href="#tab-auction-' + auctionRow + '" id="auction-' + auctionRow + '">' + textAuctionNewCreated + ' ' + auction_row_label + action_button + '</a>');
				$('#vtab-auction a').tabs();
				$('#auction-' + auctionRow).trigger('click');
				$('.datetime').datetimepicker({
					dateFormat: 'yy-mm-dd',
					timeFormat: 'hh:mm'
				});
				auctionRow++;
				return false;
			}
			function delAuction(auction_row) {
				var subtract = parseInt($('select[name=\'subtract\']').val());
				var quantity = parseInt($('input[name=\'quantity\']').val());
				var rquantity = parseInt($('input[name=\'product_auction[' + auction_row + '][reserved_quantity]\']').val());
				var auction_id = parseInt($('input[name=\'product_auction[' + auction_row + '][auction_id]\']').val());
				if (subtract) {
					quantity = quantity + rquantity;
					$('input[name=\'quantity\']').val(quantity);
				}
				$('#auction-' + auction_row).remove();
				if (!isNaN(auction_id)) {
					$('#tab-auction').append('<input type="hidden" name="product_auction[' + auction_row + '][delete]" value="1" />');
				} else {
					$('#tab-auction-' + auction_row).remove();
				}
				$('#vtab-auction a:first').trigger('click');
				auctionRow = auction_row;
				return;
			}
			<?php if ($product_auctions) { ?>
			<?php foreach ($product_auctions as $product_auction) { ?>
			<?php if (!$product_auction['auction_id']) { ?>
			<?php $product_auction['total_no_of_bid'] = 0; ?>
			<?php $product_auction['real_ending_time'] = 0; ?>
			<?php $product_auction['auction_status_id'] = 0; ?>
			<?php } ?>
			countDownTimer[<?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>][<?php echo $product_auction['auction_row']; ?>] = setInterval(function(){countDownAuction(0, <?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>, <?php echo $product_auction['auction_row']; ?>, <?php echo strtotime($product_auction['starting_time']); ?>, <?php echo $product_auction['total_no_of_bid']; ?>, <?php echo $product_auction['real_ending_time']; ?>, <?php echo $product_auction['auction_status_id']; ?>)}, defaultIntervalTime);
			lastSetInterval[<?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>][<?php echo $product_auction['auction_row']; ?>] = defaultIntervalTime;
			<?php if ($product_auction['auction_id'] && ($product_auction['auction_status_id'] == $auction_status_ids['starting'] || $product_auction['auction_status_id'] == $auction_status_ids['relisting'] || $product_auction['auction_status_id'] == $auction_status_ids['inprogress'] || $product_auction['auction_status_id'] == $auction_status_ids['extended'])) { ?>
			pollAuctionData[<?php echo $product_auction['auction_id']; ?>] = {product_id: <?php echo isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0; ?>, auction_row: <?php echo $product_auction['auction_row']; ?>, starting_time: <?php echo strtotime($product_auction['starting_time']); ?>};
			<?php } ?>
			<?php } ?>
			<?php if ($error_auction_array) { ?>$('#auction').trigger('click');<?php } ?>
			<?php if ($product_auction_ids) { ?>
			setInterval(function(){pollAuctionGlobal('<?php echo implode(',', $product_auction_ids); ?>')}, defaultPollingInterval);
			setTimeout(function(){location.reload(true)}, defaultPollingTimeout);
			<?php } ?>
			$('#vtab-auction a').tabs();
			<?php } ?>
			//--></script>
			]]></add>
		</operation>

		<operation error="log" info="Replace all javascript date-time picker format to hh:mm in Catalog Product form">
			<search position="replace"><![CDATA[
			timeFormat: 'h:m'
			]]></search>
			<add><![CDATA[
			timeFormat: 'hh:mm'
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/catalog/product.php">
		<operation error="log" info="Add new Auction column filtering I/O controller for Catalog Product listing and form">
			<search position="before" index="1,2,3,4,5,6,8,9,10,11"><![CDATA[
			if (isset($this->request->get['filter_price'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->get['filter_auction_name'])) {
				$url .= '&filter_auction_name=' . urlencode(html_entity_decode($this->request->get['filter_auction_name'], ENT_QUOTES, 'UTF-8'));
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering I/O controller for Catalog Product listing">
			<search position="before" index="7"><![CDATA[
			if (isset($this->request->get['filter_price'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->get['filter_auction_name'])) {
				$filter_auction_name = $this->request->get['filter_auction_name'];
			} else {
				$filter_auction_name = null;
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering I/O controller for Catalog Product listing">
			<search position="before"><![CDATA[
			'filter_price'	  => $filter_price,
			]]></search>
			<add><![CDATA[
			'filter_auction_name' => $filter_auction_name,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction statuses configuration for Catalog Product listing">
			<search position="after"><![CDATA[
			function getList() {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction IDs listing declaration for Catalog Product listing">
			<search position="after"><![CDATA[
			$product_total = $this->model_catalog_product->getTotalProducts($data);
			]]></search>
			<add><![CDATA[
			$this->data['auction_ids'] = array();
			]]></add>
		</operation>

		<operation error="log" info="Retrieve active-only Auction listing details for Catalog Product listing">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			$auctions = array();
			$product_auctions = $this->model_catalog_product->getProductAuctions($result['product_id'], $auction_status_ids);
			foreach ($product_auctions as $product_auction) {
				$auctions[] = array(
					'auction_id'        => (int)$product_auction['auction_id'],
					'auction_name'      => strlen(stripslashes($product_auction['auction_name'])) > 20 ? substr(stripslashes($product_auction['auction_name']), 0, 20) . ' ...' : stripslashes($product_auction['auction_name']),
					'reserved_quantity' => (int)$product_auction['reserved_quantity'],
					'starting_time'     => (int)$product_auction['starting_time'],
					'total_no_of_bid'   => (int)$product_auction['total_no_of_bid'],
					'real_ending_time'  => (int)$product_auction['real_ending_time'],
					'auction_status_id' => (int)$product_auction['auction_status_id']
				);
				$this->data['auction_ids'][] = (int)$product_auction['auction_id'];
			}
			]]></add>
		</operation>

		<operation error="log" info="Slot Auction details within entire product array for Catalog Product listing">
			<search position="before"><![CDATA[
			'price'      => $result['price'],
			]]></search>
			<add><![CDATA[
			'auctions'    => $auctions,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column and texts display controller for Catalog Product listing">
			<search position="after"><![CDATA[
			$this->data['column_action'] = $this->language->get('column_action');
			]]></search>
			<add><![CDATA[
			$this->data['column_auctions'] = $this->language->get('column_auctions');
			$this->data['text_day'] = $this->language->get('text_day');
			$this->data['text_hour'] = $this->language->get('text_hour');
			$this->data['text_minute'] = $this->language->get('text_minute');
			$this->data['text_second'] = $this->language->get('text_second');
			$this->data['text_auction_no_active'] = $this->language->get('text_auction_no_active');
			$this->load->model('localisation/auction_status');
			$auction_statuses = $this->model_localisation_auction_status->getAuctionStatuses();
			$this->data['text_auction_statuses'] = array();
			$this->data['auction_status_ids'] = array();
			foreach ($auction_status_ids as $key => $value) {
				foreach ($auction_statuses as $auction_status) {
					if ($auction_status['auction_status_id'] == $value) {
						$this->data['text_auction_statuses'][$key] = $auction_status['name'];
						$this->data['auction_status_ids'][$key] = $value;
					}
				}
			}
			$this->data['text_auction_getstarted'] = $this->language->get('text_auction_getstarted');
			$this->data['text_auction_goinggoing'] = $this->language->get('text_auction_goinggoing');
			$this->data['text_auction_bid'] = $this->language->get('text_auction_bid');
			$this->data['text_auction_bids'] = $this->language->get('text_auction_bids');
			$this->data['text_auction_starting_in'] = $this->language->get('text_auction_starting_in');
			$this->data['text_auction_left'] = $this->language->get('text_auction_left');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column sorting controller for Catalog Product listing">
			<search position="before"><![CDATA[
			$this->data['sort_price'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.price' . $url, 'SSL');
			]]></search>
			<add><![CDATA[
			$this->data['sort_total_auctions'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=total_auctions' . $url, 'SSL');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering controller for Catalog Product listing">
			<search position="before"><![CDATA[
			$this->data['filter_price'] = $filter_price;
			]]></search>
			<add><![CDATA[
			$this->data['filter_auction_name'] = $filter_auction_name;
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering auto-complete controller for Catalog Product listing">
			<search position="replace"><![CDATA[
			if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_category_id'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_model']) || isset($this->request->get['filter_category_id']) || isset($this->request->get['filter_auction_name'])) {
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering auto-complete controller for Catalog Product listing">
			<search position="before"><![CDATA[
			if (isset($this->request->get['limit'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->get['filter_auction_name'])) {
				$filter_auction_name = $this->request->get['filter_auction_name'];
			} else {
				$filter_auction_name = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering auto-complete controller for Catalog Product listing">
			<search position="before"><![CDATA[
			=> $limit
			]]></search>
			<add><![CDATA[
			'filter_auction_name' => $filter_auction_name,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering auto-complete controller for Catalog Product listing">
			<search position="before"><![CDATA[
			$json[] = array(
			]]></search>
			<add><![CDATA[
			if (isset($result['auction_name'])) {
				$auction_name = $result['auction_name'];
			} else {
				$auction_name = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction column filtering auto-complete controller for Catalog Product listing">
			<search position="before"><![CDATA[
			'option'     => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_name' => strip_tags(html_entity_decode($auction_name, ENT_QUOTES, 'UTF-8')),
			]]></add>
		</operation>

		<operation error="log" info="Add new Product-Auction delete error controller for Catalog Product listing">
			<search position="before"><![CDATA[
			if (isset($this->session->data['success'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->error['product_delete'])) {
				$this->data['error_product_deletefail'] = $this->error['product_delete'];
			} else {
				$this->data['error_product_deletefail'] = array();
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Product-Auction delete error validation for Catalog Product listing">
			<search position="after" offset="3"><![CDATA[
			function validateDelete() {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (isset($this->request->post['selected'])) {
				foreach ($this->request->post['selected'] as $product_id) {
					$total_auctions = (int)$this->model_catalog_product->getTotalProductBiddedAuctions($product_id, $auction_status_ids);
					if ($total_auctions) {
						$this->error['product_delete'][$product_id] = sprintf($this->language->get('error_product_deletefail'), $total_auctions);
					}
				}
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction statuses configuration for Catalog Product form">
			<search position="after"><![CDATA[
			function getForm() {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction tab, texts, entries and modals display controller for Catalog Product form">
			<search position="after"><![CDATA[
			$this->data['tab_design'] = $this->language->get('tab_design');
			]]></search>
			<add><![CDATA[
			$this->data['tab_auction'] = $this->language->get('tab_auction');
			$this->data['text_day'] = $this->language->get('text_day');
			$this->data['text_hour'] = $this->language->get('text_hour');
			$this->data['text_minute'] = $this->language->get('text_minute');
			$this->data['text_second'] = $this->language->get('text_second');
			$this->data['text_ok'] = $this->language->get('text_ok');		
			$this->load->model('localisation/auction_status');
			$auction_statuses = $this->model_localisation_auction_status->getAuctionStatuses();
			$this->data['text_auction_statuses'] = array();
			$this->data['auction_status_ids'] = array();
			foreach ($auction_status_ids as $key => $value) {
				foreach ($auction_statuses as $auction_status) {
					if ($auction_status['auction_status_id'] == $value) {
						$this->data['text_auction_statuses'][$key] = $auction_status['name'];
						$this->data['auction_status_ids'][$key] = $value;
					}
				}
			}
			if (!is_null($this->config->get('config_auction_auto_bidding'))) {
				$this->data['auto_bidding'] = (int)$this->config->get('config_auction_auto_bidding');
			} else {
				$this->data['auto_bidding'] = 1;
			}
			if (!is_null($this->config->get('config_auction_normal_sales'))) {
				$this->data['normal_sales'] = (int)$this->config->get('config_auction_normal_sales');
			} else {
				$this->data['normal_sales'] = 0;
			}
			$this->data['text_auction_getstarted'] = $this->language->get('text_auction_getstarted');
			$this->data['text_auction_goinggoing'] = $this->language->get('text_auction_goinggoing');
			$this->data['text_auction_bid'] = $this->language->get('text_auction_bid');
			$this->data['text_auction_bids'] = $this->language->get('text_auction_bids');
			$this->data['text_auction_starting_in'] = $this->language->get('text_auction_starting_in');
			$this->data['text_auction_left'] = $this->language->get('text_auction_left');
			$this->data['text_auction_notes'] = $this->language->get('text_auction_notes');
			$this->data['text_auction_add_label'] = $this->language->get('text_auction_add_label');
			$this->data['text_auction_del_label'] = $this->language->get('text_auction_del_label');
			$this->data['text_auction_new_auction'] = $this->language->get('text_auction_new_auction');
			$this->data['entry_auction_name'] = $this->language->get('entry_auction_name');
			$this->data['entry_auction_quantity'] = $this->language->get('entry_auction_quantity');
			$this->data['entry_auction_starting'] = $this->language->get('entry_auction_starting');
			$this->data['entry_auction_ending'] = $this->language->get('entry_auction_ending');
			$this->data['entry_auction_startprice'] = $this->language->get('entry_auction_startprice');
			$this->data['entry_auction_resrvprice'] = $this->language->get('entry_auction_resrvprice');
			$this->data['entry_auction_buyprice'] = $this->language->get('entry_auction_buyprice');
			$this->data['entry_auction_mincrement'] = $this->language->get('entry_auction_mincrement');
			$this->data['entry_auction_autobid'] = $this->language->get('entry_auction_autobid');
			$this->data['modal_auction_confirm'] = $this->language->get('modal_auction_confirm');
			$this->data['modal_auction_warning'] = $this->language->get('modal_auction_warning');
			$this->data['modal_auction_add_confirm'] = $this->language->get('modal_auction_add_confirm');
			$this->data['modal_auction_del_confirm'] = $this->language->get('modal_auction_del_confirm');
			$this->data['modal_auction_add_prd_chk'] = $this->language->get('modal_auction_add_prd_chk');
			$this->data['modal_auction_add_stk_chk'] = $this->language->get('modal_auction_add_stk_chk');
			$this->data['modal_auction_chstock_chk'] = $this->language->get('modal_auction_chstock_chk');
			$this->data['modal_auction_chstock_min'] = $this->language->get('modal_auction_chstock_min');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction error controller for Catalog Product form">
			<search position="before"><![CDATA[
			if (isset($this->error['date_available'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->error['auction_error'])) {
				$this->data['error_auction_array'] = $this->error['auction_error'];
			} else {
				$this->data['error_auction_array'] = array();
			}
			if (isset($this->error['product_status'])) {
				$this->data['error_auction_prod_enable'] = $this->error['product_status'];
			} else {
				$this->data['error_auction_prod_enable'] = '';
			}
			if (isset($this->error['product_stock'])) {
				$this->data['error_auction_stock_minus'] = $this->error['product_stock'];
			} else {
				$this->data['error_auction_stock_minus'] = '';
			}
			if (isset($this->error['auction_delete'])) {
				$this->data['error_auction_deletefail'] = $this->error['auction_delete'];
			} else {
				$this->data['error_auction_deletefail'] = array();
			}
			if (isset($this->error['auction_update'])) {
				$this->data['error_auction_updatefail'] = $this->error['auction_update'];
			} else {
				$this->data['error_auction_updatefail'] = array();
			}
			if (isset($this->error['auction_name'])) {
				$this->data['error_auction_name'] = $this->error['auction_name'];
			} else {
				$this->data['error_auction_name'] = array();
			}
			if (isset($this->error['reserved_quantity'])) {
				$this->data['error_auction_quantity'] = $this->error['reserved_quantity'];
			} else {
				$this->data['error_auction_quantity'] = array();
			}
			if (isset($this->error['starting_time'])) {
				$this->data['error_auction_starting'] = $this->error['starting_time'];
			} else {
				$this->data['error_auction_starting'] = array();
			}
			if (isset($this->error['ending_time'])) {
				$this->data['error_auction_ending'] = $this->error['ending_time'];
			} else {
				$this->data['error_auction_ending'] = array();
			}
			if (isset($this->error['starting_price'])) {
				$this->data['error_auction_startprice'] = $this->error['starting_price'];
			} else {
				$this->data['error_auction_startprice'] = array();
			}
			if (isset($this->error['reserve_price'])) {
				$this->data['error_auction_rsrvprice'] = $this->error['reserve_price'];
			} else {
				$this->data['error_auction_rsrvprice'] = array();
			}
			if (isset($this->error['buyout_price'])) {
				$this->data['error_auction_buyprice'] = $this->error['buyout_price'];
			} else {
				$this->data['error_auction_buyprice'] = array();
			}
			if (isset($this->error['min_increment'])) {
				$this->data['error_auction_mincrement'] = $this->error['min_increment'];
			} else {
				$this->data['error_auction_mincrement'] = array();
			}
			]]></add>
		</operation>

		<operation error="log" info="Retrieve newly-submitted, pending-start and active-only Auction full-details for Catalog Product form">
			<search position="before"><![CDATA[
			$this->template = 'catalog/product_form.tpl';
			]]></search>
			<add><![CDATA[
			if (isset($this->request->get['product_id'])) {
				$auction_row = (int)$this->model_catalog_product->getTotalProductAuctions($this->request->get['product_id'], $auction_status_ids) - 1;
			} else {
				$auction_row = 0;
			}
			$this->data['product_auctions'] = array();
			$this->data['product_auction_ids'] = array();
			// for newly submitted auctions (for sorting reasons, this array is separated from below)
			if (isset($this->request->post['product_auction'])) {
				$product_auctions = $this->request->post['product_auction'];
				rsort($product_auctions);
				foreach ($product_auctions as $product_auction) {
					if (!$product_auction['auction_id'] && isset($product_auction['auction_row'])) {
						$this->data['product_auctions'][] = $product_auction;
					}
				}
			}
			// for editable auctions that are not started yet
			if (isset($this->request->post['product_auction'])) {
				$product_auctions = $this->request->post['product_auction'];
				foreach ($product_auctions as $product_auction) {
					if ($product_auction['auction_id']) {
						$auction_status_id = (int)$this->model_catalog_product->getProductAuctionStatus($product_auction['auction_id']);
						if ($auction_status_id == $auction_status_ids['starting'] || $auction_status_id == $auction_status_ids['relisting']) {
							$this->data['product_auctions'][] = $product_auction;
							$this->data['product_auction_ids'][] = $product_auction['auction_id'];
							$auction_row--;
						}
					}
				}
			}
			// for active auctions only
			if (isset($this->request->get['product_id'])) {
				$product_auctions = $this->model_catalog_product->getProductAuctions($this->request->get['product_id'], $auction_status_ids);
				foreach ($product_auctions as $product_auction) {
					if (!isset($this->request->post['product_auction']) || $product_auction['auction_status_id'] == $auction_status_ids['inprogress'] || $product_auction['auction_status_id'] == $auction_status_ids['extended']) {
						if ($product_auction['auction_status_id'] == $auction_status_ids['starting'] || $product_auction['auction_status_id'] == $auction_status_ids['relisting']) {
							$auction_disabled = '';
						} else {
							$auction_disabled = ' disabled';
						}
						$auction_names = $this->model_catalog_product->getProductAuctionDescriptions($product_auction['product_auction_id']);
						$this->data['product_auctions'][] = array(
							'product_auction_id' => (int)$product_auction['product_auction_id'],
							'auction_id'         => (int)$product_auction['auction_id'],
							'auction_row'        => (int)$auction_row,
							'auction_name'       => $auction_names,
							'reserved_quantity'  => (int)$product_auction['reserved_quantity'],
							'starting_time'      => date('Y-m-d H:i', (int)$product_auction['starting_time']),
							'ending_time'        => date('Y-m-d H:i', (int)$product_auction['ending_time']),
							'starting_price'     => (string)$product_auction['starting_price'],
							'reserve_price'      => (string)$product_auction['reserve_price'],
							'buyout_price'       => (string)$product_auction['buyout_price'],
							'min_increment'      => (string)$product_auction['min_increment'],
							'allow_auto_bid'     => (int)$product_auction['allow_auto_bid'],
							'total_no_of_bid'    => (int)$product_auction['total_no_of_bid'],
							'real_ending_time'   => (int)$product_auction['real_ending_time'],
							'auction_status_id'  => (int)$product_auction['auction_status_id'],
							'auction_disabled'   => $auction_disabled
						);
						$this->data['product_auction_ids'][] = $product_auction['auction_id'];
						$auction_row--;
					}
				}
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction error validation for Catalog Product form">
			<search position="before"><![CDATA[
			if ($this->error && !isset($this->error['warning'])) {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if ($this->config->get('config_auction_parameters') && is_array($this->config->get('config_auction_parameters'))) {
				$auction_parameters = $this->config->get('config_auction_parameters');
			} else {
				$auction_parameters = array('min_starttime' => 0, 'max_starttime' => 72, 'min_endtime' => 1, 'max_endtime' => 72, 'max_startprice' => 999999.99, 'max_rsrvprice' => 999999.99, 'max_buyprice' => 999999.99, 'max_increment' => 999.99);
			}
			// product not enabled
			if (isset($this->request->get['product_id']) && (int)$this->request->post['status'] < 1 && (int)$this->model_catalog_product->getTotalProductAuctions($this->request->get['product_id'], $auction_status_ids)) {
				$this->error['product_status'] = $this->language->get('error_auction_prod_enable');
				$this->error['auction_error'] = true;
			}
			if (isset($this->request->post['product_auction'])) {
				// product not enabled
				if ((int)$this->request->post['status'] < 1) {
					$this->error['product_status'] = $this->language->get('error_auction_prod_enable');
					$this->error['auction_error'] = true;
				}
				// product out of stock
				if ((int)$this->request->post['quantity'] < 0) {
					$this->error['product_stock'] = $this->language->get('error_auction_stock_minus');
					$this->error['auction_error'] = true;
				}
				foreach ($this->request->post['product_auction'] as $auction_row => $auction) {
					// already have product related error
					if (isset($this->error['auction_error']) && !is_array($this->error['auction_error'])) {
						break;
					}
					// auction already active, unable to delete
					if (!empty($auction['delete']) && $auction['product_auction_id'] && $auction['auction_id']) {
						$total_auctions = (int)$this->model_catalog_product->getTotalProductStartedAuctions($auction['auction_id'], $auction_status_ids);
						if ($total_auctions) {
							$this->error['auction_delete'][$auction_row] = $this->language->get('error_auction_deletefail');
							$this->error['auction_error'][$auction_row] = true;
							continue;
						}
					}
					// auction already active, unable to update
					if ($auction['product_auction_id'] && $auction['auction_id']) {
						$total_auctions = (int)$this->model_catalog_product->getTotalProductStartedAuctions($auction['auction_id'], $auction_status_ids);
						if ($total_auctions) {
							$this->error['auction_update'][$auction_row] = $this->language->get('error_auction_updatefail');
							$this->error['auction_error'][$auction_row] = true;
							continue;
						}
					}
					// auction names error
					foreach ($auction['auction_name'] as $language_id => $value) {
						if (utf8_strlen($value) < 3 || utf8_strlen($value) > 64) {
							$this->error['auction_name'][$auction_row][$language_id] = sprintf($this->language->get('error_auction_name'), '3', '64');
							$this->error['auction_error'][$auction_row] = true;
						}
					}
					// reserved quantity error
					if ((int)$auction['reserved_quantity'] < 1) {
						$this->error['reserved_quantity'][$auction_row] = $this->language->get('error_auction_quantity');
						$this->error['auction_error'][$auction_row] = true;
					}
					// starting time error
					if (strtotime($auction['starting_time']) === false || strtotime($auction['starting_time']) < time() || strtotime($auction['starting_time']) < (time() + ((int)$auction_parameters['min_starttime'] * 60 * 60)) || strtotime($auction['starting_time']) > (time() + ((int)$auction_parameters['max_starttime'] * 60 * 60))) {
						$this->error['starting_time'][$auction_row] = sprintf($this->language->get('error_auction_starting'), (string)$auction_parameters['min_starttime'], (string)$auction_parameters['max_starttime']);
						$this->error['auction_error'][$auction_row] = true;
					}
					// ending time error
					if (strtotime($auction['ending_time']) === false || strtotime($auction['ending_time']) < (strtotime($auction['starting_time']) + ((int)$auction_parameters['min_endtime'] * 60 * 60)) || strtotime($auction['ending_time']) > (strtotime($auction['starting_time']) + ((int)$auction_parameters['max_endtime'] * 60 * 60))) {
						$this->error['ending_time'][$auction_row] = sprintf($this->language->get('error_auction_ending'), (string)$auction_parameters['min_endtime'], (string)$auction_parameters['max_endtime']);
						$this->error['auction_error'][$auction_row] = true;
					}
					// starting price error
					if ((float)$auction['starting_price'] < 0.01 || (float)$auction['starting_price'] > (float)$auction_parameters['max_startprice']) {
						$this->error['starting_price'][$auction_row] = sprintf($this->language->get('error_auction_startprice'), (string)$auction_parameters['max_startprice']);
						$this->error['auction_error'][$auction_row] = true;
					}
					// reserve price error
					if ((float)$auction['reserve_price'] > 0 && ((float)$auction['reserve_price'] < (float)$auction['starting_price'] || (float)$auction['reserve_price'] > (float)$auction_parameters['max_rsrvprice'])) {
						$this->error['reserve_price'][$auction_row] = sprintf($this->language->get('error_auction_rsrvprice'), (string)$auction_parameters['max_rsrvprice']);
						$this->error['auction_error'][$auction_row] = true;
					}
					// buyout price error
					if ((float)$auction['buyout_price'] > 0 && ((float)$auction['buyout_price'] < (float)$auction['starting_price'] || (float)$auction['buyout_price'] < (float)$auction['reserve_price'] || (float)$auction['buyout_price'] > (float)$auction_parameters['max_buyprice'])) {
						$this->error['buyout_price'][$auction_row] = sprintf($this->language->get('error_auction_buyprice'), (string)$auction_parameters['max_buyprice']);
						$this->error['auction_error'][$auction_row] = true;
					}
					// minimum increment error
					if ((float)$auction['min_increment'] < 0.01 || (float)$auction['min_increment'] > (float)$auction_parameters['max_increment']) {
						$this->error['min_increment'][$auction_row] = sprintf($this->language->get('error_auction_mincrement'), (string)$auction_parameters['max_increment']);
						$this->error['auction_error'][$auction_row] = true;
					}
				}
			}
			]]></add>
		</operation>
	</file>

	<file name="admin/model/catalog/product.php">
		<operation error="log" info="Add new deleting Auction model when deleting Product">
			<search position="before"><![CDATA[
			$this->db->query("DELETE FROM " . DB_PREFIX . "review WHERE product_id = '" . (int)$product_id . "'");
			]]></search>
			<add><![CDATA[
			$this->db->query("DELETE pa, a, pad, abs, ua FROM " . DB_PREFIX . "product_auction pa INNER JOIN " . DB_PREFIX . "auction a ON (pa.product_auction_id = a.product_auction_id) LEFT JOIN " . DB_PREFIX . "product_auction_description pad ON (pa.product_auction_id = pad.product_auction_id) LEFT JOIN " . DB_PREFIX . "auction_bid_setting abs ON (a.auction_id = abs.auction_id) LEFT JOIN " . DB_PREFIX . "url_alias ua ON (ua.query = CONCAT('auction_id=', a.auction_id)) WHERE pa.product_id = '" . (int)$product_id . "'");
			]]></add>
		</operation>

		<operation error="log" info="Add new inserting Auction model when adding or updating Product">
			<search position="before"><![CDATA[
			if ($data['keyword']) {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (isset($data['product_auction'])) {
				$this->setProductAuctions($product_id, $data['product_auction'], $auction_status_ids);
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new inserting, updating and deleting Auction SQL statement">
			<search position="before"><![CDATA[
			public function getProduct($product_id) {
			]]></search>
			<add><![CDATA[
			public function setProductAuctions($product_id, $product_auctions, $auction_status_ids) {
				foreach ($product_auctions as $product_auction) {
					if ($product_auction['auction_id']) {
						$real_auction_status_id = (int)$this->getProductAuctionStatus($product_auction['auction_id']);
					} else {
						$real_auction_status_id = 0;
					}
					if (!is_null($this->config->get('config_auction_auto_bidding'))) {
						$auto_bidding = (int)$this->config->get('config_auction_auto_bidding');
					} else {
						$auto_bidding = 1;
					}
					if (!is_null($this->config->get('config_auction_fast_auto_bids'))) {
						$fast_auto_bids = (int)$this->config->get('config_auction_fast_auto_bids');
					} else {
						$fast_auto_bids = 1;
					}
					if (!is_null($this->config->get('config_auction_auto_extension'))) {
						$auto_extension = (int)$this->config->get('config_auction_auto_extension');
					} else {
						$auto_extension = 1;
					}
					if ($this->config->get('config_auction_ext_duration')) {
						$ext_duration = (int)$this->config->get('config_auction_ext_duration');
					} else {
						$ext_duration = 15;
					}
					if ($this->config->get('config_auction_ext_window')) {
						$ext_window = (int)$this->config->get('config_auction_ext_window');
					} else {
						$ext_window = 60;
					}
					// deciding which SQL statement to use for db query with given parameters
					if (!empty($product_auction['delete']) && $product_auction['product_auction_id'] && $product_auction['auction_id']) {
						// for deleting auction parameters
						$sql_statement_start    = "DELETE FROM ";
						$sql_set_applicable     = "";
						$sql_product_auction_id = "product_auction_id = '" . (int)$product_auction['product_auction_id'] . "'";
						$sql_product_id         = "product_id = '" . (int)$product_id . "'";
						$sql_auction_id         = "auction_id = '" . (int)$product_auction['auction_id'] . "'";
						$sql_auction_status_id  = "'" . $real_auction_status_id . "' IN ('" . (int)$auction_status_ids['starting'] . "', '" . (int)$auction_status_ids['relisting'] . "')";
						$sql_statement_end1     = " WHERE " . $sql_product_auction_id;
						$sql_statement_end2     = " AND " . $sql_product_id;
						$sql_statement_end3     = " AND " . $sql_auction_id;
						$sql_statement_end4     = " AND " . $sql_auction_status_id;
						$sql_db_query_type      = 3;
					} elseif ($product_auction['product_auction_id'] && $product_auction['auction_id']) {
						// for updating auction parameters
						$sql_statement_start    = "UPDATE ";
						$sql_set_applicable     = " SET ";
						$sql_product_auction_id = "product_auction_id = '" . (int)$product_auction['product_auction_id'] . "'";
						$sql_product_id         = "product_id = '" . (int)$product_id . "'";
						$sql_auction_id         = "auction_id = '" . (int)$product_auction['auction_id'] . "'";
						$sql_auction_status_id  = "'" . $real_auction_status_id . "' IN ('" . (int)$auction_status_ids['starting'] . "', '" . (int)$auction_status_ids['relisting'] . "')";
						$sql_real_ending_time   = "real_ending_time = real_ending_time";
						$sql_date_added         = "date_added = date_added";
						$sql_date_modified      = "date_modified = '" . date('Y-m-d H:i:s') . "'";
						$sql_statement_end1     = " WHERE " . $sql_product_auction_id;
						$sql_statement_end2     = " AND " . $sql_product_id;
						$sql_statement_end3     = " AND " . $sql_auction_id;
						$sql_statement_end4     = " AND " . $sql_auction_status_id;
						$sql_db_query_type      = 2;
					} else {
						// for inserting auction parameters
						$sql_statement_start    = "INSERT INTO ";
						$sql_set_applicable     = " SET ";
						$sql_product_auction_id = "product_auction_id = product_auction_id";
						$sql_product_id         = "product_id = '" . (int)$product_id . "'";
						$sql_auction_id         = "auction_id = auction_id";
						$sql_auction_status_id  = "auction_status_id = '" . (int)$auction_status_ids['starting'] . "'";
						$sql_real_ending_time   = "real_ending_time = '" . strtotime($product_auction['ending_time']) . "'";
						$sql_date_added         = "date_added = '" . date('Y-m-d H:i:s') . "'";
						$sql_date_modified      = "date_modified = date_modified";
						$sql_statement_end1     = "";
						$sql_statement_end2     = "";
						$sql_statement_end3     = "";
						$sql_statement_end4     = "";
						$sql_db_query_type      = 1;
					}
					// preparing SQL statement for DB_product_auction insert or update or delete
					$sql = $sql_statement_start . DB_PREFIX . "product_auction";
					if ($sql_db_query_type < 3) {
						// for inserting or updating auction only
						$sql .= $sql_set_applicable;
						$sql .= $sql_product_auction_id . ", ";
						$sql .= $sql_product_id . ", ";
						$sql .= "reserved_quantity = '" . (int)$product_auction['reserved_quantity'] . "', ";
						$sql .= "starting_time = '" . strtotime($product_auction['starting_time']) . "', ";
						$sql .= "ending_time = '" . strtotime($product_auction['ending_time']) . "', ";
						$sql .= "starting_price = '" . (float)$product_auction['starting_price'] . "', ";
						$sql .= "reserve_price = '" . (float)$product_auction['reserve_price'] . "', ";
						$sql .= "buyout_price = '" . (float)$product_auction['buyout_price'] . "', ";
						$sql .= "min_increment = '" . (float)$product_auction['min_increment'] . "', ";
						$sql .= "allow_auto_bid = '" . (int)((int)$product_auction['allow_auto_bid'] * $auto_bidding) . "', ";
						$sql .= "fast_fwd_auto_bids = '" . (int)((int)$product_auction['allow_auto_bid'] * $auto_bidding * $fast_auto_bids) . "', ";
						$sql .= "allow_auto_extend = '" . $auto_extension . "', ";
						$sql .= "extension_duration = '" . $ext_duration . "', ";
						$sql .= "extension_window = '" . $ext_window . "'";
					}
					$sql .= $sql_statement_end1;
					$sql .= $sql_statement_end2;
					$sql .= $sql_statement_end4;
					$this->db->query($sql);
					// preparing SQL statement for DB_auction insert or update or delete
					if ($sql_db_query_type == 1) {
						$product_auction['product_auction_id'] = $this->db->getLastId();
						$sql_product_auction_id = "product_auction_id = '" . (int)$product_auction['product_auction_id'] . "'";
					}
					// updating multi-language auction names directly into DB_product_auction_description
					if ($sql_db_query_type < 3) {
						$this->db->query("DELETE FROM " . DB_PREFIX . "product_auction_description WHERE product_auction_id = '" . (int)$product_auction['product_auction_id'] . "'");
						foreach ($product_auction['auction_name'] as $language_id => $value) {
							$this->db->query("INSERT INTO " . DB_PREFIX . "product_auction_description SET product_auction_id = '" . (int)$product_auction['product_auction_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value) . "'");
						}
					}
					$sql = $sql_statement_start . DB_PREFIX . "auction";
					if ($sql_db_query_type < 3) {
						// for inserting or updating auction only
						$sql .= $sql_set_applicable;
						$sql .= $sql_auction_id . ", ";
						$sql .= $sql_product_auction_id . ", ";
						$sql .= $sql_real_ending_time . ", ";
						if ($sql_db_query_type == 1) {
							$sql .= $sql_auction_status_id . ", ";
						}
						$sql .= $sql_date_added . ", ";
						$sql .= $sql_date_modified;
					}
					$sql .= $sql_statement_end1;
					$sql .= $sql_statement_end3;
					$sql .= $sql_statement_end4;
					$this->db->query($sql);
					// auto-defining URL alias with SEO rewrite keywords for auction
					if ($sql_db_query_type == 1) {
						$product_auction['auction_id'] = $this->db->getLastId();
					}
					$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'auction_id=" . (int)$product_auction['auction_id'] . "'");
					if ($sql_db_query_type < 3) {
						if (!empty($product_auction['auction_name'][$this->config->get('config_language_id')])) {
							$auction_name = $product_auction['auction_name'][$this->config->get('config_language_id')];
						} else {
							$auction_name = $this->config->get('config_name') . ' Product Auction';
						}
						$keyword = 'auction-' . (int)$product_auction['auction_id'] . '-' . preg_replace('/\s+/', '_', preg_replace("/[^a-z0-9 ]/", '', html_entity_decode(strtolower($auction_name), ENT_QUOTES, 'UTF-8')));
						$this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'auction_id=" . (int)$product_auction['auction_id'] . "', keyword = '" . $this->db->escape($keyword) . "'");
					}
				}
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new retrieving Auction details SQL statements">
			<search position="before"><![CDATA[
			public function getTotalProducts($data = array()) {
			]]></search>
			<add><![CDATA[
			public function getProductAuctions($product_id, $auction_status_ids) {
				$query = $this->db->query("SELECT pa.*, a.*, pad.name AS auction_name FROM " . DB_PREFIX . "product_auction pa INNER JOIN " . DB_PREFIX . "auction a ON (pa.product_auction_id = a.product_auction_id) LEFT JOIN " . DB_PREFIX . "product_auction_description pad ON (pa.product_auction_id = pad.product_auction_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.auction_status_id IN ('" . (int)$auction_status_ids['starting'] . "', '" . (int)$auction_status_ids['relisting'] . "', '" . (int)$auction_status_ids['inprogress'] . "', '" . (int)$auction_status_ids['extended'] . "') AND pad.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY a.real_ending_time ASC, pa.starting_time DESC");
				return $query->rows;
			}
			public function getProductAuctionDescriptions($product_auction_id) {
				$product_auction_description_data = array();
				$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_auction_description WHERE product_auction_id = '" . (int)$product_auction_id . "'");
				foreach ($query->rows as $result) {
					$product_auction_description_data[$result['language_id']] = stripslashes($result['name']);
				}
				return $product_auction_description_data;
			}
			public function getTotalProductAuctions($product_id, $auction_status_ids) {
				$query = $this->db->query("SELECT COUNT(*) AS total_auctions FROM " . DB_PREFIX . "product_auction pa INNER JOIN " . DB_PREFIX . "auction a ON (pa.product_auction_id = a.product_auction_id) LEFT JOIN " . DB_PREFIX . "product_auction_description pad ON (pa.product_auction_id = pad.product_auction_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.auction_status_id IN ('" . (int)$auction_status_ids['starting'] . "', '" . (int)$auction_status_ids['relisting'] . "', '" . (int)$auction_status_ids['inprogress'] . "', '" . (int)$auction_status_ids['extended'] . "') AND pad.language_id = '" . (int)$this->config->get('config_language_id') . "'");
				return $query->row['total_auctions'];
			}
			public function getProductAuctionStatus($auction_id) {
				$query = $this->db->query("SELECT MAX(auction_status_id) AS auction_status_id FROM " . DB_PREFIX . "auction WHERE auction_id = '" . (int)$auction_id . "'");
				return $query->row['auction_status_id'];
			}
			public function getTotalProductStartedAuctions($auction_id, $auction_status_ids) {
				$query = $this->db->query("SELECT COUNT(*) AS total_auctions FROM " . DB_PREFIX . "product_auction pa INNER JOIN " . DB_PREFIX . "auction a ON (pa.product_auction_id = a.product_auction_id) WHERE a.auction_id = '" . (int)$auction_id . "' AND a.auction_status_id IN ('" . (int)$auction_status_ids['inprogress'] . "', '" . (int)$auction_status_ids['extended'] . "', '" . (int)$auction_status_ids['won'] . "', '" . (int)$auction_status_ids['expired'] . "', '" . (int)$auction_status_ids['sold'] . "', '" . (int)$auction_status_ids['voided'] . "')");
				return $query->row['total_auctions'];
			}
			public function getTotalProductBiddedAuctions($product_id, $auction_status_ids) {
				$query = $this->db->query("SELECT COUNT(*) AS total_auctions FROM " . DB_PREFIX . "product_auction pa INNER JOIN " . DB_PREFIX . "auction a ON (pa.product_auction_id = a.product_auction_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.auction_status_id IN ('" . (int)$auction_status_ids['inprogress'] . "', '" . (int)$auction_status_ids['extended'] . "', '" . (int)$auction_status_ids['won'] . "', '" . (int)$auction_status_ids['expired'] . "', '" . (int)$auction_status_ids['sold'] . "', '" . (int)$auction_status_ids['voided'] . "') AND a.highest_bid_id > '0'");
				return $query->row['total_auctions'];
			}
			public function getTotalProductAuctionsByAuctionStatusId($auction_status_id) {
				$query = $this->db->query("SELECT COUNT(*) AS total_auctions FROM " . DB_PREFIX . "auction WHERE auction_status_id = '" . (int)$auction_status_id . "'");
				return $query->row['total_auctions'];
			}
			public function getTotalProductAuctionBidsByAuctionBidStatusId($auction_bid_status_id) {
				$query = $this->db->query("SELECT COUNT(*) AS total_bids FROM " . DB_PREFIX . "auction_bid WHERE auction_bid_status_id = '" . (int)$auction_bid_status_id . "'");
				return $query->row['total_bids'];
			}
			]]></add>
		</operation>

		<operation error="log" info="Modify existing Product SQL statement to include new Auction totals for Catalog Product listing">
			<search position="replace"><![CDATA[
			$sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";
			]]></search>
			<add><![CDATA[
			if (!empty($data['filter_auction_name']) || (isset($data['sort']) && $data['sort'] == 'total_auctions')) {
				$sql = "SELECT *, COUNT(DISTINCT pa.product_auction_id) AS total_auctions, pad.name AS auction_name FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";	
			} else {
				$sql = "SELECT * FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id)";	
			}
			]]></add>
		</operation>

		<operation error="log" info="Modify existing Product SQL statement to include new Auction filter for Catalog Product listing">
			<search position="before"><![CDATA[
			$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "'";
			]]></search>
			<add><![CDATA[
			if (!empty($data['filter_auction_name']) || (isset($data['sort']) && $data['sort'] == "total_auctions")) {
				$sql .= " LEFT JOIN " . DB_PREFIX . "product_auction pa ON (p.product_id = pa.product_id) LEFT JOIN " . DB_PREFIX . "product_auction_description pad ON (pa.product_auction_id = pad.product_auction_id)";
			}
			]]></add>
		</operation>

		<operation error="log" info="Modify existing Product SQL statement to include new Auction filter for Catalog Product listing">
			<search position="before"><![CDATA[
			if (!empty($data['filter_price'])) {
			]]></search>
			<add><![CDATA[
			if (!empty($data['filter_auction_name'])) {
				$sql .= " AND LCASE(pad.name) LIKE '" . $this->db->escape(utf8_strtolower($data['filter_auction_name'])) . "%' AND pad.language_id = '" . (int)$this->config->get('config_language_id') . "'";
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction totals sorting variable for Catalog Product listing">
			<search position="before"><![CDATA[
			'p.price',
			]]></search>
			<add><![CDATA[
			'total_auctions',
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/sale/order.php">
		<operation error="log" info="New Auction text in Sales Order Info and Invoice">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']                        = 'Won from an auction!';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/sale/order_info.tpl">
		<operation error="log" info="Add new Auction text under each Product name in Sales Order Info">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="view/image/auction.png" height="12" width="12" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/sale/order_invoice.tpl">
		<operation error="log" info="Add new Auction text under each Product name in Sales Order Invoice">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="view/image/auction.png" height="12" width="12" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/sale/order_form.tpl">
		<operation error="log" info="Prevent deleting of Product if won by Auction in Sales Order Update form">
			<search position="replace"><![CDATA[
			<td class="center" style="width: 3px;"><img src="view/image/delete.png" title="<?php echo $button_remove; ?>" alt="<?php echo $button_remove; ?>" style="cursor: pointer;" onclick="$('#product-row<?php echo $product_row; ?>').remove(); $('#button-update').trigger('click');" /></td>
			]]></search>
			<add><![CDATA[
			<?php if ($order_product['auction_id']) { ?>
			<td class="center" style="width: 3px;">&nbsp;</td>
			<?php } else { ?>
			<td class="center" style="width: 3px;"><img src="view/image/delete.png" title="<?php echo $button_remove; ?>" alt="<?php echo $button_remove; ?>" style="cursor: pointer;" onclick="$('#product-row<?php echo $product_row; ?>').remove(); $('#button-update').trigger('click');" /></td>
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction text under each Product name in Sales Order Update form">
			<search position="before"><![CDATA[
			<?php foreach ($order_product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($order_product['auction_id']) { ?>
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="view/image/auction.png" height="12" width="12" /><br />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/sale/order.php">
		<operation error="log" info="Add new Auction text display controller for Sales Order Info, Invoice and Update form">
			<search position="before"><![CDATA[
			$this->data['column_product'] = $this->language->get('column_product');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction I/O controller for both Sales Order Info and Invoice">
			<search position="before"><![CDATA[
			$option_data = array();
			]]></search>
			<add><![CDATA[
			$this->load->model('sale/auction');
			$auction = $this->model_sale_auction->getOrderAuction($this->request->get['order_id'], $product['order_product_id']);
			if ($auction) {
				$auction_id = (int)$auction['auction_id'];
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction I/O controller for Sales Order Update form">
			<search position="before"><![CDATA[
			if (isset($order_product['order_option'])) {
			]]></search>
			<add><![CDATA[
			$this->load->model('sale/auction');
			if (isset($this->request->get['order_id'])) {
				$auction = $this->model_sale_auction->getOrderAuction($this->request->get['order_id'], $order_product['order_product_id']);
				if ($auction) {
					$auction_id = (int)$auction['auction_id'];
				} else {
					$auction_id = 0;
				}
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction I/O controller for Sales Order Info">
			<search position="before"><![CDATA[
			'option'   		   => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id'       => $auction_id,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction I/O controller for Sales Order Invoice">
			<search position="before"><![CDATA[
			'option'   => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $auction_id,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction I/O controller for Sales Order Update form">
			<search position="before"><![CDATA[
			'option'           => $order_option,
			]]></search>
			<add><![CDATA[
			'auction_id'       => $auction_id,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction link controller for Sales Order Info (link back to Sales Auctions, Auction Info)">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			if ($auction_id) {
				$href = $this->url->link('sale/auction/info', 'token=' . $this->session->data['token'] . '&auction_id=' . $auction_id, 'SSL');
			} else {
				$href = $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $product['product_id'], 'SSL');
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction link controller for Sales Order Info (link back to Sales Auctions, Auction Info)">
			<search position="replace"><![CDATA[
			'href'     		   => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $product['product_id'], 'SSL')
			]]></search>
			<add><![CDATA[
			'href'     		   => $href
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/payment/amazon_checkout.php" error="skip">
		<operation error="log" info="New Auction text for Amazon Checkout Admin - 1.5.6 onwards">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won'] = 'Won from an auction!';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/payment/amazon_checkout_order.tpl" error="skip">
		<operation error="log" info="Display new Auction text in Amazon Checkout Admin - 1.5.6 onwards">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="view/image/auction.png" height="12" width="12" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/payment/amazon_checkout.php" error="skip">
		<operation error="log" info="Display controller for new Auction text in Amazon Checkout Admin - 1.5.6 onwards">
			<search position="before"><![CDATA[
			$this->data['column_submission_id'] = $this->language->get('column_submission_id');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for Amazon Checkout Admin - 1.5.6 onwards">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			$this->load->model('sale/auction');
			$order_auction = $this->model_sale_auction->getOrderAuction($order_id, $product['order_product_id']);
			if ($order_auction) {
				$auction_id = (int)$order_auction['auction_id'];
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for Amazon Checkout Admin - 1.5.6 onwards">
			<search position="before"><![CDATA[
			'option' => $product_options,
			]]></search>
			<add><![CDATA[
			'auction_id' => $auction_id,
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/common/header.php">
		<operation error="log" info="New Auction menu texts in Common Header">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction']                     = 'Auctions';
			$_['text_auction_status']              = 'Auction Statuses';
			$_['text_auction_bid_status']          = 'Auction Bid Statuses';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/common/header.tpl">
		<operation error="log" info="Add new Auction menu texts in Common Header">
			<search position="before"><![CDATA[
			<li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
			]]></search>
			<add><![CDATA[
			<li><a href="<?php echo $auction; ?>"><?php echo $text_auction; ?></a></li>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction menu texts in Common Header">
			<search position="before"><![CDATA[
			<li><a href="<?php echo $stock_status; ?>"><?php echo $text_stock_status; ?></a></li>
			]]></search>
			<add><![CDATA[
            <li><a class="parent"><?php echo $text_auction; ?></a>
              <ul>
                <li><a href="<?php echo $auction_status; ?>"><?php echo $text_auction_status; ?></a></li>
                <li><a href="<?php echo $auction_bid_status; ?>"><?php echo $text_auction_bid_status; ?></a></li>
              </ul>
            </li>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction menu texts in Common Header">
			<search position="before"><![CDATA[
			<li><a href="<?php echo $report_adv_sale_order; ?>"><?php echo $text_report_adv_sale_order; ?></a></li>
			]]></search>
			<add><![CDATA[
            <li><a href="<?php echo $report_sale_auction; ?>"><?php echo $text_auction; ?></a></li>
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/common/header.php">
		<operation error="log" info="Add new Auction menu texts display controller for Common Header">
			<search position="before"><![CDATA[
			$this->data['text_stock_status'] = $this->language->get('text_stock_status');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction'] = $this->language->get('text_auction');
			$this->data['text_auction_status'] = $this->language->get('text_auction_status');
			$this->data['text_auction_bid_status'] = $this->language->get('text_auction_bid_status');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction menu texts I/O controller for Common Header">
			<search position="before"><![CDATA[
			$this->data['stock_status'] = $this->url->link('localisation/stock_status', 'token=' . $this->session->data['token'], 'SSL');
			]]></search>
			<add><![CDATA[
			$this->data['auction'] = $this->url->link('sale/auction', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['auction_status'] = $this->url->link('localisation/auction_status', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['auction_bid_status'] = $this->url->link('localisation/auction_bid_status', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_sale_auction'] = $this->url->link('report/sale_auction', 'token=' . $this->session->data['token'], 'SSL');
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/common/home.php">
		<operation error="log" info="New Auction content in Admin Dashboard">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_total_auction']            = 'Total Auctions:';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/common/home.tpl">
		<operation error="log" info="Add new Auction content in Admin Dashboard">
			<search position="before" offset="1"><![CDATA[
			<td><?php echo $text_total_order; ?></td>
			]]></search>
			<add><![CDATA[
            <tr>
              <td><?php echo $text_total_auction; ?></td>
              <td><?php echo $total_auction; ?></td>
            </tr>
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/common/home.php">
		<operation error="log" info="Add new Auction content display controller for Admin Dashboard">
			<search position="before"><![CDATA[
			$this->data['text_total_order'] = $this->language->get('text_total_order');
			]]></search>
			<add><![CDATA[
			$this->data['text_total_auction'] = $this->language->get('text_total_auction');
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction content I/O controller for Admin Dashboard">
			<search position="before"><![CDATA[
			$this->load->model('sale/order');
			]]></search>
			<add><![CDATA[
			$this->load->model('sale/auction');
			$this->data['total_auction'] = $this->model_sale_auction->getTotalAuctions();
			]]></add>
		</operation>
	</file>

	<file name="admin/language/english/setting/setting.php">
		<operation error="log" info="Add new text - all Auction Settings">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction']                 = 'Auctions';
			$_['text_seconds']                 = 'second(s)';
			$_['text_hours']                   = 'hour(s)';
			$_['text_times']                   = 'time(s)';
			]]></add>
		</operation>

		<operation error="log" info="Add new entries - all Auction Settings">
			<search position="after"><![CDATA[
			// Entry
			]]></search>
			<add><![CDATA[
			$_['entry_auction_parameters']     = 'Auction Parameters:<br /><span class="help">Set the default minimum and maximum limits allowed when creating or editing auctions.<br />For Time = number of hours<br />For Prices = currency amount</span>';
			$_['entry_auction_min_starttime']  = 'Min Start Time<br /><span class="help">(from now)</span>';
			$_['entry_auction_max_starttime']  = 'Max Start Time<br /><span class="help">(from now)</span>';
			$_['entry_auction_min_endtime']    = 'Min End Time<br /><span class="help">(from start)</span>';
			$_['entry_auction_max_endtime']    = 'Max End Time<br /><span class="help">(from start)</span>';
			$_['entry_auction_max_startprice'] = 'Max Starting Price';
			$_['entry_auction_max_rsrvprice']  = 'Max Reserve Price';
			$_['entry_auction_max_buyprice']   = 'Max Buyout Price';
			$_['entry_auction_max_increment']  = 'Max Increment/Bid';
			$_['entry_auction_normal_sales']   = 'Allow Normal Sales:<br /><span class="help">Enable/Disable Add-to-Cart and normal sales activities if product has at least 1 live auction.</span>';
			$_['entry_auction_payment_period'] = 'Payment Period:<br /><span class="help">Set the maximum number of day(s) for won-auctions to be paid before they are voided and released back to the stock.</span>';
			$_['entry_auction_quick_bidding']  = '(<b>Pro only</b>) Allow Quick-Bidding:<br /><span class="help">Allow customers to make instant bid on auctions from the home page or other layouts (module panels), live listing and mini listing within each product catalog page.</span>';
			$_['entry_auction_auto_bidding']   = '(<b>Pro only</b>) Allow Auto-Bidding:<br /><span class="help">Allow customers to set auto-bidding on with a limit while away from keyboard, works very well with Auto-Extension.<br />Changes do NOT affect in-progress or extended auctions.<br /><u>Can also be disabled per auction.</u></span>';
			$_['entry_auction_fast_auto_bids'] = 'Fast-Forward Auto-Bids<br /><span class="help"><br />(Skip concurrent auto-bid fights to the highest amount directly. If Auto-Extension is allowed,<br />enabling this shall also multiply the extension time by the number of auto-bids skipped.)</span>';
			$_['entry_auction_auto_extension'] = '(<b>Pro only</b>) Allow Auto-Extension:<br /><span class="help">Extend auction time when receiving last minute bid, resembles going.. going.. gone! traditional auction feature.<br />Changes do NOT affect in-progress or extended auctions.</span>';
			$_['entry_auction_ext_duration']   = 'Extend for ';
			$_['entry_auction_ext_window']     = 'when new bid is placed within the last ';
			$_['entry_auction_auto_relisting'] = '(<b>Pro only</b>) Allow Auto-Relisting:<br /><span class="help">Relist auction automatically after expiry if it ends without a winner or won-but-not-paid within the payment period.</span>';
			$_['entry_auction_relist_window']  = 'Relist within ';
			$_['entry_auction_relist_max']     = 'of auction expiry and for a maximum of ';
			$_['entry_auction_notifications']  = '(<b>Pro only</b>) Auction Notifications:<br /><span class="help">Trigger auction notifications automatically (by email) for each stage of an auction when processed throughout different progress or by a customer. Notify once per auction unless specified.</span>';
			$_['entry_auction_notify_1stbid']  = 'Notify customers when making 1st bid in a new auction';
			$_['entry_auction_notify_outbid']  = 'Notify customers when outbid 1st time in a new auction';
			$_['entry_auction_notify_overrun'] = 'Notify customers when their auto-bids have been overrun';
			$_['entry_auction_notify_ending']  = 'Notify customers when their bid-auctions ending in 5min';
			$_['entry_auction_notify_extended'] = 'Notify customers when their bid-auctions have extended';
			$_['entry_auction_notify_won']     = 'Notify customers when their bid-auctions have been won';
			$_['entry_auction_notify_lost']    = 'Notify customers when their bid-auctions have been lost';
			$_['entry_auction_notify_expired'] = 'Notify customers when their bid-auctions have expired';
			$_['entry_auction_notify_voided']  = 'Notify customers when their bid-auctions have voided';
			$_['entry_auction_notify_payment'] = 'Remind customers everyday to pay for their won-auctions';
			$_['entry_auction_statuses']       = 'Auction Statuses:<br /><span class="help">Set the default auction statuses for each stage of an auction when processed throughout different progress.</span>';
			$_['entry_auction_starting']       = 'Starting';
			$_['entry_auction_relisting']      = 'Relisting';
			$_['entry_auction_inprogress']     = 'In-Progress';
			$_['entry_auction_extended']       = 'Extended';
			$_['entry_auction_won']            = 'Won';
			$_['entry_auction_expired']        = 'Expired';
			$_['entry_auction_sold']           = 'Sold';
			$_['entry_auction_voided']         = 'Voided';
			$_['entry_auction_bid_statuses']   = 'Auction Bid Statuses:<br /><span class="help">Set the default auction bid statuses for each stage of an auction bid when processed by a customer.</span>';
			$_['entry_auction_bid_winning']    = 'Winning';
			$_['entry_auction_bid_outbid']     = 'Outbid';
			$_['entry_auction_bid_buyout']     = 'Buyout';
			$_['entry_auction_bid_voided']     = 'Voided';
			]]></add>
		</operation>

		<operation error="log" info="Add new errors - all Auction Settings">
			<search position="after"><![CDATA[
			// Error
			]]></search>
			<add><![CDATA[
			$_['error_auction_statuses']       = 'Auction statuses must not overlap!';
			$_['error_auction_bid_statuses']   = 'Auction bid statuses must not overlap!';
			]]></add>
		</operation>
	</file>

	<file name="admin/view/template/setting/setting.tpl">
		<operation error="log" info="Add new settings - all Auction Settings">
			<search position="before"><![CDATA[
			<h2><?php echo $text_voucher; ?></h2>
			]]></search>
			<add><![CDATA[
			<h2><?php echo $text_auction; ?></h2>
			<table class="form">
				<tr>
				  <td><?php echo $entry_auction_parameters; ?></td>
				  <td><table width="400px" border="0" cellpadding="2" cellspacing="2">
					<tr><td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_min_starttime; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[min_starttime]" value="<?php echo $config_auction_parameters['min_starttime']; ?>" size="3" /></td>
					<td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_starttime; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_starttime]" value="<?php echo $config_auction_parameters['max_starttime']; ?>" size="3" /></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_min_endtime; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[min_endtime]" value="<?php echo $config_auction_parameters['min_endtime']; ?>" size="3" /></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_endtime; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_endtime]" value="<?php echo $config_auction_parameters['max_endtime']; ?>" size="3" /></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_startprice; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_startprice]" value="<?php echo $config_auction_parameters['max_startprice']; ?>" size="7" /></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_rsrvprice; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_rsrvprice]" value="<?php echo $config_auction_parameters['max_rsrvprice']; ?>" size="7" /></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_buyprice; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_buyprice]" value="<?php echo $config_auction_parameters['max_buyprice']; ?>" size="7" /></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_max_increment; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><input type="text" name="config_auction_parameters[max_increment]" value="<?php echo $config_auction_parameters['max_increment']; ?>" size="7" /></td></tr>
				  </table></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_normal_sales; ?></td>
				  <td><?php if ($config_auction_normal_sales) { ?>
					<input type="radio" name="config_auction_normal_sales" value="1" checked="checked" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_normal_sales" value="0" />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="config_auction_normal_sales" value="1" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_normal_sales" value="0" checked="checked" />
					<?php echo $text_no; ?>
					<?php } ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_payment_period; ?></td>
				  <td><input type="text" name="config_auction_payment_period" value="<?php echo $config_auction_payment_period; ?>" size="3" /></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_quick_bidding; ?></td>
				  <td><?php if ($config_auction_quick_bidding) { ?>
					<input type="radio" name="config_auction_quick_bidding" value="1" checked="checked" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_quick_bidding" value="0" />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="config_auction_quick_bidding" value="1" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_quick_bidding" value="0" checked="checked" />
					<?php echo $text_no; ?>
					<?php } ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_auto_bidding; ?></td>
				  <td><?php if ($config_auction_auto_bidding) { ?>
					<input type="radio" name="config_auction_auto_bidding" value="1" checked="checked" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_bidding" value="0" />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="config_auction_auto_bidding" value="1" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_bidding" value="0" checked="checked" />
					<?php echo $text_no; ?>
					<?php } ?><br /><br />
					<?php if ($config_auction_fast_auto_bids) { ?>
					<input type="checkbox" name="config_auction_fast_auto_bids" value="1" checked="checked" />
					<?php echo $entry_auction_fast_auto_bids; ?>
					<?php } else { ?>
					<input type="checkbox" name="config_auction_fast_auto_bids" value="0" />
					<?php echo $entry_auction_fast_auto_bids; ?>
					<?php } ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_auto_extension; ?></td>
				  <td><?php if ($config_auction_auto_extension) { ?>
					<input type="radio" name="config_auction_auto_extension" value="1" checked="checked" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_extension" value="0" />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="config_auction_auto_extension" value="1" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_extension" value="0" checked="checked" />
					<?php echo $text_no; ?>
					<?php } ?><br /><br />
					<?php echo $entry_auction_ext_duration; ?>
					<input type="text" name="config_auction_ext_duration" value="<?php echo $config_auction_ext_duration; ?>" size="3" />
					<?php echo $text_seconds; ?>
					<?php echo $entry_auction_ext_window; ?>
					<input type="text" name="config_auction_ext_window" value="<?php echo $config_auction_ext_window; ?>" size="3" />
					<?php echo $text_seconds; ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_auto_relisting; ?></td>
				  <td><?php if ($config_auction_auto_relisting) { ?>
					<input type="radio" name="config_auction_auto_relisting" value="1" checked="checked" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_relisting" value="0" />
					<?php echo $text_no; ?>
					<?php } else { ?>
					<input type="radio" name="config_auction_auto_relisting" value="1" />
					<?php echo $text_yes; ?>
					<input type="radio" name="config_auction_auto_relisting" value="0" checked="checked" />
					<?php echo $text_no; ?>
					<?php } ?><br /><br />
					<?php echo $entry_auction_relist_window; ?>
					<input type="text" name="config_auction_relist_window" value="<?php echo $config_auction_relist_window; ?>" size="3" />
					<?php echo $text_hours; ?>
					<?php echo $entry_auction_relist_max; ?>
					<input type="text" name="config_auction_relist_max" value="<?php echo $config_auction_relist_max; ?>" size="3" />
					<?php echo $text_times; ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_notifications; ?></td>
				  <td><div class="scrollbox" style="width: 400px;">
					  <?php $class = 'odd'; ?>
					  <?php foreach ($entry_auction_notifications_all as $key => $value) { ?>
					  <?php $class = ($class == 'even' ? 'odd' : 'even'); ?>
					  <div class="<?php echo $class; ?>">
						<?php if (in_array($key, $config_auction_notifications)) { ?>
						<input type="checkbox" name="config_auction_notifications[]" value="<?php echo $key; ?>" checked="checked" />
						<?php echo $value; ?>
						<?php } else { ?>
						<input type="checkbox" name="config_auction_notifications[]" value="<?php echo $key; ?>" />
						<?php echo $value; ?>
						<?php } ?>
					  </div>
					  <?php } ?>
					</div></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_statuses; ?></td>
				  <td><table width="400px" border="0" cellpadding="2" cellspacing="2">
					<tr><td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_starting; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[starting]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['starting']) && $auction_status['auction_status_id'] == $config_auction_status_id['starting']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_relisting; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[relisting]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['relisting']) && $auction_status['auction_status_id'] == $config_auction_status_id['relisting']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_inprogress; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[inprogress]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['inprogress']) && $auction_status['auction_status_id'] == $config_auction_status_id['inprogress']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_extended; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[extended]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['extended']) && $auction_status['auction_status_id'] == $config_auction_status_id['extended']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_won; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[won]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['won']) && $auction_status['auction_status_id'] == $config_auction_status_id['won']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_expired; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[expired]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['expired']) && $auction_status['auction_status_id'] == $config_auction_status_id['expired']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_sold; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[sold]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['sold']) && $auction_status['auction_status_id'] == $config_auction_status_id['sold']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_voided; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_status_id[voided]" style="width: 100px;">
					  <?php foreach ($auction_statuses as $auction_status) { ?>
					  <?php if (isset($config_auction_status_id['voided']) && $auction_status['auction_status_id'] == $config_auction_status_id['voided']) { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>" selected="selected"><?php echo $auction_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_status['auction_status_id']; ?>"><?php echo $auction_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					</table>
				  <?php if ($error_auction_statuses) { ?>
				  <span class="error"><?php echo $error_auction_statuses; ?></span>
				  <?php } ?></td>
				</tr>
				<tr>
				  <td><?php echo $entry_auction_bid_statuses; ?></td>
				  <td><table width="400px" border="0" cellpadding="2" cellspacing="2">
					<tr><td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_bid_winning; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_bid_status_id[winning]" style="width: 100px;">
					  <?php foreach ($auction_bid_statuses as $auction_bid_status) { ?>
					  <?php if (isset($config_auction_bid_status_id['winning']) && $auction_bid_status['auction_bid_status_id'] == $config_auction_bid_status_id['winning']) { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>" selected="selected"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td width="20%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_bid_outbid; ?></td>
					<td width="1%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td width="29%" style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_bid_status_id[outbid]" style="width: 100px;">
					  <?php foreach ($auction_bid_statuses as $auction_bid_status) { ?>
					  <?php if (isset($config_auction_bid_status_id['outbid']) && $auction_bid_status['auction_bid_status_id'] == $config_auction_bid_status_id['outbid']) { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>" selected="selected"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					<tr><td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_bid_buyout; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_bid_status_id[buyout]" style="width: 100px;">
					  <?php foreach ($auction_bid_statuses as $auction_bid_status) { ?>
					  <?php if (isset($config_auction_bid_status_id['buyout']) && $auction_bid_status['auction_bid_status_id'] == $config_auction_bid_status_id['buyout']) { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>" selected="selected"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><?php echo $entry_auction_bid_voided; ?></td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;">&#58;</td>
					<td style="border-right: 0px; border-bottom: 0px; padding: 0px 0px;"><select name="config_auction_bid_status_id[voided]" style="width: 100px;">
					  <?php foreach ($auction_bid_statuses as $auction_bid_status) { ?>
					  <?php if (isset($config_auction_bid_status_id['voided']) && $auction_bid_status['auction_bid_status_id'] == $config_auction_bid_status_id['voided']) { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>" selected="selected"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } else { ?>
					  <option value="<?php echo $auction_bid_status['auction_bid_status_id']; ?>"><?php echo $auction_bid_status['name']; ?></option>
					  <?php } ?>
					  <?php } ?>
					</select></td></tr>
					</table>
				  <?php if ($error_auction_bid_statuses) { ?>
				  <span class="error"><?php echo $error_auction_bid_statuses; ?></span>
				  <?php } ?></td>
				</tr>
			</table>
			]]></add>
		</operation>
	</file>

	<file name="admin/controller/setting/setting.php">
		<operation error="log" info="Display controller for all Auction Settings">
			<search position="before"><![CDATA[
			$this->data['entry_voucher_min'] = $this->language->get('entry_voucher_min');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction'] = $this->language->get('text_auction');
			$this->data['text_seconds'] = $this->language->get('text_seconds');
			$this->data['text_hours'] = $this->language->get('text_hours');
			$this->data['text_times'] = $this->language->get('text_times');
			$this->data['entry_auction_parameters'] = $this->language->get('entry_auction_parameters');
			$this->data['entry_auction_min_starttime'] = $this->language->get('entry_auction_min_starttime');
			$this->data['entry_auction_max_starttime'] = $this->language->get('entry_auction_max_starttime');
			$this->data['entry_auction_min_endtime'] = $this->language->get('entry_auction_min_endtime');
			$this->data['entry_auction_max_endtime'] = $this->language->get('entry_auction_max_endtime');
			$this->data['entry_auction_max_startprice'] = $this->language->get('entry_auction_max_startprice');
			$this->data['entry_auction_max_rsrvprice'] = $this->language->get('entry_auction_max_rsrvprice');
			$this->data['entry_auction_max_buyprice'] = $this->language->get('entry_auction_max_buyprice');
			$this->data['entry_auction_max_increment'] = $this->language->get('entry_auction_max_increment');
			$this->data['entry_auction_normal_sales'] = $this->language->get('entry_auction_normal_sales');
			$this->data['entry_auction_payment_period'] = $this->language->get('entry_auction_payment_period');
			$this->data['entry_auction_quick_bidding'] = $this->language->get('entry_auction_quick_bidding');
			$this->data['entry_auction_auto_bidding'] = $this->language->get('entry_auction_auto_bidding');
			$this->data['entry_auction_fast_auto_bids'] = $this->language->get('entry_auction_fast_auto_bids');
			$this->data['entry_auction_auto_extension'] = $this->language->get('entry_auction_auto_extension');
			$this->data['entry_auction_ext_duration'] = $this->language->get('entry_auction_ext_duration');
			$this->data['entry_auction_ext_window'] = $this->language->get('entry_auction_ext_window');
			$this->data['entry_auction_auto_relisting'] = $this->language->get('entry_auction_auto_relisting');
			$this->data['entry_auction_relist_window'] = $this->language->get('entry_auction_relist_window');
			$this->data['entry_auction_relist_max'] = $this->language->get('entry_auction_relist_max');
			$this->data['entry_auction_notifications'] = $this->language->get('entry_auction_notifications');
			$this->data['entry_auction_notifications_all'] = array(
				'1stbid'   => $this->language->get('entry_auction_notify_1stbid'),
				'outbid'   => $this->language->get('entry_auction_notify_outbid'),
				'overrun'  => $this->language->get('entry_auction_notify_overrun'),
				'ending'   => $this->language->get('entry_auction_notify_ending'),
				'extended' => $this->language->get('entry_auction_notify_extended'),
				'won'      => $this->language->get('entry_auction_notify_won'),
				'lost'     => $this->language->get('entry_auction_notify_lost'),
				'expired'  => $this->language->get('entry_auction_notify_expired'),
				'voided'   => $this->language->get('entry_auction_notify_voided'),
				'payment'  => $this->language->get('entry_auction_notify_payment')
			);
			$this->data['entry_auction_statuses'] = $this->language->get('entry_auction_statuses');
			$this->data['entry_auction_starting'] = $this->language->get('entry_auction_starting');
			$this->data['entry_auction_relisting'] = $this->language->get('entry_auction_relisting');
			$this->data['entry_auction_inprogress'] = $this->language->get('entry_auction_inprogress');
			$this->data['entry_auction_extended'] = $this->language->get('entry_auction_extended');
			$this->data['entry_auction_won'] = $this->language->get('entry_auction_won');
			$this->data['entry_auction_expired'] = $this->language->get('entry_auction_expired');
			$this->data['entry_auction_sold'] = $this->language->get('entry_auction_sold');
			$this->data['entry_auction_voided'] = $this->language->get('entry_auction_voided');
			$this->data['entry_auction_bid_statuses'] = $this->language->get('entry_auction_bid_statuses');
			$this->data['entry_auction_bid_winning'] = $this->language->get('entry_auction_bid_winning');
			$this->data['entry_auction_bid_outbid'] = $this->language->get('entry_auction_bid_outbid');
			$this->data['entry_auction_bid_buyout'] = $this->language->get('entry_auction_bid_buyout');
			$this->data['entry_auction_bid_voided'] = $this->language->get('entry_auction_bid_voided');
			]]></add>
		</operation>

		<operation error="log" info="Error display controller for all Auction Settings">
			<search position="before"><![CDATA[
			if (isset($this->error['voucher_min'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->error['auction_statuses'])) {
				$this->data['error_auction_statuses'] = $this->error['auction_statuses'];
			} else {
				$this->data['error_auction_statuses'] = '';
			}
			if (isset($this->error['auction_bid_statuses'])) {
				$this->data['error_auction_bid_statuses'] = $this->error['auction_bid_statuses'];
			} else {
				$this->data['error_auction_bid_statuses'] = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for all Auction Settings">
			<search position="before"><![CDATA[
			if (isset($this->request->post['config_voucher_min'])) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->post['config_auction_parameters'])) {
				$this->data['config_auction_parameters'] = $this->request->post['config_auction_parameters'];
			} elseif ($this->config->get('config_auction_parameters')) {
				$this->data['config_auction_parameters'] = $this->config->get('config_auction_parameters');
			} else {
				$this->data['config_auction_parameters'] = array('min_starttime' => 0, 'max_starttime' => 72, 'min_endtime' => 1, 'max_endtime' => 72, 'max_startprice' => 999999.99, 'max_rsrvprice' => 999999.99, 'max_buyprice' => 999999.99, 'max_increment' => 999.99);
			}
			if (isset($this->request->post['config_auction_normal_sales'])) {
				$this->data['config_auction_normal_sales'] = $this->request->post['config_auction_normal_sales'];
			} elseif (!is_null($this->config->get('config_auction_normal_sales'))) {
				$this->data['config_auction_normal_sales'] = $this->config->get('config_auction_normal_sales');
			} else {
				$this->data['config_auction_normal_sales'] = 0;
			}
			if (isset($this->request->post['config_auction_payment_period'])) {
				$this->data['config_auction_payment_period'] = $this->request->post['config_auction_payment_period'];
			} elseif ($this->config->get('config_auction_payment_period')) {
				$this->data['config_auction_payment_period'] = $this->config->get('config_auction_payment_period');
			} else {
				$this->data['config_auction_payment_period'] = 21;
			}
			if (isset($this->request->post['config_auction_quick_bidding'])) {
				$this->data['config_auction_quick_bidding'] = $this->request->post['config_auction_quick_bidding'];
			} elseif (!is_null($this->config->get('config_auction_quick_bidding'))) {
				$this->data['config_auction_quick_bidding'] = $this->config->get('config_auction_quick_bidding');
			} else {
				$this->data['config_auction_quick_bidding'] = 1;
			}
			if (isset($this->request->post['config_auction_auto_bidding'])) {
				$this->data['config_auction_auto_bidding'] = $this->request->post['config_auction_auto_bidding'];
			} elseif (!is_null($this->config->get('config_auction_auto_bidding'))) {
				$this->data['config_auction_auto_bidding'] = $this->config->get('config_auction_auto_bidding');
			} else {
				$this->data['config_auction_auto_bidding'] = 1;
			}
			if (isset($this->request->post['config_auction_fast_auto_bids'])) {
				$this->data['config_auction_fast_auto_bids'] = $this->request->post['config_auction_fast_auto_bids'];
			} elseif (!is_null($this->config->get('config_auction_fast_auto_bids'))) {
				$this->data['config_auction_fast_auto_bids'] = $this->config->get('config_auction_fast_auto_bids');
			} else {
				$this->data['config_auction_fast_auto_bids'] = 1;
			}
			if (isset($this->request->post['config_auction_auto_extension'])) {
				$this->data['config_auction_auto_extension'] = $this->request->post['config_auction_auto_extension'];
			} elseif (!is_null($this->config->get('config_auction_auto_extension'))) {
				$this->data['config_auction_auto_extension'] = $this->config->get('config_auction_auto_extension');
			} else {
				$this->data['config_auction_auto_extension'] = 1;
			}
			if (isset($this->request->post['config_auction_ext_duration'])) {
				$this->data['config_auction_ext_duration'] = $this->request->post['config_auction_ext_duration'];
			} elseif ($this->config->get('config_auction_ext_duration')) {
				$this->data['config_auction_ext_duration'] = $this->config->get('config_auction_ext_duration');
			} else {
				$this->data['config_auction_ext_duration'] = 15;
			}
			if (isset($this->request->post['config_auction_ext_window'])) {
				$this->data['config_auction_ext_window'] = $this->request->post['config_auction_ext_window'];
			} elseif ($this->config->get('config_auction_ext_window')) {
				$this->data['config_auction_ext_window'] = $this->config->get('config_auction_ext_window');
			} else {
				$this->data['config_auction_ext_window'] = 60;
			}
			if (isset($this->request->post['config_auction_auto_relisting'])) {
				$this->data['config_auction_auto_relisting'] = $this->request->post['config_auction_auto_relisting'];
			} elseif (!is_null($this->config->get('config_auction_auto_relisting'))) {
				$this->data['config_auction_auto_relisting'] = $this->config->get('config_auction_auto_relisting');
			} else {
				$this->data['config_auction_auto_relisting'] = 1;
			}
			if (isset($this->request->post['config_auction_relist_window'])) {
				$this->data['config_auction_relist_window'] = $this->request->post['config_auction_relist_window'];
			} elseif ($this->config->get('config_auction_relist_window')) {
				$this->data['config_auction_relist_window'] = $this->config->get('config_auction_relist_window');
			} else {
				$this->data['config_auction_relist_window'] = 1;
			}
			if (isset($this->request->post['config_auction_relist_max'])) {
				$this->data['config_auction_relist_max'] = $this->request->post['config_auction_relist_max'];
			} elseif ($this->config->get('config_auction_relist_max')) {
				$this->data['config_auction_relist_max'] = $this->config->get('config_auction_relist_max');
			} else {
				$this->data['config_auction_relist_max'] = 3;
			}
			if (isset($this->request->post['config_auction_notifications'])) {
				$this->data['config_auction_notifications'] = $this->request->post['config_auction_notifications'];
			} elseif ($this->config->get('config_auction_notifications')) {
				$this->data['config_auction_notifications'] = $this->config->get('config_auction_notifications');
			} else {
				$this->data['config_auction_notifications'] = array('1stbid', 'outbid', 'overrun', 'ending', 'extended', 'won', 'lost', 'expired', 'voided', 'payment');
			}
			if (isset($this->request->post['config_auction_status_id'])) {
				$this->data['config_auction_status_id'] = $this->request->post['config_auction_status_id'];
			} elseif ($this->config->get('config_auction_status_id')) {
				$this->data['config_auction_status_id'] = $this->config->get('config_auction_status_id');
			} else {
				$this->data['config_auction_status_id'] = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (isset($this->request->post['config_auction_bid_status_id'])) {
				$this->data['config_auction_bid_status_id'] = $this->request->post['config_auction_bid_status_id'];
			} elseif ($this->config->get('config_auction_bid_status_id')) {
				$this->data['config_auction_bid_status_id'] = $this->config->get('config_auction_bid_status_id');
			} else {
				$this->data['config_auction_bid_status_id'] = array('winning' => 1, 'outbid' => 2, 'buyout' => 3, 'voided' => 4);
			}
			$this->load->model('localisation/auction_status');
			$this->load->model('localisation/auction_bid_status');
			$this->data['auction_statuses'] = $this->model_localisation_auction_status->getAuctionStatuses();
			$this->data['auction_bid_statuses'] = $this->model_localisation_auction_bid_status->getAuctionBidStatuses();
			]]></add>
		</operation>

		<operation error="log" info="Error validation controller for all Auction Settings">
			<search position="before"><![CDATA[
			if (!$this->request->post['config_voucher_min']) {
			]]></search>
			<add><![CDATA[
			if (isset($this->request->post['config_auction_status_id']) && is_array($this->request->post['config_auction_status_id']) && count($this->request->post['config_auction_status_id']) !== count(array_unique($this->request->post['config_auction_status_id']))) {
				$this->error['auction_statuses'] = $this->language->get('error_auction_statuses');
			}
			if (isset($this->request->post['config_auction_bid_status_id']) && is_array($this->request->post['config_auction_bid_status_id']) && count($this->request->post['config_auction_bid_status_id']) !== count(array_unique($this->request->post['config_auction_bid_status_id']))) {
				$this->error['auction_bid_statuses'] = $this->language->get('error_auction_bid_statuses');
			}
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/english.php">
		<operation error="log" info="New Auction general texts">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_ok']               = 'OK';
			]]></add>
		</operation>

		<operation error="log" info="New Auction general buttons">
			<search position="after"><![CDATA[
			// Buttons
			]]></search>
			<add><![CDATA[
			$_['button_start_bidding']  = 'Start Bidding Now!';
			$_['button_login_to_bid']   = 'Login to Bid';
			$_['button_quick_bid']      = 'Bid';
			$_['button_place_bid']      = 'Place Bid';
			$_['button_buy_now']        = 'Buy Now!';
			$_['button_save_auto_bid']  = 'Save Setting';
			]]></add>
		</operation>
	</file>
		<file name="catalog/language/english/english.php">
		<operation error="log" info="New Auction general texts">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_ok']               = 'OK';
			]]></add>
		</operation>

		<operation error="log" info="New Auction general buttons">
			<search position="after"><![CDATA[
			// Buttons
			]]></search>
			<add><![CDATA[
			$_['button_start_bidding']  = 'Start Bidding Now!';
			$_['button_login_to_bid']   = 'Login to Bid';
			$_['button_quick_bid']      = 'Bid';
			$_['button_place_bid']      = 'Place Bid';
			$_['button_buy_now']        = 'Buy Now!';
			$_['button_save_auto_bid']  = 'Save Setting';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/product/product.tpl">
		<operation error="log" info="Hide first to prevent high latency loaders from seeing (Description)">
			<search position="replace"><![CDATA[
			<div class="description">
			]]></search>
			<add><![CDATA[
			<div class="description"<?php if ($auction_valid || $total_auctions) { ?> style="display: none;"<?php } ?>>
			]]></add>
		</operation>

		<operation error="log" info="Hide first to prevent high latency loaders from seeing (Price)">
			<search position="replace" index="1"><![CDATA[
			<div class="price">
			]]></search>
			<add><![CDATA[
			<div class="price"<?php if ($auction_valid || $total_auctions) { ?> style="display: none;"<?php } ?>>
			]]></add>
		</operation>

		<operation error="skip" info="Hide first to prevent high latency loaders from seeing (Payment Profile) - 1.5.6 onwards">
			<search position="replace"><![CDATA[
			<div class="option">
			]]></search>
			<add><![CDATA[
			<div class="option"<?php if ($auction_valid || $total_auctions) { ?> style="display: none;"<?php } ?>>
			]]></add>
		</operation>

		<operation error="log" info="Hide first to prevent high latency loaders from seeing (Options)">
			<search position="replace"><![CDATA[
			<div class="options">
			]]></search>
			<add><![CDATA[
			<div class="options"<?php if ($auction_valid || $total_auctions) { ?> style="display: none;"<?php } ?>>
			]]></add>
		</operation>

		<operation error="log" info="Hide first to prevent high latency loaders from seeing (Cart)">
			<search position="replace"><![CDATA[
			<div class="cart">
			]]></search>
			<add><![CDATA[
			<div class="cart"<?php if ($auction_valid || $total_auctions) { ?> style="display: none;"<?php } ?>>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction section in Product display">
			<search position="before"><![CDATA[
			<div id="tabs" class="htabs">
			]]></search>
			<add><![CDATA[
			<?php if ($auction_valid || $total_auctions) { ?>
			<div id="auction-info"></div>
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction tabs in Product display">
			<search position="before"><![CDATA[
			<?php if ($tags) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($auction_valid) { ?>
			<div id="tab-auction-history" class="tab-content">
			  <div id="auction-history"></div>
			</div>
			<?php } ?>
			<?php if ($total_auctions) { ?>
			<div id="tab-auction-live" class="tab-content">
			  <div id="auction-live"></div>
			</div>
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Load all Auction details in Product display and into the Auction section">
			<search position="before"><![CDATA[
			<?php echo $footer; ?>
			]]></search>
			<add><![CDATA[
			<?php if ($auction_valid || $total_auctions) { ?>
			<script type="text/javascript"><!--
			$('#auction-info').load('index.php?route=product/auction/info&product_id=<?php echo $product_id; ?>&auction_id=<?php echo $auction_id; ?>');
			//--></script>
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/product/product.php">
		<operation error="log" info="Basic I/O controller for Auction validity check in Product display">
			<search position="after"><![CDATA[
			if ($product_info) {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			$this->load->model('catalog/auction');
			if (isset($this->request->get['auction_id'])) {
				$this->data['auction_id'] = (int)$this->request->get['auction_id'];
				$this->data['auction_valid'] = (int)$this->model_catalog_auction->getAuctionValidity($product_id, $this->request->get['auction_id'], $auction_status_ids);
			} else {
				$this->data['auction_id'] = 0;
				$this->data['auction_valid'] = 0;
			}
			$this->data['total_auctions'] = (int)$this->model_catalog_auction->getTotalLiveAuctionsByProductId($product_id, $auction_status_ids);
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/checkout/cart.php">
		<operation error="log" info="New Auction texts for Shopping Cart">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']     = 'Won from an auction!';
			$_['text_auction_removal'] = 'Auction cannot be removed from the shopping cart.' . PHP_EOL . PHP_EOL . 'However it will be automatically discarded from your cart if payment is not received within %s days of winning.';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default2new/template/checkout/simplecheckout_cart.tpl">
		<operation error="log" info="Display new Auction text in Shopping Cart">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			- <small><?php echo $text_auction_won; ?></small><br />
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Disable change of Quantity if won from Auction in Shopping Cart">
			<search position="replace"><![CDATA[
			<input type="text" data-onchange="changeProductQuantity" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" />
			]]></search>
			<add><![CDATA[
			<input type="text" data-onchange="changeProductQuantity" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1"<?php if ($product['auction_id']) { ?> disabled<?php } ?> />
			]]></add>
		</operation>

		<operation error="log" info="Disable update of Quantity if won from Auction in Shopping Cart">
			<search position="replace"><![CDATA[
			<img data-onclick="decreaseProductQuantity" src='<?php echo $additional_path ?>catalog/view/image/minus.png'>
			]]></search>
			<add><![CDATA[
			<?php if (!$product['auction_id']) { ?>
			<img data-onclick="decreaseProductQuantity" src='<?php echo $additional_path ?>catalog/view/image/minus.png'>
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Disable update of Quantity if won from Auction in Shopping Cart">
			<search position="replace"><![CDATA[
			<img data-onclick="increaseProductQuantity" src='<?php echo $additional_path ?>catalog/view/image/plus.png'>
			]]></search>
			<add><![CDATA[
			<?php if (!$product['auction_id']) { ?>
			<img data-onclick="increaseProductQuantity" src='<?php echo $additional_path ?>catalog/view/image/plus.png'>
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Disable removal of Product if won from Auction in Shopping Cart">
			<search position="replace"><![CDATA[
			<img data-onclick="removeProduct" data-product-key="<?php echo $product['key'] ?>" src="<?php echo $additional_path ?>catalog/view/image/close.png" />
			]]></search>
			<add><![CDATA[
			<?php if (!$product['auction_id']) { ?>
			<img data-onclick="removeProduct" data-product-key="<?php echo $product['key'] ?>" src="<?php echo $additional_path ?>catalog/view/image/close.png" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/checkout/cart.php">
		<operation error="log" info="Display controller for new Auction texts in Shopping Cart">
			<search position="before"><![CDATA[
			$this->data['column_image'] = $this->language->get('column_image');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			$this->data['text_auction_removal'] = sprintf($this->language->get('text_auction_removal'), $this->config->get('config_auction_payment_period') ? (string)$this->config->get('config_auction_payment_period') : '21');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction href in Shopping Cart">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			if ($product['auction_id']) {
				$href_auction = '&auction_id=' . $product['auction_id'];
			} else {
				$href_auction = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in Shopping Cart">
			<search position="before"><![CDATA[
			=> $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $product['auction_id'],
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Product-Auction link in Shopping Cart">
			<search position="replace"><![CDATA[
			=> $this->url->link('product/product', 'product_id=' . $product['product_id']),
			]]></search>
			<add><![CDATA[
			=> $this->url->link('product/product', 'product_id=' . $product['product_id'] . $href_auction),
			]]></add>
		</operation>

		<operation error="log" info="Redirect to Product page if Live Auction exists in AJAX Add-to-Cart control">
			<search position="before"><![CDATA[
			$product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (!is_null($this->config->get('config_auction_normal_sales'))) {
				$normal_sales = (int)$this->config->get('config_auction_normal_sales');
			} else {
				$normal_sales = 0;
			}
			$this->load->model('catalog/auction');
			$total_auctions = (int)$this->model_catalog_auction->getTotalLiveAuctionsByProductId($product_id, $auction_status_ids);
			if (!$normal_sales && $total_auctions) {
				$json['total_auctions'] = $total_auctions;
			}
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/module/cart.php">
		<operation error="log" info="New Auction texts for Mini-Cart">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']     = 'Won from an auction!';
			$_['text_auction_removal'] = 'Auction cannot be removed from the shopping cart.' . PHP_EOL . PHP_EOL . 'However it will be automatically discarded from your cart if payment is not received within %s days of winning.';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default2new/template/module/cart.tpl">
		<operation error="log" info="Display new Auction text in Mini-Cart">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			- <small><?php echo $text_auction_won; ?></small><br />
			<?php } ?>
			]]></add>
		</operation>

		<operation error="log" info="Disable removal of Product if won from Auction in Mini-Cart">
			<search position="replace"><![CDATA[
			<td class="remove"><img src="catalog/view/theme/default/image/remove-small.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" /></td>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<td class="remove"><img src="catalog/view/theme/default/image/auction.png" height="12" width="12" alt="<?php echo $text_auction_removal; ?>" title="<?php echo $text_auction_removal; ?>" /></td>
			<?php } else { ?>
			<td class="remove"><img src="catalog/view/theme/default/image/remove-small.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" onclick="(getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') ? location = 'index.php?route=checkout/cart&remove=<?php echo $product['key']; ?>' : $('#cart').load('index.php?route=module/cart&remove=<?php echo $product['key']; ?>' + ' #cart > *');" /></td>
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/module/cart.php">
		<operation error="log" info="Display controller for new Auction texts in Mini-Cart">
			<search position="before"><![CDATA[
			$this->data['text_empty'] = $this->language->get('text_empty');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			$this->data['text_auction_removal'] = sprintf($this->language->get('text_auction_removal'), $this->config->get('config_auction_payment_period') ? (string)$this->config->get('config_auction_payment_period') : '21');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction href in Mini-Cart">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			if ($product['auction_id']) {
				$href_auction = '&auction_id=' . $product['auction_id'];
			} else {
				$href_auction = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in Mini-Cart">
			<search position="before"><![CDATA[
			=> $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $product['auction_id'],
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Product-Auction link in Mini-Cart">
			<search position="replace"><![CDATA[=> $this->url->link('product/product', 'product_id=' . $product['product_id'])]]></search>
			<add><![CDATA[=> $this->url->link('product/product', 'product_id=' . $product['product_id'] . $href_auction)]]></add>
		</operation>
	</file>

	<file name="system/library/cart.php">
		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="before"><![CDATA[
			// Options
			]]></search>
			<add><![CDATA[
			// Auction
			if (!empty($product[1]) && is_int(unserialize(base64_decode($product[1]))) && !is_array(unserialize(base64_decode($product[1])))) {
				$auction_id = (int)unserialize(base64_decode($product[1]));
				$product[1] = NULL;
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="before"><![CDATA[
			$this->data[$key] = array(
			]]></search>
			<add><![CDATA[
			$price = ($price + $option_price);
			$total = ($price + $option_price) * $quantity;
			$minimum = $product_query->row['minimum'];
			$subtract = $product_query->row['subtract'];
			// Product Auction
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if ($auction_id) {
				$product_auction_query = $this->db->query("SELECT a.highest_bid_amount FROM " . DB_PREFIX . "auction a INNER JOIN " . DB_PREFIX . "product_auction pa ON (a.product_auction_id = pa.product_auction_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.auction_id = '" . (int)$auction_id . "' AND auction_status_id = '" . $auction_status_ids['won'] . "'");
				if ($product_auction_query->num_rows) {
					$price = (float)(string)((float)$product_auction_query->row['highest_bid_amount'] / (int)$quantity);
					$total = (float)$product_auction_query->row['highest_bid_amount'];
					$stock = true;		// auctions already deducted reserved quantity from stock, therefore stock check is not required
					$minimum = 0;		// auctions already deducted reserved quantity from stock, therefore mininum is not applicable
					$subtract = 0;		// auctions already deducted reserved quantity from stock, therefore subtract is not required
				}
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="before"><![CDATA[
			=> $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id'      => $auction_id,
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="replace"><![CDATA[=> ($price + $option_price),]]></search>
			<add><![CDATA[=> $price,]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="replace"><![CDATA[=> ($price + $option_price) * $quantity,]]></search>
			<add><![CDATA[=> $total,]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="replace"><![CDATA[=> $product_query->row['minimum'],]]></search>
			<add><![CDATA[=> $minimum,]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Cart management">
			<search position="replace"><![CDATA[=> $product_query->row['subtract'],]]></search>
			<add><![CDATA[=> $subtract,]]></add>
		</operation>

		<operation error="log" info="Add new Auction elements in Library Add-to-Cart management">
			<search position="replace"><![CDATA[
			if (!isset($this->session->data['cart'][$key])) {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (!is_null($this->config->get('config_auction_normal_sales'))) {
				$normal_sales = (int)$this->config->get('config_auction_normal_sales');
			} else {
				$normal_sales = 0;
			}
			$auction_query = $this->db->query("SELECT a.auction_id FROM " . DB_PREFIX . "auction a INNER JOIN " . DB_PREFIX . "product_auction pa ON (a.product_auction_id = pa.product_auction_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.auction_status_id IN ('" . (int)$auction_status_ids['inprogress'] . "', '" . (int)$auction_status_ids['extended'] . "')");
			if (!empty($option) && is_int($option) && !is_array($option)) {
				$this->session->data['cart'][$key] = (int)$qty;		// option is an auction_id, this key is a won-auction
			} elseif (!$normal_sales && $auction_query->num_rows) {
				$this->remove($key);								// add-to-cart not allowed if live auction exists
			} elseif (!isset($this->session->data['cart'][$key])) {
			]]></add>
		</operation>
	</file>

	<file name="system/library/customer.php">
		<operation error="log" info="Add new Auction Cart management elements during Customer login session">
			<search position="before" index="1"><![CDATA[
			$this->db->query("UPDATE " . DB_PREFIX . "customer SET cart =
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if ($customer_query->row['cart'] && is_string($customer_query->row['cart'])) {
				$cart = unserialize($customer_query->row['cart']);
				foreach ($cart as $key => $value) {
					$product = explode(':', $key);
					if (!empty($product[1]) && is_int(unserialize(base64_decode($product[1]))) && !is_array(unserialize(base64_decode($product[1])))) {
						$auction_query = $this->db->query("SELECT auction_id FROM " . DB_PREFIX . "auction WHERE auction_id = '" . (int)unserialize(base64_decode($product[1])) . "' AND auction_status_id = '" . (int)$auction_status_ids['won'] . "'");
						if ($auction_query->num_rows) {
							$this->session->data['cart'][$key] = $value;		// persistent inclusion of won-auctions in customer cart
						}
					}
				}
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction Cart management elements when Customer login">
			<search position="replace"><![CDATA[
			if (!array_key_exists($key, $this->session->data['cart'])) {
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			$product = explode(':', $key);
			if (!empty($product[1]) && is_int(unserialize(base64_decode($product[1]))) && !is_array(unserialize(base64_decode($product[1])))) {
				$auction_query = $this->db->query("SELECT auction_id FROM " . DB_PREFIX . "auction WHERE auction_id = '" . (int)unserialize(base64_decode($product[1])) . "' AND auction_status_id = '" . (int)$auction_status_ids['won'] . "'");
				if ($auction_query->num_rows) {
					$this->session->data['cart'][$key] = $value;		// option is an auction_id, this key is a won-auction
				}
			} elseif (!array_key_exists($key, $this->session->data['cart'])) {
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/checkout/checkout.php">
		<operation error="log" info="New Auction texts for Checkout Confirmation">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']     = 'Won from an auction!';
			$_['text_auction_removal'] = 'This product is automatically added via a winning auction.' . PHP_EOL . PHP_EOL . 'It will be automatically discarded from your cart if payment is not received within %s days of winning.';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/checkout/confirm.tpl">
		<operation error="log" info="Display new Auction text in Checkout Confirmation">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="catalog/view/theme/default/image/auction.png" height="12" width="12" alt="<?php echo $text_auction_removal; ?>" title="<?php echo $text_auction_removal; ?>" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/checkout/confirm.php">
		<operation error="log" info="Display controller for new Auction texts in Checkout Confirmation">
			<search position="before"><![CDATA[
			$this->data['column_name'] = $this->language->get('column_name');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			$this->data['text_auction_removal'] = sprintf($this->language->get('text_auction_removal'), $this->config->get('config_auction_payment_period') ? (string)$this->config->get('config_auction_payment_period') : '21');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction href in Checkout Confirmation">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			if ($product['auction_id']) {
				$href_auction = '&auction_id=' . $product['auction_id'];
			} else {
				$href_auction = '';
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in Checkout Confirmation">
			<search position="before"><![CDATA[
			=> $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $product['auction_id'],
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Product-Auction link in Checkout Confirmation">
			<search position="replace"><![CDATA[=> empty( $product_info['status'] ) ? 'javascript:void(0);' : $this->url->link('product/product', 'product_id=' . $product['product_id'])]]></search>
			<add><![CDATA[=> empty( $product_info['status'] ) ? 'javascript:void(0);' : $this->url->link('product/product', 'product_id=' . $product['product_id'] . $href_auction)]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/payment/pp_standard.php">
		<operation error="log" info="New Auction texts for PayPal Standard (at PayPal page)">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_id'] = 'Auction ID';
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/payment/pp_standard.php">
		<operation error="log" info="I/O controller for new Auction data in PayPal Standard (at PayPal page)">
			<search position="before"><![CDATA[
			foreach ($product['option'] as $option) {
			]]></search>
			<add><![CDATA[
			if ($product['auction_id']) {
				$option_data[] = array(
					'name'  => $this->language->get('text_auction_id'),
					'value' => '#' . $product['auction_id']
				);
			}
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/payment/amazon_checkout.php" error="skip">
		<operation error="log" info="New Auction texts for Amazon Checkout - 1.5.6 onwards">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won'] = 'Won from an auction!';
			$_['text_auction_removal'] = 'This product is automatically added via a winning auction.' . PHP_EOL . PHP_EOL . 'It will be automatically discarded from your cart if payment is not received within %s days of winning.';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/payment/amazon_checkout_confirm.tpl" error="skip">
		<operation error="log" info="Display new Auction text in Amazon Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="catalog/view/theme/default/image/auction.png" height="12" width="12" alt="<?php echo $text_auction_removal; ?>" title="<?php echo $text_auction_removal; ?>" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/payment/amazon_checkout.php" error="skip">
		<operation error="log" info="Display controller for new Auction texts in Amazon Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			$this->data['column_name'] = $this->language->get('column_name');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			$this->data['text_auction_removal'] = sprintf($this->language->get('text_auction_removal'), $this->config->get('config_auction_payment_period') ? (string)$this->config->get('config_auction_payment_period') : '21');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in Amazon Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			'option' => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $product['auction_id'],
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/payment/pp_express.php" error="skip">
		<operation error="log" info="New Auction texts for PayPal Express Checkout - 1.5.6 onwards">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']              = 'Won from an auction!';
			$_['text_auction_removal']          = 'This product is automatically added via a winning auction.' . PHP_EOL . PHP_EOL . 'It will be automatically discarded from your cart if payment is not received within %s days of winning.';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/payment/pp_express_confirm.tpl" error="skip">
		<operation error="log" info="Display new Auction text in PayPal Express Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="catalog/view/theme/default/image/auction.png" height="12" width="12" alt="<?php echo $text_auction_removal; ?>" title="<?php echo $text_auction_removal; ?>" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/payment/pp_express.php" error="skip">
		<operation error="log" info="Display controller for new Auction texts in PayPal Express Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			$this->data['column_name'] = $this->language->get('column_name');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			$this->data['text_auction_removal'] = sprintf($this->language->get('text_auction_removal'), $this->config->get('config_auction_payment_period') ? (string)$this->config->get('config_auction_payment_period') : '21');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in PayPal Express Checkout - 1.5.6 onwards">
			<search position="before"><![CDATA[
			'option' => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $product['auction_id'],
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/mail/order.php">
		<operation error="log" info="New Auction texts for Order Mail">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']     = 'Won from an auction!';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/mail/order.tpl">
		<operation error="log" info="Display new Auction text in HTML Order Mail">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="<?php echo $image_url; ?>catalog/view/theme/default/image/auction.png" height="12" width="12" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/model/checkout/order.php">
		<operation error="log" info="Add new Auction Order insert model when creating new Order">
			<search position="before"><![CDATA[
			foreach ($product['option'] as $option) {
			]]></search>
			<add><![CDATA[
			if ($product['auction_id']) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "order_auction SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_id = '" . (int)$product['product_id'] . "', auction_id = '" . (int)$product['auction_id'] . "'");
			}
			]]></add>
		</operation>

		<operation error="log" info="Add new Auction update model when updating Product Quantity">
			<search position="replace"><![CDATA[
			$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			$order_auction_query = $this->db->query("SELECT order_auction_id, auction_id FROM " . DB_PREFIX . "order_auction WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product['order_product_id'] . "'");
			if ($order_auction_query->num_rows) {
				$this->db->query("UPDATE " . DB_PREFIX . "auction SET auction_status_id = '" . $auction_status_ids['sold'] . "', order_auction_id = '" . (int)$order_auction_query->row['order_auction_id'] . "', date_modified = '" . date('Y-m-d H:i:s') . "' WHERE auction_id = '" . (int)$order_auction_query->row['auction_id'] . "' AND auction_status_id = '" . $auction_status_ids['won'] . "'");
			} else {
				$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");
			}
			]]></add>
		</operation>

		<operation error="log" info="Display controller for new Auction text in HTML Order Mail">
			<search position="after"><![CDATA[
			$template->data['text_powered'] = $language->get('text_new_powered');
			]]></search>
			<add><![CDATA[
			$template->data['text_auction_won'] = $language->get('text_auction_won');
			if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
				$template->data['image_url'] = HTTPS_SERVER;
			} else {
				$template->data['image_url'] = HTTP_SERVER;
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in HTML Order Mail">
			<search position="before"><![CDATA[
			$template->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			$order_auction_query = $this->db->query("SELECT auction_id FROM " . DB_PREFIX . "order_auction WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'");
			if ($order_auction_query->num_rows) {
				$auction_id = (int)$order_auction_query->row['auction_id'];
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in HTML Order Mail">
			<search position="before"><![CDATA[
			'option'   => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $auction_id,
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data in Text Order Mail and Admin Alert Mail">
			<search position="after"><![CDATA[
			$text .= $product['quantity'] . 'x ' . $product['name']
			]]></search>
			<add><![CDATA[
			$order_auction_query = $this->db->query("SELECT auction_id FROM " . DB_PREFIX . "order_auction WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'");
			if ($order_auction_query->num_rows) {
				$text .= chr(9) . '-' . $language->get('text_auction_won') . "\n";
			}
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/account/order.php">
		<operation error="log" info="New Auction text for Account Order Info">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction_won']     = 'Won from an auction!';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/account/order_info.tpl">
		<operation error="log" info="Display new Auction text in Account Order Info">
			<search position="before"><![CDATA[
			<?php foreach ($product['option'] as $option) { ?>
			]]></search>
			<add><![CDATA[
			<?php if ($product['auction_id']) { ?>
			<br />
			&nbsp;<small> - <?php echo $text_auction_won; ?></small>&nbsp;&nbsp;<img src="catalog/view/theme/default/image/auction.png" height="12" width="12" />
			<?php } ?>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/account/order.php">
		<operation error="log" info="Skip Product if Live Auction exists in Account Order Reorder">
			<search position="before"><![CDATA[
			$this->cart->add($order_product['product_id'], $order_product['quantity'], $option_data);
			]]></search>
			<add><![CDATA[
			if ($this->config->get('config_auction_status_id') && is_array($this->config->get('config_auction_status_id'))) {
				$auction_status_ids = $this->config->get('config_auction_status_id');
			} else {
				$auction_status_ids = array('starting' => 1, 'relisting' => 2, 'inprogress' => 3, 'extended' => 4, 'won' => 5, 'expired' => 6, 'sold' => 7, 'voided' => 8);
			}
			if (!is_null($this->config->get('config_auction_normal_sales'))) {
				$normal_sales = (int)$this->config->get('config_auction_normal_sales');
			} else {
				$normal_sales = 0;
			}
			$this->load->model('catalog/auction');
			$total_auctions = (int)$this->model_catalog_auction->getTotalLiveAuctionsByProductId($order_product['product_id'], $auction_status_ids);
			if (!$normal_sales && $total_auctions) {
				continue;
			}
			]]></add>
		</operation>

		<operation error="log" info="Display controller for new Auction text in Account Order Info">
			<search position="before"><![CDATA[
			$this->data['column_name'] = $this->language->get('column_name');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction_won'] = $this->language->get('text_auction_won');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for Account Order Info">
			<search position="before"><![CDATA[
			$this->data['products'][] = array(
			]]></search>
			<add><![CDATA[
			$this->load->model('account/auction');
			$order_auction = $this->model_account_auction->getOrderAuction($this->request->get['order_id'], $product['order_product_id']);
			if ($order_auction) {
				$auction_id = (int)$order_auction['auction_id'];
			} else {
				$auction_id = 0;
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for Account Order Info">
			<search position="before"><![CDATA[
			'option'   => $option_data,
			]]></search>
			<add><![CDATA[
			'auction_id' => $auction_id,
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/account/account.php">
		<operation error="log" info="New Auction text for My Account">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction']       = 'Your Auction History';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default/template/account/account.tpl">
		<operation error="log" info="Display new Auction text in My Account">
			<search position="before"><![CDATA[
			<li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
			]]></search>
			<add><![CDATA[
			<li><a href="<?php echo $auction; ?>"><?php echo $text_auction; ?></a></li>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/account/account.php">
		<operation error="log" info="Display controller for new Auction text in My Account">
			<search position="before"><![CDATA[
			$this->data['text_order'] = $this->language->get('text_order');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction'] = $this->language->get('text_auction');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for My Account">
			<search position="before"><![CDATA[
			$this->data['order'] = $this->url->link('account/order', '', 'SSL');
			]]></search>
			<add><![CDATA[
			$this->data['auction'] = $this->url->link('account/auction', '', 'SSL');
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/module/account.php">
		<operation error="log" info="New Auction text for My Account Module">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_auction']     = 'Auction History';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default2new/template/module/account.tpl">
		<operation error="log" info="Display new Auction text in My Account Module">
			<search position="before"><![CDATA[
			<li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
			]]></search>
			<add><![CDATA[
			<li><a href="<?php echo $auction; ?>"><?php echo $text_auction; ?></a></li>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/module/account.php">
		<operation error="log" info="Display controller for new Auction text in My Account Module">
			<search position="before"><![CDATA[
			$this->data['text_order'] = $this->language->get('text_order');
			]]></search>
			<add><![CDATA[
			$this->data['text_auction'] = $this->language->get('text_auction');
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction data for My Account Module">
			<search position="before"><![CDATA[
			$this->data['order'] = $this->url->link('account/order', '', 'SSL');
			]]></search>
			<add><![CDATA[
			$this->data['auction'] = $this->url->link('account/auction', '', 'SSL');
			]]></add>
		</operation>
	</file>

	<file name="catalog/language/english/common/header.php">
		<operation error="log" info="New Auction menu text for Common Header">
			<search position="after"><![CDATA[
			// Text
			]]></search>
			<add><![CDATA[
			$_['text_live_auction']   = 'Live Auctions';
			]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/default2new/template/common/header.tpl">
		<operation error="log" info="Display new Auction menu text in Common Header">
			<search position="before"><![CDATA[
			<div id="notification"></div>
			]]></search>
			<add><![CDATA[
			<script type="text/javascript"><!--
			$('.links a').eq(2).after('<a href="<?php echo $live_auctions; ?>"><?php echo $text_live_auction; ?></a>');
			//--></script>
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/common/header.php">
		<operation error="log" info="Display controller for new Auction menu text in Common Header">
			<search position="before"><![CDATA[
			$this->data['home'] = $this->url->link('common/home');
			]]></search>
			<add><![CDATA[
			$this->data['text_live_auction'] = $this->language->get('text_live_auction');
			$this->data['live_auctions'] = $this->url->link('product/auction');
			]]></add>
		</operation>
	</file>

	<file name="catalog/controller/common/seo_url.php">
		<operation error="log" info="I/O controller for new Auction elements in SEO URL Rewrite">
			<search position="before"><![CDATA[
			if ($url[0] == 'category_id') {
			]]></search>
			<add><![CDATA[
			if ($url[0] == 'auction_id') {
				$this->request->get['auction_id'] = $url[1];
			}
			]]></add>
		</operation>

		<operation error="log" info="I/O controller for new Auction elements in SEO URL Rewrite">
			<search position="before"><![CDATA[
			} elseif ($key == 'path') {
			]]></search>
			<add><![CDATA[
			} elseif ($data['route'] == 'product/product' && $key == 'auction_id') {
				$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
				if ($query->num_rows) {
					$url .= '/' . $query->row['keyword'];
					unset($data[$key]);
				}
			]]></add>
		</operation>
	</file>

	<file name="admin/model/localisation/language.php">
		<operation error="log" info="Duplicate from default language pack for Auction related descriptions when adding a new Language">
			<search position="before"><![CDATA[
			// Product Attribute
			]]></search>
			<add><![CDATA[
			// Product Auction
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_auction_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
			foreach ($query->rows as $product_auction_description) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "product_auction_description SET product_auction_id = '" . (int)$product_auction_description['product_auction_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($product_auction_description['name']) . "'");
			}
			// Auction Status
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "auction_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
			foreach ($query->rows as $auction_status) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "auction_status SET auction_status_id = '" . (int)$auction_status['auction_status_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($auction_status['name']) . "'");
			}
			// Auction Bid Status
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "auction_bid_status WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
			foreach ($query->rows as $auction_bid_status) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "auction_bid_status SET auction_bid_status_id = '" . (int)$auction_bid_status['auction_bid_status_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($auction_bid_status['name']) . "'");
			}
			]]></add>
		</operation>

		<operation error="log" info="Delete language pack for Auction related descriptions when deleting an existing Language">
			<search position="before"><![CDATA[
			$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE language_id = '" . (int)$language_id . "'");
			]]></search>
			<add><![CDATA[
			$this->db->query("DELETE FROM " . DB_PREFIX . "product_auction_description WHERE language_id = '" . (int)$language_id . "'");
			$this->db->query("DELETE FROM " . DB_PREFIX . "auction_status WHERE language_id = '" . (int)$language_id . "'");
			$this->db->query("DELETE FROM " . DB_PREFIX . "auction_bid_status WHERE language_id = '" . (int)$language_id . "'");
			]]></add>
		</operation>
	</file>

	<file name="system/library/currency.php">
		<operation error="log" info="Enhance existing Currency formatting by adding a decimal-rounding up or down feature, essential for multi-currency Auctions">
			<search position="replace"><![CDATA[
			public function format($number, $currency = '', $value = '', $format = true) {
			]]></search>
			<add><![CDATA[
			public function format($number, $currency = '', $value = '', $format = true, $round = '') {
			]]></add>
		</operation>

		<operation error="log" info="Enhance existing Currency formatting by adding a decimal-rounding up or down feature, essential for multi-currency Auctions">
			<search position="before"><![CDATA[
			$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
			]]></search>
			<add><![CDATA[
			if ($round == 'up') {
				$value = (float)(string)(ceil((float)$value * pow(10, (int)$decimal_place)) / pow(10, (int)$decimal_place));
			} elseif ($round == 'down') {
				$value = (float)(string)(floor((float)$value * pow(10, (int)$decimal_place)) / pow(10, (int)$decimal_place));
			}
			]]></add>
		</operation>
	</file>

</modification>