Merge branch 'master' of github.com:thelia/thelia
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse-{$LOOP_COUNT}">
|
||||
{$TITLE|strip_tags nofilter} - {$DATE}
|
||||
{$TITLE|strip_tags nofilter} - {format_date timestamp=$DATE output='date'}
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
<a href="{$URL}" target="_blank" class="btn btn-defaut btn-primary"><span class="glyphicon glyphicon-book"></span> {intl l='Lire la suite'}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
</div>
|
||||
@@ -4,7 +4,7 @@ $(function($){
|
||||
|
||||
Dropzone.autoDiscover = false;
|
||||
|
||||
|
||||
|
||||
|
||||
// Remove image on click
|
||||
$.documentUploadManager.initDocumentDropZone = function() {
|
||||
@@ -14,7 +14,7 @@ $(function($){
|
||||
dictDefaultMessage : $('.btn-browse').html(),
|
||||
uploadMultiple: false,
|
||||
maxFilesize: 8
|
||||
});
|
||||
});
|
||||
|
||||
var totalFiles = 0,
|
||||
completedFiles = 0;
|
||||
@@ -40,8 +40,8 @@ $(function($){
|
||||
$.documentUploadManager.updateDocumentListAjax();
|
||||
$.documentUploadManager.onClickDeleteDocument();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
h3 {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Body (where all modal content resides)
|
||||
.modal-body {
|
||||
max-height: none;
|
||||
.scrollable {
|
||||
border: 1px solid @input-border;
|
||||
border-radius: @input-border-radius;
|
||||
height: 458px;
|
||||
overflow: auto;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
}
|
||||
@@ -336,9 +336,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
.existing-document {
|
||||
|
||||
.loading{
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// -- Drag & drop --
|
||||
.take{
|
||||
|
||||
|
||||
.draggable{
|
||||
border: 2px dashed @gray-light;
|
||||
margin-bottom: 10px;
|
||||
@@ -346,9 +353,9 @@
|
||||
|
||||
&:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.over{
|
||||
.drop-message{
|
||||
border-color: @brand-primary;
|
||||
@@ -358,8 +365,8 @@
|
||||
|
||||
}
|
||||
|
||||
.place{
|
||||
|
||||
.place{
|
||||
|
||||
.over{
|
||||
.drop-message{
|
||||
border-color: @brand-primary;
|
||||
@@ -368,10 +375,10 @@
|
||||
}
|
||||
|
||||
.panel-body{
|
||||
|
||||
|
||||
.draggable, .drag{
|
||||
margin: 5px 0;
|
||||
padding: 10px;
|
||||
padding: 10px;
|
||||
border: 1px dashed @gray-light;
|
||||
}
|
||||
|
||||
@@ -390,7 +397,7 @@
|
||||
}
|
||||
|
||||
.take, .place{
|
||||
|
||||
|
||||
.drop-message{
|
||||
width: 50%;
|
||||
margin: 10px auto;
|
||||
@@ -410,4 +417,11 @@
|
||||
.ui-draggable-dragging{
|
||||
z-index: 100;
|
||||
}
|
||||
}
|
||||
|
||||
// -- File Upoload drop zone ---------------------------------------------------
|
||||
|
||||
.dropzone {
|
||||
border: 1px dashed #ddd;
|
||||
padding: 20px;
|
||||
}
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<ul class="nav nav-tabs" id="tabbed-menu">
|
||||
<li {if $current_tab == 'general'}class="active"{/if}><a href="#general" data-toggle="tab">{intl l="General description"}</a></li>
|
||||
<li {if $current_tab == 'details'}class="active"{/if}><a href="#details" data-toggle="tab">{intl l="Details"}</a></li>
|
||||
<li {if $current_tab == 'associations'}class="active"{/if}><a href="#associations" data-toggle="tab">{intl l="Associations"}</a></li>
|
||||
<li {if $current_tab == 'images'}class="active"{/if}><a href="#images" data-toggle="tab">{intl l="Images"}</a></li>
|
||||
<li {if $current_tab == 'documents'}class="active"{/if}><a href="#documents" data-toggle="tab">{intl l="Documents"}</a></li>
|
||||
<li {if $current_tab == 'modules'}class="active"{/if}><a href="#modules" data-toggle="tab">{intl l="Modules"}</a></li>
|
||||
@@ -141,7 +141,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade {if $current_tab == 'details'}active in{/if}" id="details">
|
||||
<div class="tab-pane fade {if $current_tab == 'associations'}active in{/if}" id="associations">
|
||||
<div class="form-container">
|
||||
<div class="form-group">
|
||||
<form action="{url path='/admin/categories/related-content/add'}" id="related_content_form">
|
||||
@@ -153,10 +153,10 @@
|
||||
}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Related content'}</p>
|
||||
<p>{intl l='You can attach here some content to this product'}</p>
|
||||
<p>{intl l='You can attach here some content to this category'}</p>
|
||||
|
||||
<input type="hidden" name="category_id" value="{$category_id}" />
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
<input type="hidden" name="current_tab" value="associations" />
|
||||
|
||||
{ifloop rel="folders"}
|
||||
<div class="row">
|
||||
@@ -283,7 +283,7 @@
|
||||
<input type="hidden" name="content_id" id="content_delete_id" value="" />
|
||||
<input type="hidden" name="folder_id" id="folder_delete_id" value="" />
|
||||
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
<input type="hidden" name="current_tab" value="associations" />
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="folder edit-folder">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{include file="includes/folder-breadcrumb.html" editing_category="false" editing_content="true"}
|
||||
{include file="includes/folder-breadcrumb.html" editing_content="true"}
|
||||
|
||||
<div class="row">
|
||||
{loop name="content_edit" type="content" visible="*" id="{$content_id}" backend_context="1" lang="$edit_language_id"}
|
||||
@@ -131,7 +131,7 @@
|
||||
<div class="control-group">
|
||||
<lablel> </lablel>
|
||||
<div class="controls">
|
||||
<p>{intl l='Colder created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}</p>
|
||||
<p>{intl l='Folder created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="folder edit-folder">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{include file="includes/folder-breadcrumb.html" editing_category="true" }
|
||||
{include file="includes/folder-breadcrumb.html" }
|
||||
|
||||
<div class="row">
|
||||
{loop name="folder_edit" type="folder" visible="*" id="{$folder_id}" backend_context="1" lang="$edit_language_id"}
|
||||
@@ -182,7 +182,7 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="help-block">{intl l='Select a content and click (+) to add it to this category'}</span>
|
||||
<span class="help-block">{intl l='Select a content and click (+) to add it to this folder'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -28,12 +28,7 @@
|
||||
{elseloop rel="folder_title"}
|
||||
{intl l="Top level folders"}
|
||||
{/elseloop}
|
||||
{*
|
||||
<td class="object-title">
|
||||
<a href="{url path='admin/folders' parent=$ID}" title="{intl l='Browse this folder'}">
|
||||
{$TITLE}
|
||||
</a>
|
||||
</td>*}
|
||||
|
||||
{module_include location='folder_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.folder" access="CREATE"}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/content/folder/add'}" id="related_content_form">
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Additional categories'}</p>
|
||||
<p class="title title-without-tabs">{intl l='Additional Folders'}</p>
|
||||
<p>{intl l='A content could be attached to more than one folder. Select here the additional fodlers for this content.'}
|
||||
{loop name="default_folder" type="folder" id=$DEFAULT_FOLDER}
|
||||
{intl l='You can change the default folder (%title) in the "General" tab.' title=$TITLE}
|
||||
|
||||
@@ -29,3 +29,6 @@ Parameters:
|
||||
{/loop}
|
||||
</table>
|
||||
{/ifloop}
|
||||
{elseloop rel="document"}
|
||||
<div class="alert alert-info">{intl l='There is no documents attached to this %type.' type=$documentType}</div>
|
||||
{/elseloop}
|
||||
|
||||
@@ -30,6 +30,13 @@ $('#{$dialog_id}').on('hidden.bs.modal', function() {
|
||||
// Clear error status
|
||||
$("#{$dialog_id} .error").removeClass('error');
|
||||
|
||||
$('#{$dialog_id} .form-group').removeClass('has-error')
|
||||
|
||||
// Empty field values
|
||||
$("#{$dialog_id} input[type=text], #{$dialog_id} select").val('');
|
||||
|
||||
// Uncheck boxes
|
||||
$("#{$dialog_id} input[type=checkbox]").removeAttr('checked');
|
||||
|
||||
{$additionnal_js_code|default:''}
|
||||
});
|
||||
@@ -27,4 +27,7 @@ Parameters:
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
{/ifloop}
|
||||
{/ifloop}
|
||||
{elseloop rel="image"}
|
||||
<div class="alert alert-info">{intl l='There is no images attached to this %type.' type=$imageType}</div>
|
||||
{/elseloop}
|
||||
@@ -26,9 +26,8 @@
|
||||
close_url = "{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}"
|
||||
}
|
||||
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
{* Be sure to get the product ID and current tab, even if the form could not be validated *}
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
@@ -177,8 +176,6 @@
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_shipping_form'}
|
||||
|
||||
{form_field form=$form field='quantity'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
@@ -189,7 +186,7 @@
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_quantity_form'}
|
||||
{module_include location='product_details_details_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -268,9 +265,8 @@
|
||||
close_url = "{url path='/admin/categories' category_id=$DEFAULT_CATEGORY}"
|
||||
}
|
||||
|
||||
{* Be sure to get the product ID, even if the form could not be validated *}
|
||||
{* Be sure to get the product ID and current tab, even if the form could not be validated *}
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
@@ -340,7 +336,7 @@
|
||||
{module_include location='product_combinations_list_caption'}
|
||||
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Quickly create combinations using the combination builder'}" href="#combination_generator_dialog" data-toggle="modal">
|
||||
<a class="btn btn-default btn-primary action-btn" id="open_combination_builder" title="{intl l='Quickly create combinations using the combination builder'}" href="#combination_builder_dialog" data-toggle="modal">
|
||||
{intl l='Combination builder'}
|
||||
</a>
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new combination'}" href="#combination_creation_dialog" data-toggle="modal">
|
||||
@@ -358,8 +354,8 @@
|
||||
<th class="text-center">{intl l='Price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Weight<br />(Kg)'}</th>
|
||||
<th class="text-center">{intl l='Default'}</th>
|
||||
<th class="text-center">{intl l='Sale'}</th>
|
||||
<th class="text-center">{intl l='New'}</th>
|
||||
<th class="text-center">{intl l='Sale'}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/o taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="text-center">{intl l='Sale price<br />w/ taxes (%currency)' currency=$currency_symbol}</th>
|
||||
<th class="actions"> </th>
|
||||
@@ -375,18 +371,20 @@
|
||||
|
||||
{for $idx = 0 to $total_value_count-1}
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<td colspan="10">
|
||||
|
||||
{form_field form=$form field='product_sale_element_id' value_key=$idx}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
|
||||
{$current_pse_id = $value}
|
||||
|
||||
{$current_pse_id}: {loop name="product.sales.elements.combinations" type="attribute_combination" product_sale_elements=$current_pse_id backend_context="1"}
|
||||
{loop name="product.sales.elements.combinations" type="attribute_combination" product_sale_elements=$current_pse_id backend_context="1"}
|
||||
{if $LOOP_COUNT > 1} - {/if}{$ATTRIBUTE_TITLE}
|
||||
{/loop}
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td colspan"2" class="text-right">ID: {$current_pse_id}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -469,10 +467,16 @@
|
||||
<p class="title title-without-tabs">{intl l='Attribute Combinations'}</p>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl
|
||||
l='This product has no combination. The default price is used. <a data-toggle="modal" href="%url">Click here to create a new combination</a>'
|
||||
url='#combination_creation_dialog'
|
||||
}
|
||||
<p>{intl
|
||||
l='This product has no combination. The default price is used. <a data-toggle="modal" href="%url">Click here to create a new combination</a>.'
|
||||
url='#combination_creation_dialog'
|
||||
}</p>
|
||||
<p>
|
||||
{intl
|
||||
l='You may also quickly create combinations from products attributes using the <a href="%url" data-toggle="modal">Combination Builder</a>.'
|
||||
url='#combination_builder_dialog'
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -494,7 +498,7 @@
|
||||
<label class="control-label">{intl l="Attribute"} : </label>
|
||||
<select name="attribute_id" id="attribute_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute...'}</option>
|
||||
{loop name="product-attributes" type="attribute" product=$product_id backend_context="1" lang=$edit_language_id}
|
||||
{loop name="product-attributes" type="attribute" order="manual" product=$product_id backend_context="1" lang=$edit_language_id}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
@@ -583,3 +587,184 @@
|
||||
form_action = {url path='/admin/product/combination/delete'}
|
||||
form_content = {$smarty.capture.combination_delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{* -- Combination builder dialog -------------------------------------------- *}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{form name="thelia.admin.product_combination.build"}
|
||||
|
||||
{capture "combination_builder_dialog"}
|
||||
|
||||
{* Be sure to get the product ID and current tab, even if the form could not be validated *}
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="details" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='product_id'}
|
||||
<input type="hidden" name="{$name}" value="{$product_id}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger" id="combination_builder_dialog_error">{$form_error_message}</div>{/if}
|
||||
|
||||
{loop type="currency" name="get-currency-symbol" id=$edit_currency_id backend_context="1"}
|
||||
{$currency_symbol = $SYMBOL}
|
||||
|
||||
{form_field form=$form field='currency'}
|
||||
<input type="hidden" name="{$name}" value="{$ID}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/products/update' product_id=$product_id current_tab='details'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l='Select attribute values to combine. You may enter a default value for some of the fields of the generated combinations.'}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="scrollable">
|
||||
<ul class="list-unstyled">
|
||||
{$index = 0}
|
||||
{loop name="product-attributes" type="attribute" order="manual" product=$product_id backend_context="1" lang=$edit_language_id}
|
||||
{ifloop rel="product-attributes-av"}
|
||||
<li>
|
||||
<strong>{$TITLE}</strong>
|
||||
<ul class="list-unstyled">
|
||||
{loop name="product-attributes-av" type="attribute_availability" attribute="{$ID}" order="manual" backend_context="1" lang=$edit_language_id}
|
||||
<li>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{form_field form=$form field='attribute_av' value_key=$index}
|
||||
<input data-attribute-id="{$ATTRIBUTE_ID}" class="attribute_av_value" type="checkbox" name="{$name}" value="{$ATTRIBUTE_ID}:{$ID}" {if $value == "$ATTRIBUTE_ID:$ID"}checked="checked"{/if}>{$TITLE}
|
||||
{/form_field}
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
{$index = $index + 1}
|
||||
{/loop}
|
||||
</ul>
|
||||
</li>
|
||||
{/ifloop}
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="price_without_tax" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="price_without_tax" name="{$name}" class="price_field automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Price excl. taxes'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='reference'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Combination reference'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='ean_code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Combination EAN Code'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='weight'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product weight'}">
|
||||
<span class="input-group-addon">{intl l="Kg"}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{form_field form=$form field='quantity'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l='Quantity'} : </label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Current quantity'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='sale_price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="sale_price_without_tax" class="control-label">{$label} : </label>
|
||||
<div class="input-group">
|
||||
<input type="text" id="sale_price_without_tax" name="{$name}" class="price_field automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='onsale'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="{$label_attr.for}" name="{$name}" value="1">
|
||||
{$label}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='isnew'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" id="{$label_attr.for}" name="{$name}" value="1">
|
||||
{$label}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="well well-sm" style="margin-bottom: 0"><b>{intl l='<span id="number_of_generated_combinations">0</span> combinations'}</b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "combination_builder_dialog"
|
||||
dialog_title = {intl l="Create combinations"}
|
||||
dialog_body = {$smarty.capture.combination_builder_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create combinations"}
|
||||
|
||||
form_action = {url path='/admin/product/combination/build'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = ''
|
||||
|
||||
ok_button_id = "combination_builder_dialog_ok"
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
@@ -344,6 +344,21 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
// -- Combination builder stuff --------------------------------------------
|
||||
|
||||
$('#open_combination_builder').click(function(ev) {
|
||||
if (! confirm("{intl l='Existing combinations will be deleted. Do you want to continue ?'}'")) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "combination_builder_dialog"
|
||||
form_name = "thelia.admin.product_combination.build"
|
||||
}
|
||||
|
||||
// Automatic update of price fields: any change in the taxed (resp. untaxed) price
|
||||
// will update the untaxed (resp. taxed) one
|
||||
$('.automatic_price_field').typeWatch({
|
||||
@@ -353,6 +368,47 @@ $(function() {
|
||||
update_price($(this).val(), $(this).data('price-type'), $(this).data('rel-price'));
|
||||
}
|
||||
});
|
||||
|
||||
// Count generated combinations in real time
|
||||
function countGeneratedCombinations() {
|
||||
|
||||
var total = 0;
|
||||
|
||||
var counter = {};
|
||||
|
||||
var list = $('.attribute_av_value:checked');
|
||||
|
||||
if (list.length > 0) {
|
||||
console.log("ok !");
|
||||
|
||||
list.each(function() {
|
||||
var attr_id = $(this).data('attribute-id');
|
||||
|
||||
console.log("att="+attr_id);
|
||||
|
||||
if (undefined != counter[attr_id])
|
||||
counter[attr_id]++;
|
||||
else
|
||||
counter[attr_id] = 1;
|
||||
});
|
||||
|
||||
console.log(counter);
|
||||
|
||||
total = 1;
|
||||
|
||||
for(var count in counter) {
|
||||
total *= counter[count];
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
$('.attribute_av_value').change(function(ev) {
|
||||
var total = countGeneratedCombinations();
|
||||
|
||||
$('#number_of_generated_combinations').text(total);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user