Back to PhocacartOrdering class

Method getOrderingText

public static
getOrderingText
(mixed $ordering, mixed $type = 0)

Method getOrderingText - Source code

public static function getOrderingText($ordering, $type = 0)
{
    switch ($type) {
        case 1:
            // CATEGORY
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'c.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'c.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'c.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'c.date ASC';
                    break;
                case 6:
                    $orderingOutput = 'c.date DESC';
                    break;
                case 7:
                    $orderingOutput = 'c.count_products ASC';
                    break;
                case 8:
                    $orderingOutput = 'c.count_products DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'c.ordering ASC';
                    break;
            }
            break;
        case 2:
            // ORDERS
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'o.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'o.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'o.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'o.price ASC';
                    break;
                case 6:
                    $orderingOutput = 'o.price DESC';
                    break;
                case 7:
                    $orderingOutput = 'o.date ASC';
                    break;
                case 8:
                    $orderingOutput = 'o.date DESC';
                    break;
                case 1:
                default:
                    $orderingOutput = 'o.ordering ASC';
                    break;
            }
            break;
        case 3:
            // TAGS
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 't.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 't.title ASC';
                    break;
                case 4:
                    $orderingOutput = 't.title DESC';
                    break;
                case 5:
                    $orderingOutput = 't.id ASC';
                    break;
                case 6:
                    $orderingOutput = 't.id DESC';
                    break;
                case 7:
                    $orderingOutput = 't.count_products ASC';
                    break;
                case 8:
                    $orderingOutput = 't.count_products DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 't.ordering ASC';
                    break;
            }
            break;
        case 4:
            // MANUFACTURERS
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'm.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'm.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'm.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'm.id ASC';
                    break;
                case 6:
                    $orderingOutput = 'm.id DESC';
                    break;
                case 7:
                    $orderingOutput = 'm.count_products ASC';
                    break;
                case 8:
                    $orderingOutput = 'm.count_products DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'm.ordering ASC';
                    break;
            }
            break;
        case 5:
            // ATTRIBUTES
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'at.id DESC';
                    break;
                case 3:
                    $orderingOutput = 'at.title ASC, v.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'at.title DESC, v.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'v.id ASC';
                    break;
                case 6:
                    $orderingOutput = 'v.id DESC';
                    break;
                case 7:
                    $orderingOutput = 'at.ordering, v.ordering ASC';
                    break;
                case 8:
                    $orderingOutput = 'at.ordering, v.ordering DESC';
                    break;
                case 1:
                default:
                    $orderingOutput = 'at.id ASC';
                    break;
            }
            break;
        case 6:
            // SPECIFICATION
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 's.id DESC';
                    break;
                case 3:
                    $orderingOutput = 's.title ASC, s.value ASC';
                    break;
                case 4:
                    $orderingOutput = 's.title DESC, s.value DESC';
                    break;
                case 1:
                default:
                    $orderingOutput = 's.id ASC';
                    break;
            }
            break;
        case 7:
            // CUSTOMERS (POS)
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'a.name DESC';
                    break;
                case 1:
                default:
                    $orderingOutput = 'a.name ASC';
                    break;
            }
            break;
        case 8:
            // UNITS (POS)
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'a.title DESC';
                    break;
                case 1:
                default:
                    $orderingOutput = 'a.title ASC';
                    break;
            }
            break;
        case 9:
            // SHIPPING METHODS (POS)
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'a.title DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'a.title ASC';
                    break;
            }
            break;
        case 10:
            // PAYMENT METHODS (POS)
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'a.title DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'a.title ASC';
                    break;
            }
            break;
        case 11:
            // PAYMENT METHODS (POS)
            switch ((int) $ordering) {
                case 3:
                    $orderingOutput = 'a.id ASC';
                    break;
                case 3:
                    $orderingOutput = 'a.id DESC';
                    break;
                case 1:
                    $orderingOutput = 'a.date ASC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 2:
                default:
                    $orderingOutput = 'a.date DESC';
                    break;
            }
            break;
        case 12:
            // PARAMETERS
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'pp.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'pp.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'pp.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'pp.id ASC';
                    break;
                case 6:
                    $orderingOutput = 'pp.id DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'pp.ordering ASC';
                    break;
            }
            break;
        case 13:
            // PARAMETER VALUES
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'pv.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'pv.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'pv.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'pv.id ASC';
                    break;
                case 6:
                    $orderingOutput = 'pv.id DESC';
                    break;
                case 7:
                    $orderingOutput = 'pv.count_products ASC';
                    break;
                case 8:
                    $orderingOutput = 'pv.count_products DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'pv.ordering ASC';
                    break;
            }
            break;
        default:
            //PRODUCTS
            switch ((int) $ordering) {
                case 2:
                    $orderingOutput = 'pc.ordering DESC';
                    break;
                case 3:
                    $orderingOutput = 'a.title ASC';
                    break;
                case 4:
                    $orderingOutput = 'a.title DESC';
                    break;
                case 5:
                    $orderingOutput = 'a.price ASC';
                    break;
                case 6:
                    $orderingOutput = 'a.price DESC';
                    break;
                case 7:
                    $orderingOutput = 'a.date ASC';
                    break;
                case 8:
                    $orderingOutput = 'a.date DESC';
                    break;
                case 21:
                    $orderingOutput = 'a.date_update ASC';
                    break;
                case 22:
                    $orderingOutput = 'a.date_update DESC';
                    break;
                case 9:
                    $orderingOutput = 'rating ASC';
                    break;
                case 10:
                    $orderingOutput = 'rating DESC';
                    break;
                case 11:
                    $orderingOutput = 'a.id ASC';
                    break;
                case 12:
                    $orderingOutput = 'a.id DESC';
                    break;
                case 13:
                    $orderingOutput = 'a.sales ASC';
                    break;
                case 14:
                    $orderingOutput = 'a.sales DESC';
                    break;
                case 15:
                    $orderingOutput = 'a.hits ASC';
                    break;
                case 16:
                    $orderingOutput = 'a.hits DESC';
                    break;
                case 17:
                    $orderingOutput = 'ah.hits ASC';
                    break;
                case 18:
                    $orderingOutput = 'ah.hits DESC';
                    break;
                case 19:
                    $orderingOutput = 'a.sku ASC';
                    break;
                case 20:
                    $orderingOutput = 'a.sku DESC';
                    break;
                case 99:
                    $orderingOutput = 'RAND()';
                    break;
                case 1:
                default:
                    $orderingOutput = 'pc.ordering ASC';
                    break;
            }
            break;
    }
    return $orderingOutput;
}