Finished combination creation GUI
This commit is contained in:
@@ -223,6 +223,19 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAttributesAndFeaturesAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Combinations -->
|
||||
|
||||
<route id="admin.product.attribute-values" path="/admin/product/{productId}/attribute-values/{attributeId}.{_format}" methods="GET">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::getAttributeValuesAction</default>
|
||||
<requirement key="_format">xml|json</requirement>
|
||||
</route>
|
||||
|
||||
|
||||
<route id="admin.product.add-attribute-value-to-combination" path="/admin/product/{productId}/add-attribute-value-to-combination/{attributeAvId}/{combination}.{_format}" methods="GET">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::addAttributeValueToCombinationAction</default>
|
||||
<requirement key="_format">xml|json</requirement>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- Folder routes management -->
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ use Thelia\Core\Event\ProductSetTemplateEvent;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Core\Event\ProductAddCategoryEvent;
|
||||
use Thelia\Core\Event\ProductDeleteCategoryEvent;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Model\AttributeAvQuery;
|
||||
|
||||
/**
|
||||
* Manages products
|
||||
@@ -668,4 +670,72 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
$this->redirectToEditionTemplate();
|
||||
}
|
||||
|
||||
// -- Product combination management ---------------------------------------
|
||||
|
||||
public function getAttributeValuesAction($productId, $attributeId) {
|
||||
|
||||
$result = array();
|
||||
|
||||
// Get attribute for this product
|
||||
$attribute = AttributeQuery::create()->findPk($attributeId);
|
||||
|
||||
if ($attribute !== null) {
|
||||
|
||||
$values = AttributeAvQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->filterByAttribute($attribute)
|
||||
->find();
|
||||
;
|
||||
|
||||
if ($values !== null) {
|
||||
foreach($values as $value) {
|
||||
$result[] = array('id' => $value->getId(), 'title' => $value->getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($result));
|
||||
}
|
||||
|
||||
public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) {
|
||||
$result = array();
|
||||
|
||||
// Get attribute for this product
|
||||
$attributeAv = AttributeAvQuery::create()->joinWithI18n($this->getCurrentEditionLocale())->findPk($attributeAvId);
|
||||
|
||||
if ($attributeAv !== null) {
|
||||
|
||||
$addIt = true;
|
||||
|
||||
// Check if this attribute is not already present
|
||||
$combinationArray = explode(',', $combination);
|
||||
|
||||
foreach ($combinationArray as $id) {
|
||||
|
||||
$attrAv = AttributeAvQuery::create()->joinWithI18n($this->getCurrentEditionLocale())->findPk($id);
|
||||
|
||||
if ($attrAv !== null) {
|
||||
|
||||
if ($attrAv->getAttributeId() == $attributeAv->getAttributeId()) {
|
||||
|
||||
$attribute = AttributeQuery::create()->joinWithI18n($this->getCurrentEditionLocale())->findPk($attributeAv->getAttributeId());
|
||||
|
||||
$result['error'] = $this->getTranslator()->trans(
|
||||
'A value for attribute "%name" is already present in the combination',
|
||||
array('%name' => $attribute->getTitle())
|
||||
);
|
||||
|
||||
$addIt = false;
|
||||
}
|
||||
|
||||
$result[] = array('id' => $attrAv->getId(), 'title' => $attrAv->getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
if ($addIt) $result[] = array('id' => $attributeAv->getId(), 'title' => $attributeAv->getTitle());
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="well">
|
||||
<div class="well well-sm">
|
||||
<p>{intl
|
||||
l="To use features or attributes on this product, please select a product template. You can define product templates in the <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">configuration section</a> of the administration."
|
||||
tpl_mgmt_url={url path='/admin/configuration/templates'}
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p class="title title-without-tabs">{intl l='Product Attributes and Features'}</p>
|
||||
|
||||
<form method="POST" action="{url path="/admin/product/$ID/update-attributes-and-features"}" id="attribute_form">
|
||||
|
||||
@@ -64,165 +63,169 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Attributes'}</p>
|
||||
<div class="well well-sm">
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Attributes'}</p>
|
||||
|
||||
<p>
|
||||
{if $TEMPLATE}
|
||||
{intl
|
||||
l="You can change template attributes and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the template configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/templates/update' template_id=$TEMPLATE}
|
||||
}
|
||||
{else}
|
||||
{intl
|
||||
l="You can change attributes and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the attributes configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/attributes'}
|
||||
}
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
{if $TEMPLATE}
|
||||
{intl
|
||||
l="You can change template attributes and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the template configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/templates/update' template_id=$TEMPLATE}
|
||||
}
|
||||
{else}
|
||||
{intl
|
||||
l="You can change attributes and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the attributes configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/attributes'}
|
||||
}
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<th>{intl l='Attribute Name'}</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<th>{intl l='Attribute Name'}</th>
|
||||
|
||||
{module_include location='product_attributes_table_header'}
|
||||
</tr>
|
||||
</thead>
|
||||
{module_include location='product_attributes_table_header'}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="product-attributes" type="attribute" order="manual" product=$product_id backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<tbody>
|
||||
{loop name="product-attributes" type="attribute" order="manual" product=$product_id backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$TITLE}</td>
|
||||
|
||||
{module_include location='product_features_table_row'}
|
||||
</tr>
|
||||
{/loop}
|
||||
{module_include location='product_features_table_row'}
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="product-attributes"}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product template does not contains any features"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{elseloop rel="product-attributes"}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product template does not contains any features"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* -- Begin features management ---------------------------------- *}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Features'}</p>
|
||||
<div class="well well-sm">
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Features'}</p>
|
||||
|
||||
<p>
|
||||
{if $TEMPLATE}
|
||||
{intl
|
||||
l="You can change templates features and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the template configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/templates/update' template_id=$TEMPLATE}
|
||||
}
|
||||
{else}
|
||||
{intl
|
||||
l="You can change feature and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the features configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/features'}
|
||||
}
|
||||
{/if}
|
||||
</p>
|
||||
<p>
|
||||
{if $TEMPLATE}
|
||||
{intl
|
||||
l="You can change templates features and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the template configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/templates/update' template_id=$TEMPLATE}
|
||||
}
|
||||
{else}
|
||||
{intl
|
||||
l="You can change feature and their positions in <a href=\"%tpl_mgmt_url\" target=\"tpl_window\">the features configuration page</a>."
|
||||
tpl_mgmt_url={url path='/admin/configuration/features'}
|
||||
}
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<th>{intl l='Feature Name'}</th>
|
||||
<th>{intl l='Feature value for this product'}</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<th>{intl l='Feature Name'}</th>
|
||||
<th>{intl l='Feature value for this product'}</th>
|
||||
|
||||
{module_include location='product_features_table_header'}
|
||||
{module_include location='product_features_table_header'}
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="product-features" type="feature" order="manual" product=$product_id backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<tbody>
|
||||
{loop name="product-features" type="feature" order="manual" product=$product_id backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>{$TITLE}</td>
|
||||
<td>{$TITLE}</td>
|
||||
|
||||
<td>
|
||||
{* Multiple values *}
|
||||
<td>
|
||||
{* Multiple values *}
|
||||
|
||||
{ifloop rel="product-features-av"}
|
||||
{ifloop rel="product-features-av"}
|
||||
|
||||
{* load all selected values in an array to speed up things a little *}
|
||||
{* load all selected values in an array to speed up things a little *}
|
||||
|
||||
{$selected = array()}
|
||||
{$selected = array()}
|
||||
|
||||
{loop name="free-text-value" exclude_free_text="true" type="feature_value" product=$product_id feature=$ID backend_context="1" lang="$edit_language_id"}
|
||||
{$selected[] = $FEATURE_AV_ID}
|
||||
{/loop}
|
||||
{loop name="free-text-value" exclude_free_text="true" type="feature_value" product=$product_id feature=$ID backend_context="1" lang="$edit_language_id"}
|
||||
{$selected[] = $FEATURE_AV_ID}
|
||||
{/loop}
|
||||
|
||||
{capture "select_options"}
|
||||
{loop name="product-features-av" type="feature-availability" feature=$ID order="manual" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" {if in_array($ID, $selected)}selected="selected"{/if}>{$TITLE}</option>
|
||||
{capture "select_options"}
|
||||
{loop name="product-features-av" type="feature-availability" feature=$ID order="manual" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" {if in_array($ID, $selected)}selected="selected"{/if}>{$TITLE}</option>
|
||||
|
||||
{$options_count = $LOOP_COUNT} {* LOOP_COUNT is only available inside the loop ! *}
|
||||
{/loop}
|
||||
{/capture}
|
||||
{$options_count = $LOOP_COUNT} {* LOOP_COUNT is only available inside the loop ! *}
|
||||
{/loop}
|
||||
{/capture}
|
||||
|
||||
<div class="input-form">
|
||||
<select multiple="multiple" name="feature_value[{$ID}][]" id="feature_value_{$ID}" size="{$options_count}" class="form-control">
|
||||
{$smarty.capture.select_options nofilter}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-form">
|
||||
<select multiple="multiple" name="feature_value[{$ID}][]" id="feature_value_{$ID}" size="{$options_count}" class="form-control">
|
||||
{$smarty.capture.select_options nofilter}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<span class="help-block text-right">
|
||||
{intl l='Use Ctrl+click to select more than one value. You can also <a href="#" class="clear_feature_value" data-id="%id">clear selected values</a>.' id=$ID}
|
||||
</span>
|
||||
{/ifloop}
|
||||
<span class="help-block text-right">
|
||||
{intl l='Use Ctrl+click to select more than one value. You can also <a href="#" class="clear_feature_value" data-id="%id">clear selected values</a>.' id=$ID}
|
||||
</span>
|
||||
{/ifloop}
|
||||
|
||||
{* Free text *}
|
||||
{* Free text *}
|
||||
|
||||
{elseloop rel="product-features-av"}
|
||||
{* Get the free text value *}
|
||||
{elseloop rel="product-features-av"}
|
||||
{* Get the free text value *}
|
||||
|
||||
{loop name="free-text-value" exclude_feature_availability="1" type="feature_value" product=$product_id feature=$ID backend_context="1" lang="$edit_language_id"}
|
||||
{$feature_value=$FREE_TEXT_VALUE}
|
||||
{/loop}
|
||||
{loop name="free-text-value" exclude_feature_availability="1" type="feature_value" product=$product_id feature=$ID backend_context="1" lang="$edit_language_id"}
|
||||
{$feature_value=$FREE_TEXT_VALUE}
|
||||
{/loop}
|
||||
|
||||
<input type="text" id="feature_text_value_{$ID}" name="feature_text_value[{$ID}]" title="{intl l='Enter here the feature value as free text'}" placeholder="{intl l='Feature value'}" class="form-control" value="{$feature_value|default:''}">
|
||||
{/elseloop}
|
||||
</td>
|
||||
<input type="text" id="feature_text_value_{$ID}" name="feature_text_value[{$ID}]" title="{intl l='Enter here the feature value as free text'}" placeholder="{intl l='Feature value'}" class="form-control" value="{$feature_value|default:''}">
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
{module_include location='product_features_table_row'}
|
||||
{module_include location='product_features_table_row'}
|
||||
|
||||
</tr>
|
||||
{/loop}
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="product-features"}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product template does not contains any features"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{elseloop rel="product-features"}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product template does not contains any features"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -14,115 +14,117 @@
|
||||
{* -- Begin related content management ------------------------------ *}
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/content/add'}" id="related_content_form">
|
||||
<div class="well well-sm">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/content/add'}" id="related_content_form">
|
||||
|
||||
<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 class="title title-without-tabs">{intl l='Related content'}</p>
|
||||
<p>{intl l='You can attach here some content to this product'}</p>
|
||||
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
|
||||
{ifloop rel="folders"}
|
||||
<div class="form-group">
|
||||
<select name="folder_id" id="folder_id" class="form-control">
|
||||
<option value="">{intl l='Select a folder...'}</option>
|
||||
{loop name="folders" type="folder-tree" folder="0" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
{ifloop rel="folders"}
|
||||
<div class="form-group">
|
||||
<select name="folder_id" id="folder_id" class="form-control">
|
||||
<option value="">{intl l='Select a folder...'}</option>
|
||||
{loop name="folders" type="folder-tree" folder="0" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
<span class="help-block">{intl l='Select a folder to get its content'}</span>
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a folder to get its content'}</span>
|
||||
</div>
|
||||
|
||||
<div id="content_selector" class="hide">
|
||||
<div class="input-group">
|
||||
<select required="required" name="content_id" id="content_id" class="form-control">
|
||||
<option value="">{intl l='Select a folder content...'}</option>
|
||||
</select>
|
||||
<span class="input-group-btn" id="content_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
<div id="content_selector" class="hide">
|
||||
<div class="input-group">
|
||||
<select required="required" name="content_id" id="content_id" class="form-control">
|
||||
<option value="">{intl l='Select a folder content...'}</option>
|
||||
</select>
|
||||
<span class="input-group-btn" id="content_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="help-block">{intl l='Select a content and click (+) to add it to this product'}</span>
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a content and click (+) to add it to this product'}</span>
|
||||
</div>
|
||||
|
||||
<div id="content_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available content in this folder"}
|
||||
</div>
|
||||
</div>
|
||||
{/ifloop}
|
||||
<div id="content_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available content in this folder"}
|
||||
</div>
|
||||
</div>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="folders"}
|
||||
<div class="alert alert-info">{intl l="No folders found"}</div>
|
||||
{/elseloop}
|
||||
{elseloop rel="folders"}
|
||||
<div class="alert alert-info">{intl l="No folders found"}</div>
|
||||
{/elseloop}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
|
||||
<th>{intl l='Content title'}</th>
|
||||
<th>{intl l='Content title'}</th>
|
||||
|
||||
<th class="text-center">{intl l='Position'}</th>
|
||||
<th class="text-center">{intl l='Position'}</th>
|
||||
|
||||
{module_include location='product_contents_table_header'}
|
||||
{module_include location='product_contents_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="assigned_contents" type="associated_content" product="$product_id" backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<tbody>
|
||||
{loop name="assigned_contents" type="associated_content" product="$product_id" backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
path={url path='/admin/product/update-content-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="content_id"
|
||||
in_place_edit_class="contentPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
path={url path='/admin/product/update-content-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="content_id"
|
||||
in_place_edit_class="contentPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='product_contents_table_row'}
|
||||
{module_include location='product_contents_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.content.delete"}
|
||||
<a class="btn btn-default btn-xs delete-content" title="{intl l='Delete this content'}" href="#delete_content_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.content.delete"}
|
||||
<a class="btn btn-default btn-xs delete-content" title="{intl l='Delete this content'}" href="#delete_content_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="assigned_contents"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product contains no contents"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
{elseloop rel="assigned_contents"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product contains no contents"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -131,117 +133,119 @@
|
||||
{* -- Begin accessories management ---------------------------------- *}
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/accessory/add'}" id="accessory_form">
|
||||
<div class=" well well-sm">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/accessory/add'}" id="accessory_form">
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Product accessories'}</p>
|
||||
<p>{intl l='Define here this product\'s accessories'}</p>
|
||||
<p class="title title-without-tabs">{intl l='Product accessories'}</p>
|
||||
<p>{intl l='Define here this product\'s accessories'}</p>
|
||||
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
|
||||
{ifloop rel="categories"}
|
||||
<div class="form-group">
|
||||
<select name="accessory_category_id" id="accessory_category_id" class="form-control">
|
||||
<option value="">{intl l='Select a category...'}</option>
|
||||
{loop name="categories" type="category-tree" category="0" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
{ifloop rel="categories"}
|
||||
<div class="form-group">
|
||||
<select name="accessory_category_id" id="accessory_category_id" class="form-control">
|
||||
<option value="">{intl l='Select a category...'}</option>
|
||||
{loop name="categories" type="category-tree" category="0" backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
<span class="help-block">{intl l='Select a category to get its products'}</span>
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a category to get its products'}</span>
|
||||
</div>
|
||||
|
||||
<div id="accessory_selector" class="hide">
|
||||
<div class="input-group">
|
||||
<select required="required" name="accessory_id" id="accessory_id" class="form-control">
|
||||
<option value="">{intl l='Select a product...'}</option>
|
||||
</select>
|
||||
<span class="input-group-btn" id="accessory_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
<div id="accessory_selector" class="hide">
|
||||
<div class="input-group">
|
||||
<select required="required" name="accessory_id" id="accessory_id" class="form-control">
|
||||
<option value="">{intl l='Select a product...'}</option>
|
||||
</select>
|
||||
<span class="input-group-btn" id="accessory_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="help-block">{intl l='Select a product and click (+) to add it as an accessory'}</span>
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a product and click (+) to add it as an accessory'}</span>
|
||||
</div>
|
||||
|
||||
<div id="accessory_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available product in this category"}
|
||||
</div>
|
||||
</div>
|
||||
<div id="accessory_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available product in this category"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/ifloop}
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="categories"}
|
||||
<div class="alert alert-info">{intl l="No categories found"}</div>
|
||||
{/elseloop}
|
||||
{elseloop rel="categories"}
|
||||
<div class="alert alert-info">{intl l="No categories found"}</div>
|
||||
{/elseloop}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
|
||||
<th>{intl l='Accessory title'}</th>
|
||||
<th>{intl l='Accessory title'}</th>
|
||||
|
||||
<th class="text-center">{intl l='Position'}</th>
|
||||
<th class="text-center">{intl l='Position'}</th>
|
||||
|
||||
{module_include location='product_accessories_table_header'}
|
||||
{module_include location='product_accessories_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="assigned_accessories" order="accessory" type="accessory" product="$product_id" backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<tbody>
|
||||
{loop name="assigned_accessories" order="accessory" type="accessory" product="$product_id" backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
path={url path='/admin/product/update-accessory-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="accessory_id"
|
||||
in_place_edit_class="accessoryPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.products.edit"
|
||||
path={url path='/admin/product/update-accessory-position' product_id=$product_id current_tab="related"}
|
||||
url_parameter="accessory_id"
|
||||
in_place_edit_class="accessoryPositionChange"
|
||||
position=$POSITION
|
||||
id=$ID
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='product_accessories_table_row'}
|
||||
{module_include location='product_accessories_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.accessory.delete"}
|
||||
<a class="btn btn-default btn-xs delete-accessory" title="{intl l='Delete this accessory'}" href="#delete_accessory_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.product.accessory.delete"}
|
||||
<a class="btn btn-default btn-xs delete-accessory" title="{intl l='Delete this accessory'}" href="#delete_accessory_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="assigned_accessories"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product contains no accessories"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{elseloop rel="assigned_accessories"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product contains no accessories"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* -- End accessories management ------------------------------------ *}
|
||||
@@ -253,99 +257,101 @@
|
||||
{* -- Begin categories management ----------------------------------- *}
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/category/add'}" id="related_content_form">
|
||||
<div class="well well-sm">
|
||||
<div class="form-group">
|
||||
<form method="POST" action="{url path='/admin/products/category/add'}" id="related_content_form">
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Additional categories'}</p>
|
||||
<p>{intl l='A product could be attached to more than one category. Select here the additional categories for this product.'}
|
||||
{loop name="default_category" type="category" id=$DEFAULT_CATEGORY}
|
||||
{intl l='You can change the default category (%title) in the "General" tab.' title=$TITLE}
|
||||
{/loop}
|
||||
<p class="title title-without-tabs">{intl l='Additional categories'}</p>
|
||||
<p>{intl l='A product could be attached to more than one category. Select here the additional categories for this product.'}
|
||||
{loop name="default_category" type="category" id=$DEFAULT_CATEGORY}
|
||||
{intl l='You can change the default category (%title) in the "General" tab.' title=$TITLE}
|
||||
{/loop}
|
||||
|
||||
{$exclude_from_tree = "-1"}
|
||||
{loop name="additional_categories" type="category" product=$product_id exclude=$DEFAULT_CATEGORY backend_context="1" lang="$edit_language_id"}
|
||||
{$exclude_from_tree = "$exclude_from_tree,$ID"}
|
||||
{/loop}
|
||||
{$exclude_from_tree = "-1"}
|
||||
{loop name="additional_categories" type="category" product=$product_id exclude=$DEFAULT_CATEGORY backend_context="1" lang="$edit_language_id"}
|
||||
{$exclude_from_tree = "$exclude_from_tree,$ID"}
|
||||
{/loop}
|
||||
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
<input type="hidden" name="product_id" value="{$product_id}" />
|
||||
<input type="hidden" name="current_tab" value="related" />
|
||||
|
||||
{ifloop rel="categories"}
|
||||
<div class="input-group">
|
||||
{ifloop rel="categories"}
|
||||
<div class="input-group">
|
||||
|
||||
<select name="additional_category_id" id="accessory_category_id" class="form-control">
|
||||
<option value="">{intl l='Select a category...'}</option>
|
||||
{loop name="categories" type="category-tree" category="0" exclude=$exclude_from_tree backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px" {if $DEFAULT_CATEGORY==$ID}disabled="disabled"{/if}>
|
||||
{$TITLE} {if $DEFAULT_CATEGORY==$ID}{intl l=' (default)'}{/if}
|
||||
</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<select name="additional_category_id" id="accessory_category_id" class="form-control">
|
||||
<option value="">{intl l='Select a category...'}</option>
|
||||
{loop name="categories" type="category-tree" category="0" exclude=$exclude_from_tree backend_context="1" lang="$edit_language_id"}
|
||||
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px" {if $DEFAULT_CATEGORY==$ID}disabled="disabled"{/if}>
|
||||
{$TITLE} {if $DEFAULT_CATEGORY==$ID}{intl l=' (default)'}{/if}
|
||||
</option>
|
||||
{/loop}
|
||||
</select>
|
||||
|
||||
<span class="input-group-btn" id="content_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
<span class="input-group-btn" id="content_add_button">
|
||||
<button class="btn btn-default btn-primary action-btn" type="submit"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a category and click (+) to add it to the additional category list'}</span>
|
||||
{/ifloop}
|
||||
</div>
|
||||
<span class="help-block">{intl l='Select a category and click (+) to add it to the additional category list'}</span>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="categories"}
|
||||
<div class="alert alert-info">{intl l="No categories found"}</div>
|
||||
{/elseloop}
|
||||
{elseloop rel="categories"}
|
||||
<div class="alert alert-info">{intl l="No categories found"}</div>
|
||||
{/elseloop}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='ID'}</th>
|
||||
|
||||
<th>{intl l='Category title'}</th>
|
||||
<th>{intl l='Category title'}</th>
|
||||
|
||||
{module_include location='product_categories_table_header'}
|
||||
{module_include location='product_categories_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="additional_categories" type="category" product=$product_id exclude=$DEFAULT_CATEGORY backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<tbody>
|
||||
{loop name="additional_categories" type="category" product=$product_id exclude=$DEFAULT_CATEGORY backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
<td>
|
||||
{$TITLE}
|
||||
</td>
|
||||
|
||||
{module_include location='product_categories_table_row'}
|
||||
{module_include location='product_categories_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.category.delete"}
|
||||
<a class="btn btn-default btn-xs delete-category" title="{intl l='Remove the product from this category'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.product.category.delete"}
|
||||
<a class="btn btn-default btn-xs delete-category" title="{intl l='Remove the product from this category'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="additional_categories"}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product doesn't belong to any additional category."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{elseloop rel="additional_categories"}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product doesn't belong to any additional category."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* -- End categories management ------------------------------------- *}
|
||||
</div>
|
||||
@@ -473,7 +479,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
// Load content on folder selection
|
||||
// Load accessory on category selection
|
||||
$('#accessory_category_id').change(function(event) {
|
||||
var val = $(this).val();
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ Parameters:
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{if $show_currencies == true}
|
||||
<div class="col-md-3 inner-actions">
|
||||
{if $show_currencies == true}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="button-group">
|
||||
@@ -35,8 +35,8 @@ Parameters:
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 inner-actions">
|
||||
{if $hide_submit_buttons != true}
|
||||
|
||||
@@ -42,125 +42,132 @@
|
||||
{* -- Pricing ------------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Pricing'}</p>
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Pricing'}</p>
|
||||
<p></p> <!-- LAME !!! FIXME -->
|
||||
|
||||
<p></p> <!-- LAME !!! FIXME -->
|
||||
{form_field form=$form field='price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
{form_field form=$form field='price'}
|
||||
<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}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="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='tax_rule'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<div class="form-group">
|
||||
<select id="{$label_attr.for}" required="required" name="{$name}" class="form-control">
|
||||
<option value="">{intl l="Select a tax tule"}</option>
|
||||
{loop name="tax" type="tax-rule" backend_context="1"}
|
||||
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{form_field form=$form field='tax_rule'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<div class="form-group">
|
||||
<select id="{$label_attr.for}" required="required" name="{$name}" class="form-control">
|
||||
<option value="">{intl l="Select a tax tule"}</option>
|
||||
{loop name="tax" type="tax-rule" backend_context="1"}
|
||||
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='price_with_tax'}
|
||||
<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}" required="required" name="{$name}" class="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='price_with_tax'}
|
||||
<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}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_pricing_form'}
|
||||
{module_include location='product_details_pricing_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* -- Promotion ------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Promotion'}</p>
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Promotion'}</p>
|
||||
{form_field form=$form field='sale_price'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
{form_field form=$form field='sale_price'}
|
||||
<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}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
|
||||
<span class="input-group-addon">{$currency_symbol}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="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" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
</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" {if $value != 0}checked="checked"{/if}>
|
||||
{$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" {if $value != 0}checked="checked"{/if}>
|
||||
{$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" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_promotion_form'}
|
||||
{module_include location='product_details_promotion_form'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{* -- Shipping -------------------------------------------------- *}
|
||||
|
||||
<div class="col-md-4">
|
||||
<p class="title title-without-tabs">{intl l='Shipping'}</p>
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Shipping'}</p>
|
||||
|
||||
{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>
|
||||
{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}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product weight'}">
|
||||
<span class="input-group-addon">{intl l="Kg"}</span>
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" 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}
|
||||
|
||||
{module_include location='product_details_shipping_form'}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Quantity'}</p>
|
||||
|
||||
{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>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Current quantity'}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Quantity'}</p>
|
||||
|
||||
{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>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Current quantity'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='product_details_shipping_form'}
|
||||
</div>
|
||||
{module_include location='product_details_quantity_form'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
|
||||
@@ -171,11 +178,76 @@
|
||||
|
||||
<p class="title title-without-tabs">{intl l='Attribute Combinations'}</p>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product has no attribute combination"}
|
||||
</div>
|
||||
{module_include location='product_before_combinations'}
|
||||
|
||||
</div> {* com *}
|
||||
</div> {* row *}
|
||||
{ifloop rel="product-attributes"}
|
||||
<form method="POST" action="{url path='/admin/products/combinations/save'}" {form_enctype form=$form} class="clearfix">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Create a new combination'}</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">{intl l="Attribute"} : </label>
|
||||
<select required="required" 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}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<span class="help-block">{intl l='Select an attribute and click (+) to view available values'}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="attribute_value_selector" class="hide">
|
||||
<div class="input-group">
|
||||
{* <label class="control-label">{intl l="Attribute values"} : </label> *}
|
||||
|
||||
<select required="required" name="attribute_value_id" id="attribute_value_id" class="form-control">
|
||||
<option value="">{intl l='Select an attribute value...'}</option>
|
||||
</select>
|
||||
|
||||
<span class="input-group-btn" id="add_attr_value_button">
|
||||
<button class="btn btn-default btn-primary action-btn add-value-to-combination" type="button"><span class="glyphicon glyphicon-plus-sign"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="help-block">{intl l='Select a value click (+) to add it to the combination'}</span>
|
||||
</div>
|
||||
|
||||
<div id="attribute_value_selector_empty" class="hide">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No available value for this attribute"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="alert alert-danger hide" id="combination_attributes_error"></div>
|
||||
|
||||
<select multiple="multiple" size="5" name="combination_attributes" id="combination_attributes" class="form-control">
|
||||
</select>
|
||||
|
||||
<div class="help-block">
|
||||
{intl l='To remove a value from the combination, select it and click "remove"'}
|
||||
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-info btn-xs remove-value-from-combination" type="button">
|
||||
{intl l="Remove selected value"} <span class="glyphicon glyphicon-minus-sign"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="product-attributes"}
|
||||
<div class="alert alert-info">
|
||||
{intl l="No attributes are attached to this product."}
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
{module_include location='product_after_combinations'}
|
||||
|
||||
</div> {* com *}
|
||||
</div> {* row *}
|
||||
</div>
|
||||
@@ -144,6 +144,93 @@ $(function() {
|
||||
|
||||
// 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($('<option>').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($('<option>').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();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
{/block}
|
||||
@@ -59,30 +59,32 @@
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="form-container">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="form-container">
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Attributes'}</p>
|
||||
<p>Manage attributes included in this product templates</p>
|
||||
|
||||
<div id="attribute_list_management">
|
||||
<div class="loading"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
<p class="title title-without-tabs">{intl l='Features'}</p>
|
||||
<p>Manage features included in this product templates</p>
|
||||
|
||||
<div id="feature_list_management">
|
||||
<div class="loading"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user