// Merge -> revision 8342

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8344 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-05 14:56:02 +00:00
parent 371f9a5397
commit 79fd72e461
46 changed files with 1299 additions and 249 deletions
+16 -2
View File
@@ -1934,14 +1934,28 @@ FileETag INode MTime Size
* @param string $type by|way
* @param string $value If no index given, use default order from admin -> pref -> products
*/
public static function getProductsOrder($type, $value = null)
public static function getProductsOrder($type, $value = null, $prefix = false)
{
switch ($type)
{
case 'by' :
$orderByPrefix = '';
if($prefix) {
if ($value == 'id_product' OR $value == 'date_add')
$orderByPrefix = 'p.';
elseif ($value == 'name')
$orderByPrefix = 'pl.';
elseif ($value == 'manufacturer')
{
$orderByPrefix = 'm.';
}
elseif ($value == 'position')
$orderByPrefix = 'cp.';
}
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
return ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
return $orderByPrefix.((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
break;
case 'way' :