<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id><![CDATA[Suspension Notice]]></id>
    <version><![CDATA[1.0]]></version>
    <vqmver><![CDATA[]]></vqmver>
    <author><![CDATA[Jason Aguilar - Wed, September 3 2014]]></author>

    <file name="admin/controller/catalog/product.php">
        <operation>
            <search position="before"><![CDATA[
                if (isset($this->request->post['location'])) {
                ]]></search>
            <add><![CDATA[// Core Charge Plugin
                if (isset($this->request->post['suspensionnotice'])) {
                    $this->data['suspensionnotice'] = $this->request->post['suspensionnotice'];
                } else if (isset($product_info)) {
                    $this->data['suspensionnotice'] = $product_info['suspensionnotice'];
                } else {
                    $this->data['suspensionnotice'] = '';
                }
                ]]></add>
        </operation>
    </file>

    <file name="admin/model/catalog/product.php">

        <operation>
            <search position="replace"><![CDATA[
            price = '" . (float)$data['price'] . "',
            ]]></search>
            <add><![CDATA[
          price = '" . (float)$data['price'] . "', suspensionnotice = '" . $this->db->escape($data['suspensionnotice']) . "',
            ]]></add>
        </operation>

    </file>


    <file name="admin/view/template/catalog/product_form.tpl">

        <operation>
            <search position="replace"><![CDATA[
            <td><?php echo $entry_store; ?></td>
            ]]></search>
            <add><![CDATA[
          <td>Add Suspension Notice?:</td>
            <td>
            <div class="exelioradio">
            <label><input type="radio" name="sn" id="snexel1" value="Yes" <?php if ($suspensionnotice == 'Yes') { ?> checked="checked" <?php } ?>> Yes</label>
            <label><input type="radio" name="sn" id="snexel2" value="No" <?php if ($suspensionnotice != 'Yes') { ?> checked="checked" <?php } ?>> No</label>
            <?php echo $suspensionnotice; ?>
            </div>

            <input style="display:none;" type="text" name="suspensionnotice" id="suspensionnotice" value="<?php echo $suspensionnotice; ?>" />
            </td>
            </tr>
            <script type="text/javascript">
            $(document).ready(function(){

            $('input[name=sn]:radio').change(function () {
            if ($(this).val() == "Yes") {
                // Disable your roomnumber element here
                $('#suspensionnotice').val('Yes');
            } else {
                // Re-enable here I guess
                $('#suspensionnotice').val('No');
            }
            });
            });
            </script>
            <tr>
            <td><?php echo $entry_store; ?></td>        
        ]]></add>
        </operation>
    </file>
  

    <file name="catalog/controller/product/product.php">

        <operation info="Add Query to Cart File">
            <search position="before"><![CDATA[
            $this->data['average'] = $average;
            ]]></search>
            <add><![CDATA[
            $this->data['suspensionnotice'] = $product_info['suspensionnotice'];
            ]]></add>
        </operation>

        <operation info="Add Query to Cart File">
            <search position="after"><![CDATA[
            'rating'        => $rating,
            ]]></search>
            <add><![CDATA[
            'suspensionnotice'            => $suspensionnotice,
            ]]></add>
        </operation>
        
    </file>


    <file name="catalog/view/theme/default/template/product/product.tpl">

        <operation info="Add Query to Cart File">
            <search position="before"><![CDATA[
            <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
            ]]></search>
            <add><![CDATA[
            <?php if($product_info['suspensionnotice'] == 'Yes') { ?>
            <span style="font-size: 77%;">Note: By purchasing this product you understand that altering the original suspension of the vehicle may alter the ride and handling of the vehicle. You also understand that lowering the vehicle will reduce wheel travel which will alter the way the vehicle handles. This will also have an affect on the overall ride quality.</span>
            <br />
            <?php } ?>
            </div>
            <div>
            ]]></add>
        </operation>
    </file>

</modification>