Back to PhocacartOrdering class

Method getOrderingCombination

public static
getOrderingCombination
(mixed $orderingItem = 0, mixed $orderingCat = 0)

Method getOrderingCombination - Source code

/*public static function getOrderingCategoryArray() {
		$itemOrdering	= array(
				1 => Text::_('COM_PHOCACART_ORDERING_ASC'),
				2 => Text::_('COM_PHOCACART_ORDERING_DESC'),
				3 => Text::_('COM_PHOCACART_TITLE_ASC'),
				4 => Text::_('COM_PHOCACART_TITLE_DESC'),
				5 => Text::_('COM_PHOCACART_DATE_ASC'),
				6 => Text::_('COM_PHOCACART_DATE_DESC'),
				//7 => JText::_('COM_PHOCACART_ID_ASC'),
				//8 => JText::_('COM_PHOCACART_ID_DESC'),
				11 => Text::_('COM_PHOCACART_COUNT_ASC'),
				12 => Text::_('COM_PHOCACART_COUNT_DESC'),
				13 => Text::_('COM_PHOCACART_AVERAGE_ASC'),
				14 => Text::_('COM_PHOCACART_AVERAGE_DESC'),
				15 => Text::_('COM_PHOCACART_HITS_ASC'),
				16 => Text::_('COM_PHOCACART_HITS_DESC'));
		return $itemOrdering;
	}*/
public static function getOrderingCombination($orderingItem = 0, $orderingCat = 0)
{
    $itemOrdering = '';
    $catOrdering = '';
    $ordering = '';
    if ($orderingItem > 0) {
        $itemOrdering = PhocacartOrdering::getOrderingText($orderingItem, 0);
    }
    if ($orderingCat > 0) {
        $catOrdering = PhocacartOrdering::getOrderingText($orderingCat, 1);
    }
    if ($catOrdering != '' && $itemOrdering == '') {
        $ordering = $catOrdering;
    }
    if ($catOrdering == '' && $itemOrdering != '') {
        $ordering = $itemOrdering;
    }
    if ($catOrdering != '' && $itemOrdering != '') {
        $ordering = $catOrdering . ', ' . $itemOrdering;
    }
    return $ordering;
}