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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user