Back to PhocacartAttribute class

Method getTypeArray

public static
getTypeArray
(mixed $returnId = 0, mixed $returnValue = 0, mixed $returnFull = 0)

Method getTypeArray - Source code

public static function getTypeArray($returnId = 0, $returnValue = 0, $returnFull = 0)
{
    // 0 ... Title
    // 1 ... Default Value Type (1 ... multiple default values (checkbox), 2 ... single default value (select box))
    // EDIT PHOCACARTATTRIBUTE (attribute class, attribute layouts)
    $o = array('1' => array(Text::_('COM_PHOCACART_ATTR_TYPE_SELECT'), 0), '2' => array(Text::_('COM_PHOCACART_ATTR_TYPE_COLOR_SELECT'), 0), '3' => array(Text::_('COM_PHOCACART_ATTR_TYPE_IMAGE_SELECT'), 0), '4' => array(Text::_('COM_PHOCACART_ATTR_TYPE_CHECKBOX'), 1), '5' => array(Text::_('COM_PHOCACART_ATTR_TYPE_COLOR_CHECKBOX'), 1), '6' => array(Text::_('COM_PHOCACART_ATTR_TYPE_IMAGE_CHECKBOX'), 1), '7' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXT_64'), ''), '8' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXT_128'), ''), '9' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXT_256'), ''), '10' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXTAREA_1024'), ''), '11' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXTAREA_2048'), ''), '12' => array(Text::_('COM_PHOCACART_ATTR_TYPE_TEXT_COLOR_PICKER'), ''), '20' => array(Text::_('COM_PHOCACART_ATTR_TYPE_GIFT'), ''));
    if ((int) $returnId > 0 && (int) $returnValue > 0) {
        return $o[(int) $returnId][(int) $returnValue];
        //returnValue: 0 ... Title, 1 ... Default Value Type
    }
    if ((int) $returnId > 0) {
        return $o[(int) $returnId];
        // whole row
    }
    if ($returnFull == 0) {
        $o2 = array();
        foreach ($o as $k => $v) {
            $o2[$k] = $v[0];
        }
        return $o2;
        // text and value for select box
    }
    return $o;
}