<?xml version="1.0" encoding="utf-8"?>
<modification>
	<name>Order Status Color</name>
	<version>1.5</version>
	<code>ocxosc15</code>
	<author>OC-Extensions.com</author>
	<link>http://www.oc-extensions.com/Order-Status-Color</link>

	<file path="admin/model/sale/order.php">
		<operation>
			<search><![CDATA[SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer,]]></search>
			<add position="replace"><![CDATA[SELECT o.order_id, o.order_status_id, CONCAT(o.firstname, ' ', o.lastname) AS customer,]]></add>
		</operation>
	</file>
	
	<file path="admin/controller/dashboard/recent.php">
		<operation>
			<search><![CDATA['status'     => $result['status'],]]></search>
			<add position="after"><![CDATA['order_status_id'   => $result['order_status_id'],]]></add>
		</operation>
		
		<operation>
			<search><![CDATA[$data['token'] = $this->session->data['token'];]]></search>
			<add position="after"><![CDATA[
			$this->load->model('module/order_status_color');
			
			$data['order_status_colors'] = $this->model_module_order_status_color->processSettings();
			
			$data['order_status_colors_behaviour'] = $this->config->get('order_status_color_behaviour');
			]]></add>
		</operation> 
	</file>
	
	<file path="admin/view/template/dashboard/recent.tpl">
		<operation>
			<search><![CDATA[<td><?php echo $order['status']; ?></td>]]></search>
			<add position="replace"><![CDATA[
			<?php if (isset($order_status_colors[$order['order_status_id']])) { ?>
			<?php if ($order_status_colors_behaviour) { ?>
			<td><span style="padding: 5px 15px; background-color:<?php echo $order_status_colors[$order['order_status_id']]['background_color']; ?>; color: <?php echo $order_status_colors[$order['order_status_id']]['text_color']; ?>; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;"><?php echo $order['status']; ?></span></td>
			<?php } else { ?>
			<td style="background-color:<?php echo $order_status_colors[$order['order_status_id']]['background_color']; ?>; color: <?php echo $order_status_colors[$order['order_status_id']]['text_color']; ?>;"><?php echo $order['status']; ?></td>
			<?php } ?>
			<?php } else { ?>
			<td><?php echo $order['status']; ?></td>
			<?php } ?>
			]]></add>
		</operation>
	</file>
	
	<file path="admin/controller/sale/order.php">
		<operation>
			<search><![CDATA['status'        => $result['status'],]]></search>
			<add position="after"><![CDATA['order_status_id'      => $result['order_status_id'],]]></add>
		</operation>
		
		<operation>
			<search><![CDATA[$this->response->setOutput($this->load->view('sale/order_list.tpl', $data));]]></search>
			<add position="before"><![CDATA[
			$this->load->model('module/order_status_color');
			
			$data['order_status_colors'] = $this->model_module_order_status_color->processSettings();
			
			$data['order_status_colors_behaviour'] = $this->config->get('order_status_color_behaviour');
			]]></add>
		</operation> 
	</file>
	
	<file path="admin/view/template/sale/order_list.tpl">
		<operation>
			<search><![CDATA[<td class="text-left"><?php echo $order['status']; ?></td>]]></search>
			<add position="replace"><![CDATA[
			<?php if (isset($order_status_colors[$order['order_status_id']])) { ?>
			<?php if ($order_status_colors_behaviour) { ?>
			<td class="text-left"><span style="padding: 5px 15px; background-color:<?php echo $order_status_colors[$order['order_status_id']]['background_color']; ?>; color: <?php echo $order_status_colors[$order['order_status_id']]['text_color']; ?>; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;"><?php echo $order['status']; ?></span></td>
			<?php } else { ?>
			<td class="text-left" style="background-color:<?php echo $order_status_colors[$order['order_status_id']]['background_color']; ?>; color: <?php echo $order_status_colors[$order['order_status_id']]['text_color']; ?>;"><?php echo $order['status']; ?></td>
			<?php } ?>
			<?php } else { ?>
			<td class="text-left"><?php echo $order['status']; ?></td>
			<?php } ?>
			]]></add>
		</operation>
	</file>
</modification>