Skip to content

Instantly share code, notes, and snippets.

@illnino
Last active December 31, 2015 15:09
Show Gist options
  • Save illnino/8005274 to your computer and use it in GitHub Desktop.
Save illnino/8005274 to your computer and use it in GitHub Desktop.
<script type="text/javascript"><!--
var option_value_row = 11;
function addOptionValue(option_row) {
html = '<tbody id="option-value-row' + option_value_row + '">';
html += ' <tr>';
html += ' <td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][option_value_id]">';
html += $('#option-values' + option_row).html();
html += ' </select><input type="hidden" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][product_option_value_id]" value="" /></td>';
html += ' <td class="right"><input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][quantity]" value="" size="3" /></td>';
html += ' <td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1">Yes</option>';
html += ' <option value="0">No</option>';
html += ' </select></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" /></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][points_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][points]" value="" size="5" /></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight]" value="" size="5" /></td>';
html += ' <td class="left"><a onclick="$(\'#option-value-row' + option_value_row + '\').remove();" class="button">Remove</a></td>';
html += ' </tr>';
html += '</tbody>';
$('#option-value' + option_row + ' tfoot').before(html);
html = ' <tr>';
html += ' <td colspan="7">';
html += ' <p>Option Discount:</p>';
html += ' <table class="list pod-list" id="pod' + option_value_row + '">';
html += ' <thead>';
html += ' <tr>';
html += ' <td class="left">Customer Group:</td>';
html += ' <td class="left nowrap">Quantity:<br/><span class=\"help\">Not stock.</span></td>';
html += ' <td class="left">Use Option Price as Base Price:</td>';
html += ' <td class="left">Price:</td>';
html += ' <td class="left">Special:</td>';
html += ' <td class="left">Use Option Points as Base Points:</td>';
html += ' <td class="left">Points:</td>';
html += ' <td class="left">Priority:</td>';
html += ' <td class="left">Date Start:</td>';
html += ' <td class="left">Date End:</td>';
html += ' <td></td>';
html += ' </tr>';
html += ' </thead>';
html += ' <tbody class="tfoot">';
html += ' <tr>';
html += ' <td colspan="11" class="right"><a onclick="addOptionDiscount(' + option_row + ', ' + option_value_row + ');" class="button"><span>Add Discount</span></a></td>';
html += ' </tr>';
html += ' </tbody>';
html += ' </table>';
html += ' </td>';
html += ' </tr>';
$('#option-value-row' + option_value_row).append(html);
option_value_row++;
}
//--></script>
<script type="text/javascript"><!--
var option_value_row = 11;
function addOptionValue(option_row) {
html = '<tbody id="option-value-row' + option_value_row + '">';
html += ' <tr>';
html += ' <td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][option_value_id]">';
html += $('#option-values' + option_row).html();
html += ' </select><input type="hidden" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][product_option_value_id]" value="" /></td>';
html += ' <td class="right"><input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][quantity]" value="" size="3" /></td>';
html += ' <td class="left"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][subtract]">';
html += ' <option value="1">Yes</option>';
html += ' <option value="0">No</option>';
html += ' </select></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][price]" value="" size="5" /></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][points_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][points]" value="" size="5" /></td>';
html += ' <td class="right"><select name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight_prefix]">';
html += ' <option value="+">+</option>';
html += ' <option value="-">-</option>';
html += ' </select>';
html += ' <input type="text" name="product_option[' + option_row + '][product_option_value][' + option_value_row + '][weight]" value="" size="5" /></td>';
html += ' <td class="left"><a onclick="$(\'#option-value-row' + option_value_row + '\').remove();" class="button">Remove</a></td>';
html += ' </tr>';
html += '</tbody>';
$('#option-value' + option_row + ' tfoot').before(html);
html = ' <tr>';
html += ' <td colspan="7">';
html += ' <p>Option Discount:</p>';
html += ' <table class="list pod-list" id="pod' + option_value_row + '">';
html += ' <thead>';
html += ' <tr>';
html += ' <td class="left">Customer Group:</td>';
html += ' <td class="left nowrap">Quantity:<br/><span class=\"help\">Not stock.</span></td>';
html += ' <td class="left">Use Option Price as Base Price:</td>';
html += ' <td class="left">Price:</td>';
html += ' <td class="left">Special:</td>';
html += ' <td class="left">Use Option Points as Base Points:</td>';
html += ' <td class="left">Points:</td>';
html += ' <td class="left">Priority:</td>';
html += ' <td class="left">Date Start:</td>';
html += ' <td class="left">Date End:</td>';
html += ' <td></td>';
html += ' </tr>';
html += ' </thead>';
html += ' <tbody class="tfoot">';
html += ' <tr>';
html += ' <td colspan="11" class="right"><a onclick="addOptionDiscount(' + option_row + ', ' + option_value_row + ');" class="button"><span>Add Discount</span></a></td>';
html += ' </tr>';
html += ' </tbody>';
html += ' </table>';
html += ' </td>';
html += ' </tr>';
$('#option-value-row' + option_value_row).append(html);
option_value_row++;
}
//--></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment