Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Добавить возможность вывода модуля в стандартном модуле featured (рекомендуемые) на платной основе


Recommended Posts

Здравствуйте.

Есть такой модуль https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=31938

 

К сожалению его автор куда то пропал...

 

Модуль работает как надо, проблем нету. Но нужно его вывести на странице модуля рекомендуемых где будут несколько товаров. Судя по модификатору он заточен только на страницу товара.

 

код контроллера:

Прихований текст
<modification>
    	<name>Product Size Option</name>
	<version><![CDATA[1.5.2]]></version>
    	<author>WeDoWeb</author>
    	<link>http://wedoweb.com.au</link>
	<code>product_size_option</code>	
	<file path="admin/controller/catalog/option.php">
		<!-- assign title Size -->
		<operation>
            <search position="after"><![CDATA[$data['footer']]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				$this->load->language('extension/module/option_size');
				$data['text_size'] = $this->language->get('text_size');
				$data['entry_scale_with_size'] = $this->language->get('entry_scale_with_size');
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<!-- Assign list option production -->
		<operation>
            <search position="after"><![CDATA[$data['placeholder']]]></search>
            <add position="after" trim="true"><![CDATA[	
				//BOF Product Size Option
				$table_exist = $this->model_catalog_option->table_exist('option_value_size');
				$data['all_options'] = array();
				$optionSize = array();
				if ($table_exist) {
					$data['all_options'] = $this->model_catalog_option->getOptions();
					$allOptionSize = $this->model_catalog_option->getAllOptionSize();
					if(!empty($allOptionSize)) {
						foreach($allOptionSize as $key => $sizeValue) {
							$optionSize[] = $sizeValue['option_id'];
						}
					}
				}
				$data['optionSize'] = $optionSize;
				$data['scalable_options'] = array('select', 'radio', 'checkbox', 'image');
				$data['module_active'] = $table_exist;
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
    
	<file path="admin/view/template/catalog/option_form.twig">
	    <!-- add option size to combobox type -->
		<operation>
            <search position="after" trim="true"><![CDATA[<optgroup label="{{ text_input }}">]]></search>
            <add position="after" trim="true"><![CDATA[
				<!--BOF Product Size Option-->
				{% if module_active %}    	
					{% if type == 'size' %}
						<option value="size" selected>{{ text_size }}</option>
					{% else %}
						<option value="size">{{ text_size }}</option>
					{% endif %}
				{% endif %}
				<!--EOF Product Size Option-->
            ]]></add>
        </operation>
        
		<!-- add option size to combobox type -->
		<operation>
            <search position="after" index='0'><![CDATA[<script type="text/javascript"><!--]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				if($('select[name=\'type\']').val() == 'size') {
					$('#option-value').hide();
					$("#scale-with-size-setting").show();
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<!-- add option size to combobox type -->
		<operation>
            <search position="after" index='0'><![CDATA[$('select[name=\'type\']').on('change', function() {]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				if (this.value == 'size'){
					$("#scale-with-size-setting").show();
					$('#option-value').hide();
				}
				else
				{
					$("#scale-with-size-setting").hide();
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
            <search position="before"><![CDATA[</form>]]></search>
            <add position="before" trim="true"><![CDATA[
				<!--BOF Product Size Option-->
				<div class="form-group" id="scale-with-size-setting">
					<label for="input-sort-order" class="col-sm-2 control-label">{{ entry_scale_with_size }}</label>
					<div class="col-sm-10">
						<div style="height: 150px; overflow: auto;" class="well well-sm">
						{% for option in all_options %}
							{% if option.type in scalable_options %}
								<div class="checkbox">
								{% if option.option_id in optionSize %}
									<label>
										<input type="checkbox" checked="checked" name="option_size[{{ option.option_id }}]" value="{{ option.option_id }}">
										{{ option.name }}
									</label>
								{% else %}
									<label>
										<input type="checkbox" name="option_size[{{ option.option_id }}]" value="{{ option.option_id }}">
										{{ option.name }}
									</label>
								{% endif %}
								</div>
							{% endif %}
						{% endfor %}						
						</div>
					</div>
				</div>
				<!--EOF Product Size Option-->
            ]]></add>
        </operation>
    </file>
    
	<file path="admin/model/catalog/option.php">
		<!-- Create table option size -->
		<operation>
            <search position="before"><![CDATA[function addOption($data)]]></search>
            <add position="before" trim="true"><![CDATA[
				//BOF Product Size Option
				public function table_exist($table_name){
					$query = $this->db->query("SHOW TABLES LIKE '" . DB_PREFIX . $table_name . "'");
					$result = $query->rows;
					return sizeof($result) > 0;
				}
				public function getAllOptionSize() {
					$sql = "SELECT * FROM " . DB_PREFIX . "option_value_size";
					$query = $this->db->query($sql);
					
					return $query->rows;
				}
				//BOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
            <search position="before" index='0'><![CDATA[if (isset($data['option_value'])) {]]></search>
            <add position="before" trim="true"><![CDATA[
				//BOF Product Size Option
				if (isset($data['option_size'])) {
					$this->db->query("DELETE FROM `" . DB_PREFIX . "option_value_size` WHERE option_size_id = '" . (int)$option_id . "'");
					foreach ($data['option_size'] as $option_size) {
						$this->db->query("INSERT INTO " . DB_PREFIX . "option_value_size SET option_size_id = '" . (int)$option_id . "', option_id = '" . (int)$option_size . "'");
					}
				}
				//eOF Product Size Option
            ]]></add>			
        </operation>
        
        <operation>
            <search position="after" index='0'><![CDATA[
				public function editOption($option_id, $data) {
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				if (isset($data['option_size'])) {
					$this->db->query("DELETE FROM `" . DB_PREFIX . "option_value_size` WHERE option_size_id = '" . (int)$option_id . "'");
					foreach ($data['option_size'] as $option_size) {
						$this->db->query("INSERT INTO " . DB_PREFIX . "option_value_size SET option_size_id = '" . (int)$option_id . "', option_id = '" . (int)$option_size . "'");
					}
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
    
	<file path="admin/view/template/catalog/product_form.twig">
		<!-- Create table option size -->
		<operation>
            <search position="before"><![CDATA[{% if product_option.type == 'select']]></search>
            <add position="before" trim="true"><![CDATA[
				<!--BOF Product Size Option-->
				{% if (product_option.type == 'size') %}
				<div class="form-group required">
					<label class="col-sm-2 control-label">{{ entry_width }}</label>
					<div class="col-sm-10">					
						<div class="row">						
							<div class="col-sm-6">
								<input type="text" class="form-control" placeholder="{{ entry_min }}" name="product_option[{{ option_row }}][min_width]" value="{{ product_option['min_width'] }}" />
							</div>
							<div class="col-sm-6">
								<input type="text" class="form-control" placeholder="{{ entry_max }}" name="product_option[{{ option_row }}][max_width]" value="{{ product_option['max_width'] }}" />
							</div>
						</div>
					</div>
				</div>
				<div class="form-group required">
					<label class="col-sm-2 control-label">{{ entry_height }}</label>
					<div class="col-sm-10">				
						<div class="row">						
							<div class="col-sm-6">
								<input type="text" class="form-control" placeholder="{{ entry_min }}" name="product_option[{{ option_row }}][min_height]" value="{{ product_option['min_height'] }}" />
							</div>
							<div class="col-sm-6">
								<input type="text" class="form-control" placeholder="{{ entry_max }}" name="product_option[{{ option_row }}][max_height]" value="{{ product_option['max_height'] }}" />
							</div>
						</div>
					</div>
				</div>
				<div class="form-group required">
					<label class="col-sm-2 control-label">{{ entry_cost_per_square }}</label>
					<div class="col-sm-10"><input type="text" class="form-control" name="product_option[{{ option_row }}][cost_per_square]" value="{{ product_option['cost_per_square'] }}" /></div>
				</div>
				<div class="form-group required">
					<label class="col-sm-2 control-label">{{ entry_min_price }}</label>
					<div class="col-sm-10"><input type="text" class="form-control" name="product_option[{{ option_row }}][min_price]" value="{{ product_option['min_price'] }}" /></div>
				</div>
				<div class="form-group required">
					<label class="col-sm-2 control-label">{{ entry_enable_proportional_size }}</label>
					<div class="col-sm-10">
						<label class="radio-inline">
							<input type="radio" name="product_option[{{ option_row }}][enable_proportional_size]" value="1" {{ product_option['enable_proportional_size'] ? 'checked="checked"' : '' }} />
							{{ text_yes }}
						</label>
						<label class="radio-inline">				
							<input type="radio" name="product_option[{{ option_row }}][enable_proportional_size]" value="0" {{ "0" ==product_option['enable_proportional_size'] ? 'checked="checked"' : '' }} />
							{{ text_no }}
						</label>
					</div>
				</div>
				<div class="form-group required">
					<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ text_help_width_height_ratio }}">{{ entry_width_height_ratio }}</span></label>
					<div class="col-sm-10">				
						<div class="row">						
							<div class="col-sm-6">
								<input type="text" class="form-control" name="product_option[{{ option_row }}][proportional_size_width]" value="{{ product_option['proportional_size_width'] }}" />
							</div>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="product_option[{{ option_row }}][proportional_size_height]" value="{{ product_option['proportional_size_height'] }}" />
							</div>
						</div>
					</div>
				</div>
				<script>
					$('select[name="product_option[{{ option_row }}][required]"] option[value="0"]').remove();
				</script>
				{% endif %}
				<!--EOF Product Size Option-->
				
            ]]></add>
        </operation>
		
		<operation>
            <search position="replace"><![CDATA[
				html += '	      <option value="0">{{ text_no }}</option>';
            ]]></search>
            <add position="replace" trim="true"><![CDATA[				
				//BOF Product Size Option
				if (item['type'] != 'size')
					html += '	      <option value="0">{{ text_no }}</option>';
				//EOF Product Size Option
            ]]></add>
        </operation>
		
		<operation>
            <search position="before"><![CDATA[if (item['type'] == 'text')]]></search>
            <add position="before" trim="true"><![CDATA[	
				//BOF Product Size Option
				if (item['type'] == 'size') {
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label">{{ entry_width }}</label>';
					html += '     	<div class="col-sm-10">';
					html += '     		<div class="row">';						
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" placeholder="{{ entry_min }}" name="product_option[' + option_row + '][min_width]" value="0" />';
					html += '     			</div>';
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" placeholder="{{ entry_max }}" name="product_option[' + option_row + '][max_width]" value="9999" />';
					html += '     			</div>';
					html += '     		</div>';
					html += '     	</div>';
					html += '     </div>';
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label">{{ entry_height }}</label>';
					html += '     	<div class="col-sm-10">';
					html += '     		<div class="row">';
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" placeholder="{{ entry_min }}" name="product_option[' + option_row + '][min_height]" value="0" />';
					html += '     			</div>';
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" placeholder="{{ entry_max }}" name="product_option[' + option_row + '][max_height]" value="9999" />';
					html += '     			</div>';
					html += '     		</div>';
					html += '     	</div>';
					html += '     </div>';
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label">{{ entry_cost_per_square }}</label>';
					html += '     	<div class="col-sm-10"><input type="text" class="form-control" name="product_option[' + option_row + '][cost_per_square]" value="1" /></div>';
					html += '     </div>';
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label">{{ entry_min_price }}</label>';
					html += '     	<div class="col-sm-10"><input type="text" class="form-control" name="product_option[' + option_row + '][min_price]" value="0" /></div>';
					html += '     </div>';
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label">{{ entry_enable_proportional_size }}</label>';
					html += '     	<div class="col-sm-10">';
					html += '             <label class="radio-inline">';
					html += '     			<input type="radio" name="product_option[' + option_row + '][enable_proportional_size]" value="1" />';
					html += '     			{{ text_yes }}';
					html += '             </label>';
					html += '             <label class="radio-inline">';
					html += '     			<input type="radio" name="product_option[' + option_row + '][enable_proportional_size]" value="0" checked="checked" />';
					html += '     			{{ text_no }}';
					html += '             </label>';
					html += '     	</div>';
					html += '     </div>';
					html += '     <div class="form-group required">';
					html += '     	<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="{{ text_help_width_height_ratio }}">{{ entry_width_height_ratio }}</span></label>';
					html += '     	<div class="col-sm-10">';
					html += '     		<div class="row">';
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" name="product_option[' + option_row + '][proportional_size_width]" value="2" />';
					html += '     			</div>';
					html += '     			<div class="col-sm-6">';
					html += '     				<input type="text" class="form-control" name="product_option[' + option_row + '][proportional_size_height]" value="1" />';
					html += '     			</div>';
					html += '     		</div>';
					html += '     	</div>';
					html += '     </div>';
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
    
    <file path="admin/model/catalog/product.php">
		<!-- Create table option size -->
		<operation>
            <search position="after" ><![CDATA[$product_option_data[] = array(]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				'min_width'            	=> isset($product_option['min_width']) ? $product_option['min_width'] : '',
				'max_width'            	=> isset($product_option['max_width']) ? $product_option['max_width'] : '',
				'min_height'           	=> isset($product_option['min_height']) ? $product_option['min_height'] : '',
				'max_height'           	=> isset($product_option['max_height']) ? $product_option['max_height'] : '',
				'cost_per_square'      	=> isset($product_option['cost_per_square']) ? $product_option['cost_per_square'] : '',
				'min_price'      		=> isset($product_option['min_price']) ? $product_option['min_price'] : '',
				'proportional_size'      		=> isset($product_option['proportional_size']) ? $product_option['proportional_size'] : '0:1:1',
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
            <search position="replace" index='0'><![CDATA[
            if ($product_option['type'] == 'select'
            ]]></search>
            <add position="replace" trim="true"><![CDATA[
				//BOF Product Size Option
				if ($product_option['type'] == 'size') {
					$min_width_value = isset($product_option['min_width']) ? $product_option['min_width'] : 0;
					$max_width_value = isset($product_option['max_width']) ? $product_option['max_width'] : 0;
					$min_height_value = isset($product_option['min_height']) ? $product_option['min_height'] : 0;
					$max_height_value = isset($product_option['max_height']) ? $product_option['max_height'] : 0;
					$cost_per_square = isset($product_option['cost_per_square']) ? $product_option['cost_per_square'] : 0;
					$min_price = isset($product_option['min_price']) ? $product_option['min_price'] : 0;
					
					$enable_proportional_size = isset($product_option['enable_proportional_size']) ? $product_option['enable_proportional_size'] : 0;
					$proportional_size_width = isset($product_option['proportional_size_width']) ? $product_option['proportional_size_width'] : 1;
					$proportional_size_height = isset($product_option['proportional_size_height']) ? $product_option['proportional_size_height'] : 1;
					
					$proportional_size = $enable_proportional_size . ':' . $proportional_size_width . ':' . $proportional_size_height;
					
					$this->db->query("INSERT INTO " . DB_PREFIX . "product_option "
					. " SET product_id = '" . (int)$product_id . "' "
					. " , option_id = '" . (int)$product_option['option_id'] . "' "
					. " , required = '1' " /*always required*/
					. " , min_width = '" . $min_width_value . "' "
					. " , max_width = '" . $max_width_value . "' "
					. " , min_height = '" . $min_height_value . "' "
					. " , max_height = '" . $max_height_value . "' "
					. " , min_price = '" . $min_price . "' "
					. " , proportional_size = '" . $proportional_size . "' "
					. " , cost_per_square = '" . $cost_per_square . "'");
				
				//EOF Product Size Option	
				} else if ($product_option['type'] == 'select'
            ]]></add>
        </operation>
        
		<operation>
            <search position="replace" index='1'><![CDATA[
				if ($product_option['type'] == 'select'
            ]]></search>
            <add position="replace" trim="true"><![CDATA[
				//BOF Product Size Option
				if ($product_option['type'] == 'size') {
					$min_width_value = isset($product_option['min_width']) ? $product_option['min_width'] : 0;
					$max_width_value = isset($product_option['max_width']) ? $product_option['max_width'] : 0;
					$min_height_value = isset($product_option['min_height']) ? $product_option['min_height'] : 0;
					$max_height_value = isset($product_option['max_height']) ? $product_option['max_height'] : 0;
					$min_price = isset($product_option['min_price']) ? $product_option['min_price'] : 0;
					$cost_per_square = isset($product_option['cost_per_square']) ? $product_option['cost_per_square'] : 0;
					
					$enable_proportional_size = isset($product_option['enable_proportional_size']) ? $product_option['enable_proportional_size'] : 0;
					$proportional_size_width = isset($product_option['proportional_size_width']) ? $product_option['proportional_size_width'] : 1;
					$proportional_size_height = isset($product_option['proportional_size_height']) ? $product_option['proportional_size_height'] : 1;
					
					$proportional_size = $enable_proportional_size . ':' . $proportional_size_width . ':' . $proportional_size_height;								
					
					$this->db->query("INSERT INTO " . DB_PREFIX . "product_option "
					. " SET product_option_id = '" . (int)$product_option['product_option_id'] . "' "
					. " , product_id = '" . (int)$product_id . "' "
					. " , option_id = '" . (int)$product_option['option_id'] . "' "
					. " , required = '1' " /*always required*/
					. " , min_width = '" . $min_width_value . "' "
					. " , max_width = '" . $max_width_value . "' "
					. " , min_height = '" . $min_height_value . "' "
					. " , max_height = '" . $max_height_value . "' "
					. " , min_price = '" . $min_price . "' "
					. " , proportional_size = '" . $proportional_size . "' "
					. " , cost_per_square = '" . $cost_per_square . "'");
				
				//EOF Product Size Option
				} else if ($product_option['type'] == 'select'
            ]]></add>
        </operation>
    </file>
    
    <file path="admin/controller/catalog/product.php">
		<operation>
            <search position="after"><![CDATA[
				$data['product_options'][] = array(
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				'min_width'            	=> isset($product_option['min_width']) ? $product_option['min_width'] : '',
				'max_width'            	=> isset($product_option['max_width']) ? $product_option['max_width'] : '',
				'min_height'           	=> isset($product_option['min_height']) ? $product_option['min_height'] : '',
				'max_height'           	=> isset($product_option['max_height']) ? $product_option['max_height'] : '',
				'cost_per_square'      	=> isset($product_option['cost_per_square']) ? $product_option['cost_per_square'] : '',
				'min_price'				=> isset($product_option['min_price']) ? $product_option['min_price'] : '',
				'enable_proportional_size' => isset($product_option['proportional_size']) ? $this->getEnableProportionalSize($product_option['proportional_size']) : 0,
				'proportional_size_width' => isset($product_option['proportional_size']) ? $this->getProportionalSizeWidth($product_option['proportional_size']) : 1,
				'proportional_size_height' => isset($product_option['proportional_size']) ? $this->getProportionalSizeHeight($product_option['proportional_size']) : 1,
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<!-- Assign list option production -->
		<operation>
            <search position="after"><![CDATA[$data['placeholder']]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				$this->load->model('catalog/option');
				$data['all_options'] = $this->model_catalog_option->getOptions();
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
            <search position="after"><![CDATA[
            $data['text_form']
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				$this->load->language('catalog/product_size_option');
				$data['entry_width'] = $this->language->get('entry_width');
				$data['entry_height'] = $this->language->get('entry_height');
				$data['entry_min'] = $this->language->get('entry_min');
				$data['entry_max'] = $this->language->get('entry_max');
				$data['entry_cost_per_square'] = $this->language->get('entry_cost_per_square');
				$data['entry_min_price'] = $this->language->get('entry_min_price');
				
				$data['entry_enable_proportional_size'] = $this->language->get('entry_enable_proportional_size');
				$data['entry_width_height_ratio'] = $this->language->get('entry_width_height_ratio');
				$data['text_help_width_height_ratio'] = $this->language->get('text_help_width_height_ratio');
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
            <search position="before"><![CDATA[
				if ($this->error && !isset($this->error['warning'])) {
            ]]></search>
            <add position="before" trim="true"><![CDATA[
				//BOF Product Size Option
				$this->load->language('catalog/product_size_option');		
				if(isset($this->request->post['product_option']))
				{				
					foreach($this->request->post['product_option'] as $option) {
						if (isset($option['min_width']) || isset($option['max_width']) || isset($option['min_height']) || isset($option['max_height']) ) {
							if(!preg_match("/^[0-9\.]+$/", $option['min_width']) || !preg_match("/^[0-9\.]+$/", $option['max_width']) ||  !preg_match("/^[0-9\.]+$/", $option['min_height']) || !preg_match("/^[0-9\.]+$/", $option['max_height']) || !preg_match("/^[0-9\.]+$/", $option['cost_per_square'])) {
								$this->error['option'] = $this->language->get('error_option');
							} else {
								if (($option['min_width'] > $option['max_width']) || ($option['min_height'] > $option['max_height'])) {
									$this->error['option'] = $this->language->get('error_option');
								}
							}
						}
					}
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
	
    <file path="admin/controller/catalog/product.php|catalog/model/catalog/product.php">    
		<operation>
            <search position="replace" index='0'><![CDATA[public function]]></search>
            <add position="replace" trim="true"><![CDATA[
				//EOF Product Size Option
				function getEnableProportionalSize($proportional_size)
				{
					if(isset($proportional_size))
					{
						$arr = explode(':', $proportional_size);
						if(sizeof($arr) == 3)
							return (int)$arr[0];
					}
					
					return 0;
				}
				function getProportionalSizeWidth($proportional_size)
				{
					if(isset($proportional_size))
					{
						$arr = explode(':', $proportional_size);
						if(sizeof($arr) == 3)
							return (int)$arr[1];
					}
					
					return 1;
				}
				function getProportionalSizeHeight($proportional_size)
				{
					if(isset($proportional_size))
					{
						$arr = explode(':', $proportional_size);
						if(sizeof($arr) == 3)
							return (int)$arr[2];
					}
					
					return 1;
				}
				//EOF Product Size Option
				
				public function
            ]]></add>
        </operation>
    </file>
    
    <file path="catalog/controller/product/product.php">
        <operation>
            <search position="after"><![CDATA[
				$data['heading_title']
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//EOF Product Size Option
				$this->load->language('extension/module/option_size');            
				$data['label_width'] = $this->language->get('label_width');
				$data['label_height'] = $this->language->get('label_height');
				
				if ($this->config->has('pso_dimension_order'))
					$data['pso_dimension_order'] = $this->config->get('pso_dimension_order');
				else
					$data['pso_dimension_order'] = 0; //default: height then width
				//EOF Product Size Option
            ]]></add>
        </operation>
        
        <operation>
            <search position="after" ><![CDATA[
				$data['options'][] = array(
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				'enable_proportional_size' => isset($option['enable_proportional_size']) ? $option['enable_proportional_size'] : 0,
				'proportional_size_width' => isset($option['proportional_size_width']) ? $option['proportional_size_width'] : 1,
				'proportional_size_height' => isset($option['proportional_size_height']) ? $option['proportional_size_height'] : 1,
				//EOF Product Size Option
			]]></add>
        </operation>
        
        <operation>
			<search position="before" index='0'><![CDATA[
				public function
			]]></search>
			<add position="before"><![CDATA[
				//BOF Product Size Option
				private function getAllProductOption($productID) {
					$sql = "SELECT a.* "
					. " , b.option_value_size_id "
					. " , b.option_size_id "
					. " , b.option_id as option_size_value "
					. " FROM `" . DB_PREFIX . "product_option` a "
					. " LEFT JOIN `" . DB_PREFIX . "option_value_size` b "
					. " ON a.option_id = b.option_id "
					. " WHERE a.product_id = '" . $productID . "'";
					$query = $this->db->query($sql);
					
					return $query->rows;
				}
				
				public function checkScaleWithSize($productID, $productOptionID, $optionSizeID) {
					$sql = "SELECT a.* FROM `" . DB_PREFIX . "product_option` a  "
					. " LEFT JOIN `" . DB_PREFIX . "option_value_size` b "
					. " ON a.option_id = b.option_id "
					. " WHERE a.product_id = '" . $productID . "'  "
					. " AND a.product_option_id = '" . $productOptionID . "'  "
					. " AND b.option_size_id = '" . $optionSizeID . "'";
					$query = $this->db->query($sql);
					if ($query->num_rows) {
						return TRUE;
					}
					return FALSE;
				}
				
				public function getPsoTotal($product_id, $quantity, $options)
				{
					$total_data = array();
					$total_data['total'] = 0;
					$total_data['total_ex_tax'] = 0;
				
					$product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_store p2s LEFT JOIN " . DB_PREFIX . "product p ON (p2s.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND p2s.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");

					if ($product_query->num_rows && ($quantity > 0)) {
						$option_price = 0;

						$option_data = array();

						//BOF Product Size Option
						$has_size_option = false;
						//EOF Product Size Option
					
						//BOF Product Size Option						
						$min_width = 0;
						$max_width = 0;
						$min_height = 0;
						$max_height = 0;
						$cost_per_square = 0;
						$option_size_id = 0;
						$product_option_size_id = 0;
						$product_width = 0;
						$product_height = 0;
						$product_options =  $this->getAllProductOption($product_id);
						if(!empty($product_options)) {
							foreach($product_options as $product_option) {
								if ($product_option['min_width'] != '' && $product_option['max_width'] != '' && $product_option['cost_per_square'] != '') {
									$min_width = $product_option['min_width'];
									$max_width = $product_option['max_width'];
									$min_height = $product_option['min_height'];
									$max_height = $product_option['max_height'];
									$cost_per_square = $product_option['cost_per_square'];
									$product_option_size_id = $product_option['product_option_id'];
									$option_size_id = $product_option['option_id']; 
									break;
								}
							}
						}
						if($product_option_size_id > 0) {						
							$product_width = isset($options[$product_option_size_id]['width']) ? (float)$options[$product_option_size_id]['width'] : 0;
							$product_height = isset($options[$product_option_size_id]['height']) ? (float)$options[$product_option_size_id]['height'] : 0; 
						}
						//EOF Product Size Option

						foreach ($options as $product_option_id => $value) {
							$option_query = $this->db->query("SELECT po.*, od.name, o.type FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_option_id = '" . (int)$product_option_id . "' AND po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'");

							if ($option_query->num_rows) {
								
								//BOF Product Size Option
								if ($option_query->row['type'] == 'size') {
									$has_size_option = true;
									
									$width = (float)$value['width'];
									$height = (float)$value['height'];
									
									$extra_price = ($width * $height) / 1000 * $option_query->row['cost_per_square'];
									
									if($extra_price < $option_query->row['min_price'])
										$extra_price = $option_query->row['min_price'];
									
									$option_price += $extra_price;
								
								} 
								//EOF Product Size Option
								else if ($option_query->row['type'] == 'select' || $option_query->row['type'] == 'radio' || $option_query->row['type'] == 'image') {
									$option_value_query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$value . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

									if ($option_value_query->num_rows) {

									//BOF Product Size Option
									if($this->checkScaleWithSize($product_id, $product_option_id, $option_size_id)) {
										if ($option_value_query->row['price_prefix'] == '+') {
											$option_price += $option_value_query->row['price'] * $product_width * $product_height;
										} elseif ($option_value_query->row['price_prefix'] == '-') {
											$option_price -= $option_value_query->row['price'] * $product_width * $product_height;
										}
									} else {
										if ($option_value_query->row['price_prefix'] == '+') {
											$option_price += $option_value_query->row['price'];
										} elseif ($option_value_query->row['price_prefix'] == '-') {
											$option_price -= $option_value_query->row['price'];
										}	
									}
									//EOF Product Size Option
									}
								} 
								elseif ($option_query->row['type'] == 'checkbox' && is_array($value)) {
									foreach ($value as $product_option_value_id) {
										$option_value_query = $this->db->query("SELECT pov.option_value_id, ovd.name, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, pov.weight, pov.weight_prefix FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' AND pov.product_option_id = '" . (int)$product_option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

										if ($option_value_query->num_rows) {

											//BOF Product Size Option
											if($this->checkScaleWithSize($product_id, $product_option_id, $option_size_id)) {
												if ($option_value_query->row['price_prefix'] == '+') {
													$option_price += $option_value_query->row['price'] * $product_width * $product_height;
												} elseif ($option_value_query->row['price_prefix'] == '-') {
													$option_price -= $option_value_query->row['price'] * $product_width * $product_height;
												}
											} else {
												if ($option_value_query->row['price_prefix'] == '+') {
													$option_price += $option_value_query->row['price'];
												} elseif ($option_value_query->row['price_prefix'] == '-') {
													$option_price -= $option_value_query->row['price'];
												}	
											}
											//EOF Product Size Option
										}
									}
								}
							}
						}

						$price = $product_query->row['price'];

						// Product Discounts
						$discount_quantity = 0;

						$cart_2_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'");

						foreach ($cart_2_query->rows as $cart_2) {
							if ($cart_2['product_id'] == $product_id) {
								$discount_quantity += $cart_2['quantity'];
							}
						}

						$product_discount_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND quantity <= '" . (int)$discount_quantity . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY quantity DESC, priority ASC, price ASC LIMIT 1");

						if ($product_discount_query->num_rows) {
							$price = $product_discount_query->row['price'];
						}

						// Product Specials
						$product_special_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");

						if ($product_special_query->num_rows) {
							$price = $product_special_query->row['price'];
						}

						//BOF Product Size Option
						$pso_exclude_product_price_in_total = 0; //default: false
						if ($has_size_option && $this->config->has('pso_exclude_product_price_in_total'))
						{ 
							$pso_exclude_product_price_in_total = $this->config->get('pso_exclude_product_price_in_total');
						}
						//EOF Product Size Option
					
						$total_data['total_ex_tax'] = ($pso_exclude_product_price_in_total ? ($option_price) : ($price + $option_price)) * $quantity;
					
						$total_taxes = 0;
					
						if ($product_query->row['tax_class_id']) {
							$tax_rates = $this->tax->getRates(($pso_exclude_product_price_in_total ? ($option_price) : ($price + $option_price)), $product_query->row['tax_class_id']);
							
							foreach ($tax_rates as $tax_rate) {
								$total_taxes += ($tax_rate['amount'] * $quantity);
							}
						}
						
						$total_data['total'] = $total_data['total_ex_tax'] + $total_taxes;
					}
					
					return $total_data;
				}
				
				
				public function add() {
					$this->load->language('checkout/cart');
					$this->load->language('extension/module/option_size');
					$hold = array();
					$json = array();
					
					if (isset($this->request->post['product_id'])) {
						$product_id = $this->request->post['product_id'];
					} else {
						$product_id = 0;
					}
					
					if (isset($this->request->post['quantity'])) {
						$quantity = $this->request->post['quantity'];
					}
					else if (isset($this->request->post['qty'])) {
						$quantity = $this->request->post['qty'];
					} else {
						$quantity = 0;
					}
					
					$this->load->model('catalog/product');
									
					$product_info = $this->model_catalog_product->getProduct($product_id);
					
					if ($product_info) {
						//$quantity = 1;
								
						if (isset($this->request->post['option'])) {
							$option = array_filter($this->request->post['option']);
						} else {
							$option = array();	
						}
						
						$product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
						
						if(!empty($option)) {
							foreach($option as $key => $value) {
								if (isset($value['width']) && isset($value['height'])) {
									if(preg_match("/^[0-9\.]+$/", $value['height']) && preg_match("/^[0-9\.]+$/", $value['width'])) {
										foreach($product_options as $product_option) {
											if ($product_option['product_option_id'] == $key && $product_option['type'] == 'size') {
												if ($value['height'] < $product_option['min_height'] || $value['height'] > $product_option['max_height'] ) {
													$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
												}
												if ($value['width'] < $product_option['min_width'] || $value['width'] > $product_option['max_width'] ) {
													$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
												}
												break;
											}
										}
										
									} else {
										foreach($product_options as $product_option) {
											if ($product_option['product_option_id'] == $key && $product_option['type'] == 'size') {
												$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
												break;
											}
										}
									}
								}
							}
						}	
						
						if (!$json) {
							$total_data = $this->getPsoTotal($product_id, $quantity, $option);
							
							
							$json['total'] = sprintf($this->currency->format($total_data['total'], $this->config->get('config_currency')));
							$json['total_extax'] = sprintf($this->currency->format($total_data['total_ex_tax'], $this->config->get('config_currency')));
							
						} else {
							$json['redirect'] = str_replace('&amp;', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));
						}
					}
					$this->response->setOutput(json_encode($json));		
				}
				//EOF Product Size Option
			]]></add>
		</operation>
    </file>
    
    <file path="catalog/model/catalog/product.php">
		<!-- assign title Size -->
		<operation>
            <search position="after"><![CDATA[
				$product_option_data[] = array(
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				'min_width'            => $product_option['min_width'],
				'max_width'            => $product_option['max_width'],
				'min_height'           => $product_option['min_height'],
				'max_height'           => $product_option['max_height'],
				'cost_per_square'      => $product_option['cost_per_square'],
				'enable_proportional_size' => isset($product_option['proportional_size']) ? $this->getEnableProportionalSize($product_option['proportional_size']) : 0,
				'proportional_size_width' => isset($product_option['proportional_size']) ? $this->getProportionalSizeWidth($product_option['proportional_size']) : 1,
				'proportional_size_height' => isset($product_option['proportional_size']) ? $this->getProportionalSizeHeight($product_option['proportional_size']) : 1,
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
    
    <file path="catalog/controller/checkout/cart.php">
		<!-- assign title Size -->
		<operation>
            <search position="after"><![CDATA[
				$product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				if(!empty($option)) {
					$this->load->language('extension/module/option_size');
					foreach($option as $key => $value) {
						if (isset($value['width']) && isset($value['height'])) {
							if(preg_match("/^[0-9\.]+$/", $value['height']) && preg_match("/^[0-9\.]+$/", $value['width'])) {
								foreach($product_options as $product_option) {
									if ($product_option['product_option_id'] == $key && $product_option['type'] == 'size') {
										if ($value['height'] < $product_option['min_height'] || $value['height'] > $product_option['max_height'] ) {
											$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
										}
										if ($value['width'] < $product_option['min_width'] || $value['width'] > $product_option['max_width'] ) {
											$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
										}
										break;
									}
								}
								
							} else {
								foreach($product_options as $product_option) {
									if ($product_option['product_option_id'] == $key && $product_option['type'] == 'size') {
										$json['error']['option'][$key] = sprintf($this->language->get('error_input_size'), $product_option['min_height'], $product_option['max_height'], $product_option['min_width'], $product_option['max_width']);
										break;
									}
								}
							}
						}
					}
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
    </file>
    
    <file path="system/library/cart/cart.php">
		<operation>
            <search position="before" index='0'><![CDATA[
				function getProducts()
            ]]></search>
            <add position="before" trim="true"><![CDATA[
				//BOF Product Size Option
				public function getAllProductOption($productID) {
					$sql = "SELECT a.* "
					. " , b.option_value_size_id "
					. " , b.option_size_id "
					. " , b.option_id as option_size_value "
					. " FROM `" . DB_PREFIX . "product_option` a "
					. " LEFT JOIN `" . DB_PREFIX . "option_value_size` b "
					. " ON a.option_id = b.option_id "
					. " WHERE a.product_id = '" . $productID . "'";
					$query = $this->db->query($sql);
					
					return $query->rows;
				}
				
				public function checkScaleWithSize($productID, $productOptionID, $optionSizeID) {
					$sql = "SELECT a.* FROM `" . DB_PREFIX . "product_option` a  "
					. " LEFT JOIN `" . DB_PREFIX . "option_value_size` b "
					. " ON a.option_id = b.option_id "
					. " WHERE a.product_id = '" . $productID . "'  "
					. " AND a.product_option_id = '" . $productOptionID . "'  "
					. " AND b.option_size_id = '" . $optionSizeID . "'";
					$query = $this->db->query($sql);
					if ($query->num_rows) {
						return TRUE;
					}
					return FALSE;
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
		
		<operation>
            <search position="after"><![CDATA[
				$option_data = array();
            ]]></search>
            <add position="after" trim="true"><![CDATA[
				//BOF Product Size Option
				$product_id = (int)$cart['product_id'];
				
				$min_width = 0;
				$max_width = 0;
				$min_height = 0;
				$max_height = 0;
				$cost_per_square = 0;
				$option_size_id = 0;
				$product_option_size_id = 0;
				$product_width = 0;
				$product_height = 0;
				$product_options =  $this->getAllProductOption($product_id);
				if(!empty($product_options)) {
					foreach($product_options as $product_option) {
						if ($product_option['min_width'] != '' && $product_option['max_width'] != '' && $product_option['cost_per_square'] != '') {
							$min_width = $product_option['min_width'];
							$max_width = $product_option['max_width'];
							$min_height = $product_option['min_height'];
							$max_height = $product_option['max_height'];
							$cost_per_square = $product_option['cost_per_square'];
							$product_option_size_id = $product_option['product_option_id'];
							$option_size_id = $product_option['option_id']; 
							break;
						}
					}
				}
				if($product_option_size_id > 0) {
					$options = json_decode($cart['option'], true);
				
					$product_width = isset($options[$product_option_size_id]['width']) ? (float)$options[$product_option_size_id]['width'] : 0;
					$product_height = isset($options[$product_option_size_id]['height']) ? (float)$options[$product_option_size_id]['height'] : 0; 
				}
				//EOF Product Size Option
            ]]></add>
        </operation>
        
		<operation>
			<search position="replace"><![CDATA[SELECT po.product_option_id, po.option_id]]></search>
			<add position="replace"><![CDATA[SELECT po.*]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[
				if ($option_query->row['type'] == 'select'
			]]></search>
			<add position="replace"><![CDATA[
				//BOF Product Size Option
				if ($option_query->row['type'] == 'size') {
					$has_size_option = true;
					
					$width = (float)$value->width;
					$height = (float)$value->height;
					
					$extra_price = ($width * $height) / 1000 * $option_query->row['cost_per_square'];
					
					if($extra_price < $option_query->row['min_price'])
						$extra_price = $option_query->row['min_price'];
					
					$option_price += $extra_price;
					
					if ($this->config->has('pso_dimension_order'))
						$pso_dimension_order = $this->config->get('pso_dimension_order');
					else
						$pso_dimension_order = 0; //default: height then width
					
					$option_data[] = array(
						'product_option_id'       => $product_option_id,
						'product_option_value_id' => '',
						'option_id'               => $option_query->row['option_id'],
						'option_value_id'         => '',
						'name'                    => $option_query->row['name'],
						'value'           		  => $pso_dimension_order == 1 ? ($width . 'x' . $height) : ($height . 'x' . $width),
						'type'                    => $option_query->row['type'],
						'quantity'                => '',
						'subtract'                => '',
						'price'                   => $extra_price,
						'price_prefix'            => '',
						'points'                  => '',
						'points_prefix'           => '',								
						'weight'                  => '',
						'weight_prefix'           => ''
					);
				
				} 
				//EOF Product Size Option
				else if ($option_query->row['type'] == 'select'
			]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[$option_value_query->row['price_prefix'] == '+']]></search>
			<add position="replace"><![CDATA[$option_value_query->row['price_prefix'] == '+' && false]]></add>
		</operation>
		
		<operation>
			<search position="replace"><![CDATA[$option_value_query->row['price_prefix'] == '-']]></search>
			<add position="replace"><![CDATA[$option_value_query->row['price_prefix'] == '-' && false]]></add>
		</operation>
		
		<operation>
			<search position="before"><![CDATA[
				if ($option_value_query->row['price_prefix'] == '+' && false) {
			]]></search>
			<add position="before"><![CDATA[
				//BOF Product Size Option
				if($this->checkScaleWithSize($product_id, $product_option_id, $option_size_id)) {
					if ($option_value_query->row['price_prefix'] == '+') {
						$option_price += $option_value_query->row['price'] * $product_width * $product_height;
					} elseif ($option_value_query->row['price_prefix'] == '-') {
						$option_price -= $option_value_query->row['price'] * $product_width * $product_height;
					}
				} else {
					if ($option_value_query->row['price_prefix'] == '+') {
						$option_price += $option_value_query->row['price'];
					} elseif ($option_value_query->row['price_prefix'] == '-') {
						$option_price -= $option_value_query->row['price'];
					}	
				}
				//EOF Product Size Option
			]]></add>
		</operation>
		
		<!--Exclude product price-->
		<operation>
			<search position="after" index='0'><![CDATA[
				$option_data = array();
			]]></search>
			<add position="after"><![CDATA[
				//BOF Product Size Option
				$has_size_option = false;
				//EOF Product Size Option
			]]></add>
		</operation>
		
		<operation>
			<search position="before" index='0'><![CDATA[
				$product_data[] = array(
			]]></search>
			<add position="before"><![CDATA[
				//BOF Product Size Option
				$pso_exclude_product_price_in_total = 0; //default: false
				if ($has_size_option && $this->config->has('pso_exclude_product_price_in_total'))
				{ 
					$pso_exclude_product_price_in_total = $this->config->get('pso_exclude_product_price_in_total');
				}
				//EOF Product Size Option
			]]></add>
		</operation>
		
		<operation>
			<search position="replace" index='0,1'><![CDATA[($price + $option_price)]]></search>
			<add position="replace"><![CDATA[($pso_exclude_product_price_in_total ? ($option_price) : ($price + $option_price))]]></add>
		</operation>
    </file>
    
	<file path="admin/controller/sale/order.php">
		<operation>
			<search position="after" index='0'><![CDATA[
				getForm()
			]]></search>
			<add position="after"><![CDATA[
				$this->load->language('sale/option_size');            
				$data['label_width'] = $this->language->get('label_width');
				$data['label_height'] = $this->language->get('label_height');
			]]></add>
		</operation>
    </file>
	
    <file path="admin/view/template/sale/order_form.twig">
		<operation>
			<search position="before" index='0'><![CDATA[
				<script type="text/javascript">
			]]></search>
			<add position="before"><![CDATA[
				<style>
					.pso-width-input.form-control, .pso-height-input.form-control
					{
						width: 45%;
						display: inline-block;
					}
				</style>
			]]></add>
		</operation>
		<operation>
			<search position="before" index='0'><![CDATA[
				if (option['type'] == 'select') {
			]]></search>
			<add position="before"><![CDATA[
				if (option['type'] == 'size') {
					html += '<div class="form-group' + (option['required'] ? ' required' : '') + '">';
					html += '  <label class="col-sm-2 control-label" for="input-option' + option['product_option_id'] + '">' + option['name'] + '</label>';
					html += '  <div class="col-sm-10">';
					html += '    <div id="input-option' + option['product_option_id'] + '">';
					html += '      <input type="text" name="option[' + option['product_option_id'] + '][width]" value="" placeholder="{{ label_width }}" class="pso-width-input form-control" />';
					html += '      <input type="text" name="option[' + option['product_option_id'] + '][height]" placeholder="{{ label_height }}" class="pso-height-input form-control" />';
					html += '    </div>';
					html += '  </div>';
					html += '</div>';
				}
			]]></add>
		</operation>
    </file>
	<!--Theme changes-->
	
    <file path="catalog/view/theme/*/template/product/product.twig">
		<operation>
            <search position="before" index='0'><![CDATA[
				{% if option.type == 'select' %}
            ]]></search>
            <add position="before" trim="true"><![CDATA[
			<div class="hidden">	
				
				<!--BOF Product Size Option-->
				{% if option.type == 'size' %}
					{% if (pso_dimension_order == 1) %}<!-- Width then Height -->
						<div class="form-group{{ option.required ? ' required' : '' }}" id="option-{{ option.product_option_id }}" >
							<label class="control-label size-option-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							<div id="input-option{{ option.product_option_id }}">
								<input type="text" name="option[{{ option.product_option_id }}][width]" value="{{ option.value }}" placeholder="{{ label_width }}" id="input-option{{ option.product_option_id }}width" class="pso-width-input form-control" />
								<input type="text" name="option[{{ option.product_option_id }}][height]" value="{{ option.value }}" placeholder="{{ label_height }}" id="input-option{{ option.product_option_id }}height" class="pso-height-input form-control" />
							</div>
							{% if option.enable_proportional_size %}
								<input type="hidden" class="proportional_size_width" value="{{ option.proportional_size_width }}" />
								<input type="hidden" class="proportional_size_height" value="{{ option.proportional_size_height }}" />
							{% else %}
								<input type="hidden" class="proportional_size_width" value="" />
								<input type="hidden" class="proportional_size_height" value="" />
							{% endif %}
						</div>
					{% else %}<!-- Height then Width -->
						<div class="form-group{{ option.required ? ' required' : '' }}" id="option-{{ option.product_option_id }}" >
							<label class="control-label size-option-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
							<div id="input-option{{ option.product_option_id }}">
								<input type="text" name="option[{{ option.product_option_id }}][height]" value="{{ option.value }}" placeholder="{{ label_height }}" id="input-option{{ option.product_option_id }}" class="pso-height-input form-control" />
								<input type="text" name="option[{{ option.product_option_id }}][width]" value="{{ option.value }}" placeholder="{{ label_width }}" id="input-option{{ option.product_option_id }}" class="pso-width-input form-control" />
							</div>
							{% if option.enable_proportional_size %}
								<input type="hidden" class="proportional_size_width" value="{{ option.proportional_size_width }}" />
								<input type="hidden" class="proportional_size_height" value="{{ option.proportional_size_height }}" />
							{% else %}
								<input type="hidden" class="proportional_size_width" value="" />
								<input type="hidden" class="proportional_size_height" value="" />
							{% endif %}
						</div>
					{% endif %}
				{% endif %}
				<!--EOF Product Size Option-->



		</div>
            ]]></add>
        </operation>
		<operation>
			<search position="replace" index='0'><![CDATA[{{ price }}]]></search>
			<add position="replace"><![CDATA[
				<!--BOF Product Size Option-->
				<span id='total_price'>{{ price }}</span>
				<!--EOF Product Size Option-->
			]]></add>
		</operation>
        
		<operation>
			<search position="replace" index='0'><![CDATA[{{ special }}]]></search>
			<add position="replace"><![CDATA[
				<!--BOF Product Size Option-->
				<span id='total_price'>{{ special }}</span>
				<!--EOF Product Size Option-->
			]]></add>
		</operation>
        
		<operation>
			<search position="replace" index='0'><![CDATA[{{ tax }}]]></search>
			<add position="replace"><![CDATA[
				<!--BOF Product Size Option-->
				<span id='total_price_ex_tax'>{{ tax }}</span>
				<!--EOF Product Size Option-->
			]]></add>
		</operation>
		
		<operation>
			<search position="after" index='0'><![CDATA[
	--></script>
			]]></search>
			<add position="after"><![CDATA[
				<!--BOF Product Size Option-->
				<style>
					.pso-width-input.form-control, .pso-height-input.form-control
					{
						width: 45%;
						display: inline-block;
					}
					
					.size-option-label
					{
						width: 100%;
					}
				</style>
				<script src="catalog/view/javascript/pso/jquery.numeric.js" type="text/javascript"></script>
				<script type="text/javascript"><!--
					$(document).ready(function(){
						if (typeof numeric !== 'undefined' && $.isFunction(numeric))
							$(".pso-width-input.form-control, .pso-height-input.form-control").numeric();
							
						$(".pso-width-input").keyup(function(){ 
							var width = $(this).val();
							if(!isNaN(width) && width != '') //is number
							{
								var proportionalSizeWidth = $(this).parents('.form-group').find('.proportional_size_width').val();
								var proportionalSizeHeight = $(this).parents('.form-group').find('.proportional_size_height').val();
								
								if(!isNaN(proportionalSizeWidth) 
									&& !isNaN(proportionalSizeHeight)
									&& proportionalSizeWidth != ''
									&& proportionalSizeHeight != ''
								)
								{
									var height = Math.round(width / proportionalSizeWidth * proportionalSizeHeight * 100) / 100;
									$(this).parents('.form-group').find('.pso-height-input').val(height);
								}
							}
							
							updatePriceBySize();
						});
						
						$(".pso-height-input").keyup(function(){					
							var height = $(this).val();
							if(!isNaN(height) && height != '') //is number
							{
								var proportionalSizeWidth = $(this).parents('.form-group').find('.proportional_size_width').val();
								var proportionalSizeHeight = $(this).parents('.form-group').find('.proportional_size_height').val();
								
								if(!isNaN(proportionalSizeWidth) 
									&& !isNaN(proportionalSizeHeight)
									&& proportionalSizeWidth != ''
									&& proportionalSizeHeight != ''
								)
								{
									var width = Math.round(height / proportionalSizeHeight * proportionalSizeWidth * 100) / 100;
									$(this).parents('.form-group').find('.pso-width-input').val(width);
								}
							}
							
							updatePriceBySize();
						});
						
						$("input[name='quantity']").keyup(function(){ 
							updatePriceBySize();
						});
						
						$("#product").on('change', function(){ 
							updatePriceBySize();
						});
						
						function updatePriceBySize()
						{
							$.ajax({
								url: 'index.php?route=product/product/add',
								type: 'post',
								data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
								dataType: 'json',
								success: function(json) {
									$('.alert, .text-danger').remove();
									$('.form-group').removeClass('has-error');

									if (json['error']) {
										if (json['error']['option']) {
											for (i in json['error']['option']) {
												var element = $('#input-option' + i.replace('_', '-'));
												
												if (element.parent().hasClass('input-group')) {
													element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
												} else {
													element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
												}
											}
										}
										
										if (json['error']['recurring']) {
											$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
										}
										
										// Highlight any found errors
										$('.text-danger').parent().addClass('has-error');
									}
									
									else {
										
										$('#total_price_ex_tax').html(json['total_extax']);
										$('.product-price, #total_price').html(json['total']);
									}	
								}
							});
						}
					});
				//--></script>
				<!--EOF Product Size Option-->
			]]></add>
		</operation>
        
    </file>
	
</modification>

 

 

 

нужно чтобы он работал в стандартном модуле featured.

Вот видео для лучшего понимания 

 



кто может решить этот вопрос? стоимость и сроки

Змінено користувачем AlexMax13
Надіслати
Поділитися на інших сайтах


  • AlexMax13 changed the title to Добавить возможность вывода модуля в стандартном модуле featured (рекомендуемые) на платной основе

Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.