Je me réponds à moi même vu que j'ai réussi à résoudre le problème. Donc je vous poste le code de 2 fonctions javascript qui ne prenait pas en compte le ' dans la page product_form.tpl
Sinon je pense sincèrement que opencart est la meilleure solution e-commerce publiée depuis prestashop (en mieux oui oui)
Back office plus simple
Module facile à développer => il m'a fallu 3h pour faire le module ATOS
Bref, je suis prêt à vraiment contribuer au développement open source de cette solution
- Code: Tout sélectionner
function addOption() {
html = '<div id="option' + option_row + '" class="option">';
html += '<table class="form">';
html += '<tr>';
html += '<td><?php echo $entry_option; ?></td>';
html += '<td>';
<?php foreach ($languages as $language) { ?>
<?php if ($language['language_id'] == $language_id) { ?>
html += '<input type="text" name="product_option[' + option_row + '][language][<?php echo $language['language_id']; ?>][name]" value="Option ' + option_row + '" onkeyup="$(\'#option option[value=\\\'option' + option_row + '\\\']\').text(this.value);" /> <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />';
<?php } else { ?>
html += '<input type="text" name="product_option[' + option_row + '][language][<?php echo $language['language_id']; ?>][name]" value="Option ' + option_row + '" /> <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />';
<?php } ?>
<?php } ?>
html += '</td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_sort_order; ?></td>';
html += '<td><input type="text" name="product_option[' + option_row + '][sort_order]" value="" size="2" /></td>';
html += '</tr>';
html += '<tr>';
html += '<td colspan="2"><a onclick="addOptionValue(\'' + option_row + '\');" class="button"><span><?php echo addslashes($button_add_option_value); ?></span></a> <a onclick="removeOption(\'' + option_row + '\');" class="button"><span><?php echo $button_remove; ?></span></a></td>';
html += '</tr>';
html += '</table>';
html += '</div>';
$('#options').append(html);
$('#option').append('<option value="option' + option_row + '"><?php echo $text_option; ?> ' + option_row + '</option>');
$('#option option[value=\'option' + option_row + '\']').attr('selected', 'selected');
$('#option').trigger('change');
option_row++;
}
- Code: Tout sélectionner
function addOptionValue(option_id) {
html = '<div id="option' + option_id + '_' + option_value_row + '" class="option">';
html += '<table class="form">';
html += '<tr>';
html += '<td><?php echo addslashes($entry_option_value); ?></td>';
html += '<td>';
<?php foreach ($languages as $language) { ?>
<?php if ($language['language_id'] == $language_id) { ?>
html += '<input type="text" name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][language][<?php echo $language['language_id']; ?>][name]" value="Option Value ' + option_value_row + '" onkeyup="$(\'#option option[value=\\\'option' + option_id + '_' + option_value_row + '\\\']\').text(\' \' + this.value);" /> <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />';
<?php } else { ?>
html += '<input type="text" name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][language][<?php echo $language['language_id']; ?>][name]" value="Option Value ' + option_value_row + '" /> <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />';
<?php } ?>
<?php } ?>
html += '</td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_quantity; ?></td>';
html += '<td><input type="text" name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][quantity]" value="' + '" size="2" /></td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_subtract; ?></td>';
html += '<td><select name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][subtract]">';
html += '<option value="1"><?php echo $text_yes; ?></option>';
html += '<option value="0"><?php echo $text_no; ?></option>';
html += '</select></td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_price; ?></td>';
html += '<td><input type="text" name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][price]" value="" /></td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_prefix; ?></td>';
html += '<td><select name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][prefix]">';
html += '<option value="+"><?php echo $text_plus; ?></option>';
html += '<option value="-"><?php echo $text_minus; ?></option>';
html += '</select></td>';
html += '</tr>';
html += '<tr>';
html += '<td><?php echo $entry_sort_order; ?></td>';
html += '<td><input type="text" name="product_option[' + option_id + '][product_option_value][' + option_value_row + '][sort_order]" value="" size="2" /></td>';
html += '</tr>';
html += '<tr>';
html += '<td colspan="2"><a onclick="removeOptionValue(\'' + option_id + '_' + option_value_row + '\');" class="button"><span><?php echo $button_remove; ?></span></a></td>';
html += '</tr>';
html += '</table>';
html += '</div>';
$('#options').append(html);
option = $('#option option[value^=\'option' + option_id + '_\']:last');
if (option.size()) {
option.after('<option value="option' + option_id + '_' + option_value_row + '"> <?php echo addslashes($text_option_value); ?> ' + option_value_row + '</option>');
} else {
$('#option option[value=\'option' + option_id + '\']').after('<option value="option' + option_id + '_' + option_value_row + '"> <?php echo addslashes($text_option_value); ?> ' + option_value_row + '</option>');
}
$('#option option[value=\'option' + option_id + '_' + option_value_row + '\']').attr('selected', 'selected');
$('#option').trigger('change');
option_value_row++;
}