mod conversion request

ThemeBurn SupportForumsOpenCart ThemesBurnEnginemod conversion request

This topic has been marked as not a support question.

Hi need to get this mod working getting these errors can you help with it please

 

Here is the full vmod file 
<modification>
	<id><![CDATA[Related / Dependent options]]></id>
	<version><![CDATA[1.3.7]]></version>
	<vqmver><![CDATA[2.x]]></vqmver>
	<author><![CDATA[ITcraft | support@conceptlogic.ru]]></author>
	<file name="admin/controller/catalog/product.php">
		<operation error="log">
			<search position="before" index="1"><![CDATA[=> $product_option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'             => $product_option['master_option'],
			'master_option_data'		=> isset($product_option['master_option_data']) ? $product_option['master_option_data'] : array(),
			//EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" index="2"><![CDATA[=> $product_option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'             => $product_option['master_option'],
			'master_option_data'		=> isset($product_option['master_option_data']) ? $product_option['master_option_data'] : array(),
			'master_option_value'		=> isset($product_option['master_option_value']) ? $product_option['master_option_value'] : 0,
			//EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" index="1"><![CDATA['weight_prefix'           => $product_option_value['weight_prefix']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option_value'             => $product_option_value['master_option_value'],
			//EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[if (isset($this->error['warning'])) {]]></search>
			<add><![CDATA[//BOF Related Options

			//text
			$this->load->language('catalog/related_options');
			$this->data['entry_master_option'] = $this->language->get('entry_master_option');
			$this->data['entry_master_option_value'] = $this->language->get('entry_master_option_value');

			//EOF Related Options]]></add>
		</operation>
	</file>
	<file name="admin/model/catalog/product.php">
		<operation error="log">
			<search position="before"><![CDATA[foreach ($data['product_option'] as $product_option) {]]></search>
			<add><![CDATA[//BOF Related Options
			$previous_product_option_id = 0;
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="after"><![CDATA[$product_option_id = $this->db->getLastId();]]></search>
			<add><![CDATA[//BOF Related Options
			$this->db->query("UPDATE " . DB_PREFIX . "product_option SET master_option = '" . (int)$product_option['master_option'] . "' WHERE product_option_id = '" . $product_option_id . "'");
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="after"><![CDATA[option_value = '" . $this->db->escape($product_option['option_value']) . "', required = '" . (int)$product_option['required'] . "'");]]></search>
			<add><![CDATA[//BOF Related Options
			$product_option_id = $this->db->getLastId();
			$this->db->query("UPDATE " . DB_PREFIX . "product_option SET master_option = '" . (int)$product_option['master_option'] . "', master_option_value = '" . (int)$product_option['master_option_value'] . "' WHERE product_option_id = '" . $this->db->getLastId() . "'");
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="after" offset="1"><![CDATA[foreach ($product_option['product_option_value'] as $product_option_value) {]]></search>
			<add><![CDATA[//BOF Related Options
			if ((int)$product_option['master_option']) {
				$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET master_option_value = '" . (int)$product_option_value['master_option_value'] . "' WHERE product_option_value_id = '" . $this->db->getLastId() . "'");
			}
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[=> $product_option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'             => $product_option['master_option'],
			'master_option_value'       => $product_option['master_option_value'],
			'master_option_data'        => $this->getProductOption($product_id, $product_option['master_option']),
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA['weight_prefix'           => $product_option_value['weight_prefix']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option_value'             => $product_option_value['master_option_value'],
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" offset="1"><![CDATA[?>]]></search>
			<add><![CDATA[//BOF Related Options
			public function getProductOption($product_id, $option_id) {
				$product_option_data = array();

				$product_option_query = $this->db->query("SELECT * 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_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' AND po.option_id = '" . (int)$option_id . "' ORDER BY o.sort_order");

				$product_option = $product_option_query->row;
				if ($product_option) {
					if ($product_option['type'] == 'select' || $product_option['type'] == 'radio' || $product_option['type'] == 'checkbox' || $product_option['type'] == 'image') {
						$product_option_value_data = array();	

						$product_option_value_query = $this->db->query("SELECT * 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_id = '" . (int)$product_option['product_option_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order");

						foreach ($product_option_value_query->rows as $product_option_value) {
							$product_option_value_data[] = array(
								'product_option_value_id' => $product_option_value['product_option_value_id'],
								'option_value_id'         => $product_option_value['option_value_id'],
								'name'                    => $product_option_value['name'],
								'image'                   => $product_option_value['image'],
								'quantity'                => $product_option_value['quantity'],
								'subtract'                => $product_option_value['subtract'],
								'price'                   => $product_option_value['price'],
								'price_prefix'            => $product_option_value['price_prefix'],
								'points'                  => $product_option_value['points'],
								'points_prefix'           => $product_option_value['points_prefix'],
								'weight'                  => $product_option_value['weight'],
								'weight_prefix'           => $product_option_value['weight_prefix']
							);
						}

						$product_option_data = array(
							'product_option_id'    => $product_option['product_option_id'],
							'option_id'            => $product_option['option_id'],
							'name'                 => $product_option['name'],
							'type'                 => $product_option['type'],
							'product_option_value' => $product_option_value_data,
							'required'             => $product_option['required']
						);
					} else {
						$product_option_data = array(
							'product_option_id' => $product_option['product_option_id'],
							'option_id'         => $product_option['option_id'],
							'name'              => $product_option['name'],
							'type'              => $product_option['type'],
							'option_value'      => $product_option['option_value'],
							'required'          => $product_option['required']
						);
					}
				}

				return $product_option_data;
			}
			// EOF Related Options]]></add>
		</operation>
	</file>
	<file name="admin/view/*/catalog/product_form.tpl">
		<operation error="log">
			<search position="before"><![CDATA[<?php if ($product_option['type'] == 'text') { ?>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
	          <tr>
	            <td><?php echo $entry_master_option; ?></td>
	            <td><select name="product_option[<?php echo $option_row; ?>][master_option]">
	            	<option value="0"><?php echo $text_no; ?></option>
	            	<?php foreach ($product_options as $product_option1) { ?>
	            		<?php if ($product_option1['option_id'] != $product_option['option_id']) { ?>
	                	<?php if ($product_option1['option_id'] == $product_option['master_option']) { ?>
	                		<option value="<?php echo $product_option1['option_id']; ?>" selected="selected"><?php echo $product_option1['name']; ?></option>
	                	<?php } else { ?>
	                		<option value="<?php echo $product_option1['option_id']; ?>"><?php echo $product_option1['name']; ?></option>
	                	<?php } ?>
	                	<?php } ?>
	                <?php } ?>
	              </select></td>
	          </tr>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="after" index="1,2,3,4,5,6"><![CDATA[<?php if ($product_option['type'] == ]]></search>
			<add><![CDATA[<!--BOF Related Options-->
	          <tr>
	            <td><?php echo $entry_master_option_value; ?></td>
	            <td>
	            	<?php if ($product_option['master_option']) { ?>
	            	<select name="product_option[<?php echo $option_row; ?>][master_option_value]" value="<?php echo $product_option['option_value']; ?>">
	            		<option value="0"><?php echo $text_no; ?></option>
		            	<?php foreach ($product_option['master_option_data']['product_option_value'] as $master_option_value) { ?>
			              	<?php if ($master_option_value['option_value_id'] == $product_option['master_option_value']) { ?>
			              		<option value="<?php echo $master_option_value['option_value_id']; ?>" selected="selected"><?php echo $master_option_value['name']; ?></option>
			              	<?php } else { ?>
			              		<option value="<?php echo $master_option_value['option_value_id']; ?>"><?php echo $master_option_value['name']; ?></option>
			              	<?php } ?>
			            <?php } ?>
	            	</select>
	            	<?php } else { ?>
		            - <input type="hidden" name="product_option[<?php echo $option_row; ?>][master_option_value]" value="0">
		            <?php }?>
	        	</td>
	          </tr>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="after" index="1"><![CDATA[<td class="right"><?php echo $entry_weight; ?></td>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<td class="right"><?php echo $entry_master_option_value; ?></td>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[<td class="left"><a onclick="$('#option-value-row<?php echo $option_value_row; ?>').remove();" class="button"><?php echo $button_remove; ?></a></td>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<td class="right">
				<?php if ($product_option['master_option']) { ?>
				<select name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][master_option_value]">
	              <?php foreach ($product_option['master_option_data']['product_option_value'] as $master_option_value) { ?>
	              	<?php if ($master_option_value['option_value_id'] == $product_option_value['master_option_value']) { ?>
	              		<option value="<?php echo $master_option_value['option_value_id']; ?>" selected="selected"><?php echo $master_option_value['name']; ?></option>
	              	<?php } else { ?>
	              		<option value="<?php echo $master_option_value['option_value_id']; ?>"><?php echo $master_option_value['name']; ?></option>
	              	<?php } ?>
	              <?php } ?>
	            </select>
	            <?php } else { ?>
	            <center>-</center>
	            <input type="hidden" name="product_option[<?php echo $option_row; ?>][product_option_value][<?php echo $option_value_row; ?>][master_option_value]" value="0">
	            <?php }?>
            </td>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="replace" index="1"><![CDATA[<td colspan="6"></td>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<td colspan="7"></td>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="after" offset="5"><![CDATA[html += '		<td><?php echo $entry_required; ?></td>';]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			html += '	  <tr>';
			html += '		<td><?php echo $entry_master_option; ?></td>';
			html += '       <td><select name="product_option[' + option_row + '][master_option]">';
			html += '	    <option value="0"><?php echo $text_no; ?></option>';
			html += '	    </select></td>';
			html += '     </tr>';
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[<select id="option-values<?php echo $option_row; ?>" style="display: none;">]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<?php if ($product_option['master_option']) { ?>
			<select id="master-option-values<?php echo $option_row; ?>" style="display: none;">
              <?php foreach ($product_option['master_option_data']['product_option_value'] as $master_option_value) { ?>
              	<option value="<?php echo $master_option_value['option_value_id']; ?>"><?php echo $master_option_value['name']; ?></option>
              <?php } ?>
            </select>
            <?php } ?>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="after"><![CDATA[html += '    <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight]" value="" size="5" /></td>';]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			if ($('#master-option-values' + option_row).size() > 0) {
				html += '    <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][master_option_value]">';
				html += $('#master-option-values' + option_row).html();
				html += '    </select></td>';
			} else {
				html += '<td class="right"><center>-</center><input type="hidden" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][master_option_value]" value="0"></td>';
			}
			<!--EOF Related Options-->]]></add>
		</operation>
	</file>

	<file name="catalog/controller/product/product.php">
		<operation error="log">
			<search position="before" index="1"><![CDATA[=> $option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'          => $option['master_option'],
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" index="2"><![CDATA[=> $option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'          => $option['master_option'],
			'master_option_value'    => $option['master_option_value'],
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[=> $option_value['price_prefix']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option_value'             => $option_value['master_option_value'],
			// EOF Related Options]]></add>
		</operation>
	<operation error="log">
			<search position="after"><![CDATA[$option_value_data = array();]]></search>
			<add><![CDATA[//BOF Related Options
			$related_options = $this->config->get('related_options');
				if (isset($related_options['residue_on']) && $related_options['residue_on']) {
					foreach ($option['option_value'] as $option_value) {
							if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
								$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
							} else {
								$price = false;
							}

							$option_value_data[] = array(
								'product_option_value_id' => $option_value['product_option_value_id'],
								'option_value_id'         => $option_value['option_value_id'],
								'name'                    => $option_value['name'],
								'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
								'price'                   => $price,
//BOF Related Options
			'master_option_value'             => $option_value['master_option_value'],
			// EOF Related Options
								'price_prefix'            => $option_value['price_prefix']
							);
					}
				} else {
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" index="1"><![CDATA[$this->data['options'][] = array(]]></search>
			<add><![CDATA[//BOF Related Options
			}
			// EOF Related Options]]></add>
		</operation>
	</file>
	<file name="catalog/model/catalog/product.php">
		<operation error="log">
			<search position="before" index="1"><![CDATA[=> $product_option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'          => $product_option['master_option'],
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before" index="2"><![CDATA[=> $product_option['required']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option'          => $product_option['master_option'],
			'master_option_value'    => $product_option['master_option_value'],
			// EOF Related Options]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[=> $product_option_value['weight_prefix']]]></search>
			<add><![CDATA[//BOF Related Options
			'master_option_value'             => $product_option_value['master_option_value'],
			// EOF Related Options]]></add>
		</operation>
	</file>	

	<file name="catalog/view/theme/*/template/product/product.tpl">
		<operation error="log" info="all options">
			<search position="replace"><![CDATA[<div id="option-<?php echo $option['product_option_id']; ?>" class="option">]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<div id="option-<?php echo $option['product_option_id']; ?>" class="option" <?php echo 'master-option="' . $option['master_option'] . '"' . ' option="' . $option['option_id'] . '"'; ?>>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="select options">
			<search position="replace"><![CDATA[<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<option value="<?php echo $option_value['product_option_value_id']; ?>" <?php echo 'master-option-value="' . $option_value['master_option_value'] . '"' . ' option-value="' . $option_value['option_value_id'] . '"'; ?>><?php echo $option_value['name']; ?>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="radio options">
			<search position="replace"><![CDATA[<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" <?php echo 'master-option-value="' . $option_value['master_option_value'] . '"' . ' option-value="' . $option_value['option_value_id'] . '"'; ?> />
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="checkbox options">
			<search position="replace"><![CDATA[<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" <?php echo 'master-option-value="' . $option_value['master_option_value'] . '"' . ' option-value="' . $option_value['option_value_id'] . '"'; ?> />
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="text options">
			<search position="replace"><![CDATA[<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> />
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="textarea options">
			<search position="replace"><![CDATA[<textarea name="option[<?php echo $option['product_option_id']; ?>]" cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<textarea name="option[<?php echo $option['product_option_id']; ?>]" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> cols="40" rows="5"><?php echo $option['option_value']; ?></textarea>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="file options">
			<search position="replace"><![CDATA[<input type="button" value="<?php echo $button_upload; ?>" id="button-option-<?php echo $option['product_option_id']; ?>" class="button">]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="button" value="<?php echo $button_upload; ?>" id="button-option-<?php echo $option['product_option_id']; ?>" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> class="button">
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="date options">
			<search position="replace"><![CDATA[<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="date" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> class="date" />
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="datetime options">
			<search position="replace"><![CDATA[<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="datetime" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> class="datetime" />
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="time options">
			<search position="replace"><![CDATA[<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" class="time" />]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['option_value']; ?>" <?php echo 'master-option-value="' . $option['master_option_value'] . '"'; ?> class="time" />
			<!--EOF Related Options-->]]></add>
		</operation>

		<operation error="log">
			<search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<script type="text/javascript"><!--
				$(document).ready(function(){
					$('.option[master-option!=0]').hide();

					// SELECT OPTION
					$('.option select').bind('change', function(){
						var option_value = $(this).children('option:selected').attr('option-value');
						var $related_options = $('.option[master-option=' + $(this).parent('.option').attr('option') + ']');
						if ($(this).val() != '') {
							updateOptionList($related_options, option_value);
						} else {
							$related_options.slideUp();
						}
						clearOption($related_options);
					});

					// RADIO OPTION
					$('.option input[type=radio]').bind('change', function(){
						var option_value = $(this).attr('option-value');
						var $related_options = $('.option[master-option = ' + $(this).parents('.option').attr('option') + ']');
						if ($('input[name=\'' + $(this).attr('name') + '\']:checked').size() != '') {
							updateOptionList($related_options, option_value);
						} else {
							$related_options.slideUp();
						}
						clearOption($related_options);
					});

					// CHECKBOX OPTION
					$('.option input[type=checkbox]').bind('change', function(){
						var option_value = [];
						$('.option input[name=\'' + $(this).attr('name') + '\']:checked').each(function(){
							option_value.push($(this).attr('option-value'));
						});
						var $related_options = $('.option[master-option = ' + $(this).parents('.option').attr('option') + ']');
						if ($('input[name=\'' + $(this).attr('name') + '\']:checked').size() != '') {
							updateOptionList($related_options, option_value);
						} else {
							$related_options.slideUp();
						}
						clearOption($related_options);
					});

					// TEXT INPUT AND TEXTAREA OPTION
					$('.option input[type=text], .option textarea').bind('change', function(){
						var $related_options = $('.option[master-option = ' + $(this).parent('.option').attr('option') + ']');
						if ($(this).val() != '') {
							$related_options.slideDown();
						} else {
							$related_options.slideUp();
						}
						clearOption($related_options);
					});
				});
				function updateOptionList($related_options, option_value) {
					// select options
					$related_options.find('option[master-option-value!=0]').each(function(){
						if ($(this).parent('span').size() == 0) {
							$(this).wrap("<span>");
						}
					});
					$related_options.find('input[master-option-value!=0]').hide();
					$related_options.find('input[master-option-value!=0]').next('label').hide();
					$related_options.find('input[master-option-value!=0]').next('label').next('br').hide();
					$related_options.find('textarea[master-option-value!=0]').hide();
					// image options
					$related_options.find('input[master-option-value!=0]').each(function(){
						if ($(this).closest('table').hasClass('option-image')) {
							$(this).closest('tr').hide();
						}
					});

					if (typeof(option_value) == "string") {
						option_value = [option_value];
					}
					for (var i in option_value) {
						$related_options.find('option[master-option-value=' + option_value[i] + '], option[value=\'\']').each(function(){
							if ($(this).parent('span').size() != 0) {
								$(this).unwrap();
							}
						});
						$related_options.find('input[master-option-value=' + option_value[i] + ']').show();
						$related_options.find('input[master-option-value=' + option_value[i] + ']').next('label').show();
						$related_options.find('input[master-option-value=' + option_value[i] + ']').next('label').next('br').show();
						$related_options.find('textarea[master-option-value=' + option_value[i] + ']').show();
						// image options
						$related_options.find('input[master-option-value=' + option_value[i] + ']').each(function(){
							if ($(this).closest('table').hasClass('option-image')) {
								$(this).closest('tr').show();
							}
						});
					}

					$related_options.each(function(){
						var visible_options = 0;
						for (var i in option_value) {
							visible_options += $(this).find('[master-option-value=' + option_value[i] + ']').size()*1;
							visible_options += $(this).find('[master-option-value=0]').size()*1;
						}
						if ($(this).find('option, input, textarea').size() != 0 && visible_options == 0) {
							$(this).slideUp();
						} else {
							$(this).slideDown();
						}
					});
				}
				function clearOption($option_container) {
					$option_container.find('select').val('');
					$option_container.find('input[type=radio], input[type=checkbox]').removeAttr('checked');
					//$option_container.find('input[type=text], textarea').attr('value', '');
				}
			//--></script>
			<?php
				$related_options = $this->config->get('related_options');
				if (isset($related_options['price_adjustment_on']) && $related_options['price_adjustment_on']) {
			?>
			<script type="text/javascript"><!--
				// changing price
				var num = <?php echo $related_options['price_residue'] ?>;
				var special = <?php echo (!$special) ? 'false' : 'true'; ?>;
				var $price = $('.product-info .price');

				var regex_price = /[0-9]+[\.]{0,1}[0-9]*/;
				var regex_add_price = /([\+\-])[^0-9]*([0-9]+[\.]{0,1}[0-9]*)/;
				var regex_replace_price = /([0-9]+[\.]{0,1}[0-9]*)/;
				var initial_price = regex_price.exec('<?php echo (!$special) ? $price : $special; ?>');

				$('.options input[type=radio], .options input[type=checkbox], select').bind('change', function(){
					total_price = initial_price[0]*1;
					$('.options input[type=radio]:checked, .options input[type=checkbox]:checked').each(function(){
						additional_price = regex_add_price.exec($('label[for=' + $(this).attr('id') + '] span').text());
						if (additional_price != null && additional_price != '' && additional_price != undefined) {
							if (additional_price[1] == '+') {
								total_price = total_price*1 + additional_price[2]*1;
							} else if (additional_price[1] == '-') {
								total_price = total_price*1 - additional_price[2]*1;
							}
						}
					});
					$('option:selected').each(function(){
						additional_price = regex_add_price.exec($(this).text());
						if (additional_price != null && additional_price != '' && additional_price != undefined) {
							if (additional_price[1] == '+') {
								total_price = total_price*1 + additional_price[2]*1;
							} else if (additional_price[1] == '-') {
								total_price = total_price*1 - additional_price[2]*1;
							}
						}
					});
					if (special) {
						$price.find('.price-old').remove();
					}
					$price.html($price.html().replace(regex_replace_price, total_price.toFixed(num)));
				});
			//--></script>
			<?php } ?>
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log">
			<search position="replace"><![CDATA[$('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			$('#option-' + i).append('<span class="error">' + json['error']['option'][i] + '</span>');
			<!--EOF Related Options-->]]></add>
		</operation>
		<operation error="log" info="time options">
			<search position="replace"><![CDATA[(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)]]></search>
			<add><![CDATA[<!--BOF Related Options-->
			<span>(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)</span>
			<!--EOF Related Options-->]]></add>
		</operation>
	</file>
</modification>
July 5, 2016 at 2:52 pm #49313

http://www.opencart.com/index.php?route=extension/extension/info&extension_id=15724

  • This reply was modified 502 days ago by  TIM1084.
July 5, 2016 at 2:57 pm #49315
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.