Finished product features management
This commit is contained in:
@@ -112,12 +112,18 @@ class Attribute extends BaseI18nLoop
|
||||
$use_attribute_pos = true;
|
||||
|
||||
if (null !== $product) {
|
||||
// Find the template assigned to the product.
|
||||
$productObj = ProductQuery::create()->findPk($product);
|
||||
// Find all template assigned to the products.
|
||||
$products = ProductQuery::create()->findById($product);
|
||||
|
||||
// Ignore if the product cannot be found.
|
||||
if ($productObj !== null)
|
||||
$template = $productObj->getTemplate();
|
||||
if ($products !== null) {
|
||||
|
||||
// Create template array
|
||||
if ($template == null) $template = array();
|
||||
|
||||
foreach($products as $product)
|
||||
$template[] = $product->getTemplateId();
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $template) {
|
||||
@@ -146,9 +152,6 @@ class Attribute extends BaseI18nLoop
|
||||
|
||||
$orders = $this->getOrder();
|
||||
|
||||
if ($template == null && ($order == "manual" || $order == "manual_reverse"))
|
||||
throw new \InvalidException(Translator::getInstance()->trans("Can't use manual or manual_reverse order without a 'template' or 'produst' parameter"));
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
|
||||
@@ -115,12 +115,18 @@ class Feature extends BaseI18nLoop
|
||||
$use_feature_pos = true;
|
||||
|
||||
if (null !== $product) {
|
||||
// Find the template assigned to the product.
|
||||
$productObj = ProductQuery::create()->findPk($product);
|
||||
// Find all template assigned to the products.
|
||||
$products = ProductQuery::create()->findById($product);
|
||||
|
||||
// Ignore if the product cannot be found.
|
||||
if ($productObj !== null)
|
||||
$template = $productObj->getTemplate();
|
||||
if ($products !== null) {
|
||||
|
||||
// Create template array
|
||||
if ($template == null) $template = array();
|
||||
|
||||
foreach($products as $product)
|
||||
$template[] = $product->getTemplateId();
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $template) {
|
||||
|
||||
@@ -126,7 +126,8 @@ trait PositionManagementTrait {
|
||||
$result->setDispatcher($this->getDispatcher())->setPosition($my_position)->save();
|
||||
|
||||
$cnx->commit();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$cnx->rollback();
|
||||
}
|
||||
}
|
||||
@@ -180,7 +181,9 @@ trait PositionManagementTrait {
|
||||
try {
|
||||
foreach ($results as $result) {
|
||||
|
||||
$result->setDispatcher($this->getDispatcher())->setPosition($result->getPosition() + $delta)->save($cnx);
|
||||
$objNewPosition = $result->getPosition() + $delta;
|
||||
|
||||
$result->setDispatcher($this->getDispatcher())->setPosition($objNewPosition)->save($cnx);
|
||||
}
|
||||
|
||||
$this
|
||||
@@ -189,7 +192,8 @@ trait PositionManagementTrait {
|
||||
;
|
||||
|
||||
$cnx->commit();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$cnx->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="well">
|
||||
<p>{intl l="To use features or attributes on this product, please select a product template. You can define product templates in the Configuration section of the administration."}</p>
|
||||
<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'}
|
||||
}
|
||||
</p>
|
||||
|
||||
<label for="template_id" class="control-label">
|
||||
{intl l='Current product template'} :
|
||||
@@ -63,6 +67,12 @@
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Attributes'}</p>
|
||||
|
||||
<p>{intl
|
||||
l="You can change 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}
|
||||
}
|
||||
</p>
|
||||
|
||||
<div class="alert alert-danger">Please code me baby, oh yeah ! Code me NOW !</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,6 +85,12 @@
|
||||
<div class="form-group">
|
||||
<p class="title title-without-tabs">{intl l='Product Features'}</p>
|
||||
|
||||
<p>{intl
|
||||
l="You can change feature products 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}
|
||||
}
|
||||
</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
@@ -88,7 +104,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="product-features" type="feature" order="manual" product="$product_id" backend_context="1" lang="$edit_language_id"}
|
||||
{loop name="product-features" type="feature" order="manual" product=$product_id backend_context="1" lang="$edit_language_id"}
|
||||
<tr>
|
||||
<td>{$TITLE}</td>
|
||||
|
||||
@@ -144,9 +160,9 @@
|
||||
|
||||
{elseloop rel="product-features"}
|
||||
<tr>
|
||||
<td>
|
||||
<td colspan="2">
|
||||
<div class="alert alert-info">
|
||||
{intl l="This product contains no features"}
|
||||
{intl l="This product template does not contains any features"}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user