@@ -33,7 +35,7 @@ A generic modal creation dialog template. Parameters
diff --git a/templates/admin/default/includes/image-upload-form.html b/templates/admin/default/includes/image-upload-form.html
index de90408d8..00915e8a7 100644
--- a/templates/admin/default/includes/image-upload-form.html
+++ b/templates/admin/default/includes/image-upload-form.html
@@ -10,7 +10,8 @@ Parameters:
diff --git a/templates/admin/default/includes/product-details-tab.html b/templates/admin/default/includes/product-details-tab.html
index 46ddfed86..238b7d987 100644
--- a/templates/admin/default/includes/product-details-tab.html
+++ b/templates/admin/default/includes/product-details-tab.html
@@ -37,6 +37,10 @@
{/form_field}
{/loop}
+
{intl l='Default pricing'}
+
+
{intl l="The default pricing is used with product that do not have any combinations. It is also used for product with combinations which share the same pricing information"}
+
{* -- Pricing ------------------------------------------------------- *}
@@ -173,81 +177,193 @@
{* -- Attribute combinations -------------------------------------------- *}
-
-
+ {module_include location='product_before_combinations'}
-
{intl l='Attribute Combinations'}
+
+
+
- {module_include location='product_before_combinations'}
+
+
+ {intl l='Attribute Combinations'}
- {ifloop rel="product-attributes"}
-
+
+
+
+
+ {module_include location='product_after_combinations'}
+
+
+{* -- Adding a new combination ------------------------------------------------- *}
+
+{* Capture the dialog body, to pass it to the generic dialog *}
+
+{capture "combination_creation_dialog"}
+
+
+
+
+
+ {intl l="Attribute"} :
+
+ {intl l='Select an attribute...'}
+ {loop name="product-attributes" type="attribute" product=$product_id backend_context="1" lang=$edit_language_id}
+ {$TITLE}
+ {/loop}
+
+ {intl l='Select an attribute and click (+) to view available values'}
+
-
-
+
{intl l='Select a value click (+) to add it to the combination'}
+
-
-
- {intl l="No available value for this attribute"}
-
-
+
+
+ {intl l="No available value for this attribute"}
+
+
-
-
-
- {/ifloop}
+ {form_field form=$form field='isnew'}
+
+ {/form_field}
- {elseloop rel="product-attributes"}
-
- {intl l="No attributes are attached to this product."}
-
- {/elseloop}
+{/capture}
- {module_include location='product_after_combinations'}
+{include
+ file = "includes/generic-create-dialog.html"
-
{* com *}
-
{* row *}
-
\ No newline at end of file
+ dialog_id = "combination_creation_dialog"
+ dialog_title = {intl l="Create a new combination"}
+ dialog_body = {$smarty.capture.combination_creation_dialog nofilter}
+
+ dialog_ok_label = {intl l="Create this combination"}
+
+ form_action = {url path='/admin/product/combination/add'}
+ form_enctype = ''
+ form_error_message = ''
+
+ ok_button_id = "combination_creation_dialog_ok"
+}
+
+
+{* -- Delete combination confirmation dialog ----------------------------------- *}
+
+{capture "combination_delete_dialog"}
+
+
+
+
+
+
+ {module_include location='category_delete_form'}
+
+{/capture}
+
+{include
+ file = "includes/generic-confirm-dialog.html"
+
+ dialog_id = "combination_delete_dialog"
+ dialog_title = {intl l="Delete a combunation"}
+ dialog_message = {intl l="Do you really want to delete this combination ?"}
+
+ form_action = {url path='/admin/product/combination/delete'}
+ form_content = {$smarty.capture.combination_delete_dialog nofilter}
+}
diff --git a/templates/admin/default/product-edit.html b/templates/admin/default/product-edit.html
index 8454541dc..4cf81e478 100644
--- a/templates/admin/default/product-edit.html
+++ b/templates/admin/default/product-edit.html
@@ -126,124 +126,137 @@
{/javascripts}
-
-
+
+
-
+ });
+
+ // Load active tab
+ $('.nav-tabs a[href="#{$current_tab}"]').trigger("click");
+
+ // -- Product details management tab ---------------------------------------
+
+ // Load value on attribute selection
+ $('#attribute_id').change(function(event) {
+ var val = $(this).val();
+
+ if (val != "") {
+ $.ajax({
+ url : '{url path="/admin/product/$product_id/attribute-values/"}' + $(this).val() + '.xml',
+ type : 'get',
+ dataType : 'json',
+ success : function(json) {
+ $('#attribute_value_id :not(:first-child)').remove();
+
+ var have_content = false;
+
+ $.each(json, function(idx, value) {
+ $('#attribute_value_id').append($('
').text(value.title).attr('value', value.id));
+
+ have_content = true; // Lame...
+ });
+
+ if (have_content) {
+ $('#attribute_value_selector_empty').addClass('hide');
+ $('#attribute_value_selector').removeClass('hide');
+ }
+ else {
+ $('#attribute_value_selector_empty').removeClass('hide');
+ $('#attribute_value_selector').addClass('hide');
+ }
+
+ }
+ });
+ }
+ else {
+ $('#attribute_value_selector_empty').addClass('hide');
+ $('#attribute_value_selector').addClass('hide');
+ }
+ });
+
+ // Add selected value to the combination
+ $('.add-value-to-combination').click(function(event) {
+
+ // Hide error message
+ $('#combination_attributes_error').text('').addClass('hide');
+
+ // Select all elements
+ $('#combination_attributes option').prop('selected', 'selected');
+
+ $.ajax({
+ url : '{url path="/admin/product/$product_id/add-attribute-value-to-combination/"}'
+ + $('#attribute_value_id').val()
+ + '/'
+ + $('#combination_attributes').val()
+ + '.xml',
+ type : 'get',
+ dataType : 'json',
+ success : function(json) {
+ $('#combination_attributes option').remove();
+
+ var have_content = false;
+
+ $.each(json, function(idx, value) {
+ if (idx != 'error')
+ $('#combination_attributes').append($(' ').text(value.title).attr('value', value.id));
+ });
+
+ if (json.error)
+ $('#combination_attributes_error').text(json.error).removeClass('hide');
+
+ $('#attribute_id').val('').change();
+ }
+ });
+
+ event.preventDefault();
+ });
+
+ // Remove selected value from combination
+ $('.remove-value-from-combination').click(function() {
+
+ $('#combination_attributes option:selected').remove();
+
+ event.preventDefault();
+ });
+
+ // Set proper category ID in combination delete from
+ $('a.combination-delete').click(function(ev) {
+ $('#combination_delete_id').val($(this).data('id'));
+ });
+
+ // In create combination dialog, select all element of conbination list
+ $('#combination_creation_dialog_ok').click(function() {
+ $('#combination_attributes option').prop('selected', 'selected');
+ });
+
+});
+
+
+
{/block}
\ No newline at end of file