[-] FO : fixed default order by manufacturer #PSCFV-6105
This commit is contained in:
@@ -316,6 +316,11 @@ class ManufacturerCore extends ObjectModel
|
|||||||
$alias = 'product_shop.';
|
$alias = 'product_shop.';
|
||||||
elseif ($order_by == 'name')
|
elseif ($order_by == 'name')
|
||||||
$alias = 'pl.';
|
$alias = 'pl.';
|
||||||
|
elseif ($order_by == 'manufacturer_name')
|
||||||
|
{
|
||||||
|
$order_by = 'name';
|
||||||
|
$alias = 'm.';
|
||||||
|
}
|
||||||
elseif ($order_by == 'quantity')
|
elseif ($order_by == 'quantity')
|
||||||
$alias = 'stock.';
|
$alias = 'stock.';
|
||||||
else
|
else
|
||||||
@@ -358,7 +363,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
WHERE cg.`id_group` '.$sql_groups.'
|
WHERE cg.`id_group` '.$sql_groups.'
|
||||||
)
|
)
|
||||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||||
ORDER BY '.$alias.pSQL($order_by).' '.pSQL($order_way).'
|
ORDER BY '.$alias.'`'.bqSQL($order_by).'` '.pSQL($order_way).'
|
||||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
|
|||||||
@@ -243,6 +243,12 @@ class SupplierCore extends ObjectModel
|
|||||||
$alias = 'product_shop.';
|
$alias = 'product_shop.';
|
||||||
elseif ($order_by == 'id_product')
|
elseif ($order_by == 'id_product')
|
||||||
$alias = 'p.';
|
$alias = 'p.';
|
||||||
|
elseif ($order_by == 'manufacturer_name')
|
||||||
|
{
|
||||||
|
$order_by = 'name';
|
||||||
|
$alias = 'm.';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock,
|
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock,
|
||||||
IFNULL(stock.quantity, 0) as quantity,
|
IFNULL(stock.quantity, 0) as quantity,
|
||||||
pl.`description`,
|
pl.`description`,
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
'products' => $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
'products' => $this->manufacturer->getProducts($this->manufacturer->id, $this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay),
|
||||||
'path' => ($this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : ''),
|
'path' => ($this->manufacturer->active ? Tools::safeOutput($this->manufacturer->name) : ''),
|
||||||
'manufacturer' => $this->manufacturer,
|
'manufacturer' => $this->manufacturer,
|
||||||
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM'))
|
'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user