<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<name>Fit Models and part numbers</name>
    <code>Fit_Models_Part_Numbers</code>
    <version>2.0</version>
    <author>kenny li</author>

	<file path="system/startup.php">
		<operation error="skip">
			<search><![CDATA[error_reporting(E_ALL);]]></search>
			<add position="after"><![CDATA[
			/* fit models function() */
			function MakeURLSafe($val)
			{
				$val = str_replace("-", "{2d}", $val);
				$val = str_replace("+", "{46}", $val);
				$val = str_replace("+", "{46}", $val);
				$val = str_replace("/", "{47}", $val);
				$val = str_replace("'", "{48}", $val);
				$val = str_replace('"', "{49}", $val);
				$val = str_replace('(', "{50}", $val);
				$val = str_replace(')', "{51}", $val);
				$val = str_replace('#', "{52}", $val);
				$val = urlencode($val);
				$val = str_replace("+", "-", $val);
				return $val;
			}
			
				function MakeURLNormal($val)
			{
				$val = str_replace("-", " ", $val);
				$val = urldecode($val);
				$val = str_replace("{46}", "+", $val);
				$val = str_replace("{47}", "/", $val);
				$val = str_replace("{48}", "'", $val);
				$val = str_replace('{49}', '"', $val);
				$val = str_replace('{50}', '(', $val);
				$val = str_replace('{51}', ')', $val);
				$val = str_replace('{52}', '#', $val);
				$val = str_replace("{2d}", "-", $val);
				$val = str_replace("%2b", "+", $val);
				return $val;
			}
	
			/* Product Review Pro Ends */
			]]></add>
		</operation>
	</file>
	
	
	
		<file path="catalog/controller/startup/seo_url.php">
		<operation error="skip">
			<search><![CDATA[if (!isset($this->request->get['route'])) {]]></search>
			<add position="before"><![CDATA[
			/* fit models seo url */
			
			$regex = '/^(.*)-([0-9]+)\.html$/i'; 	
			
			if (preg_match($regex, $this->request->get['_route_'], $arr_1)) { 
				$this->request->get['modelbattery']=$arr_1[1];
				$p_id = str_replace(".html","",$arr_1[2]);
				$this->request->get['product_id'] = $p_id;
				//$this->request->get['route'] = 'product_id='.$p_id;	
				$this->request->get['route'] = 'product/product';				

				
			}
			
 
			/* Product seo url */
			]]></add>
		</operation>
	</file>


	<file path="admin/view/template/catalog/product_form.twig">
			<operation error="skip">
					<search><![CDATA[<li><a href="#tab-data" data-toggle="tab">{{ tab_data }}</a></li>]]></search>
					<add position="before"><![CDATA[
					 <li><a href="#tab-data-fitmodels" data-toggle="tab">FitModels</a></li>
					]]></add>
			</operation>
		
		<operation>
			<search><![CDATA[<div class="tab-pane" id="tab-data">]]></search>
			<add position="before"><![CDATA[
			<div class="tab-pane" id="tab-data-fitmodels">{% for language in languages %}
                  <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-extratitle{{ language.language_id }}">Extra Title for Seo </label>
                    <div class="col-sm-10">
         					  
					  <input type="text" name="product_description[{{ language.language_id }}][extratitle]" value="{{ product_description[language.language_id] ? product_description[language.language_id].extratitle }}" placeholder="{{ entry_extratitle }}" id="input-name{{ language.language_id }}" class="form-control" />
					  
                    </div>
                  </div>
				  
				  <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-seo-description{{ language.language_id }}">SEO EXTRA DESCRIPTION</label>
                    <div class="col-sm-10">
                      <textarea name="product_description[{{ language.language_id }}][seo_description]" placeholder="{{ entry_seo_description }}" id="input-seo-description{{ language.language_id }}"  data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].seo_description }}</textarea>
                    </div>
                  </div>
				  
				  
				  <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-partno{{ language.language_id }}">Partno</label>
                    <div class="col-sm-10">
                      <textarea name="product_description[{{ language.language_id }}][partno]" rows="5" placeholder="{{ entry_partno }}" id="input-partno{{ language.language_id }}"  class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].partno }}</textarea>
                    </div>
                  </div>
				   <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-fitmodel{{ language.language_id }}">Fitmodels</label>
                    <div class="col-sm-10">
                      <textarea name="product_description[{{ language.language_id }}][fitmodel]" rows="5" placeholder="{{ entry_fitmodel }}" id="input-fitmodel{{ language.language_id }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].fitmodel }}</textarea>
                    </div>
                  </div>
				  
			  
			{% endfor %}</div>
			]]></add>
		</operation>
	</file>
	
	
	<!-- seo fitmodels ends -->
</modification>