forked from pal/prestashop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct-sort.php
19 lines (16 loc) · 873 Bytes
/
product-sort.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$stock_management = intval(Configuration::get('PS_STOCK_MANAGEMENT')) ? true : false; // no display quantity order if stock management disabled
$orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$orderWayValues = array(0 => 'ASC', 1 => 'DESC');
$orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[intval(Configuration::get('PS_PRODUCTS_ORDER_BY'))]));
$orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[intval(Configuration::get('PS_PRODUCTS_ORDER_WAY'))]));
if (!in_array($orderBy, $orderByValues))
$orderBy = $orderByValues[0];
if (!in_array($orderWay, $orderWayValues))
$orderWay = $orderWayValues[0];
$smarty->assign(array(
'orderby' => $orderBy,
'orderway' => $orderWay,
'stock_management' => $stock_management
));
?>