Back to PhocacartAttribute class

Method getAttributeLength

public static
getAttributeLength
(mixed $type, mixed $typeOption = 0)

Method getAttributeLength - Source code

public static function getAttributeLength($type, $typeOption = 0)
{
    // EDIT PHOCACARTATTRIBUTE ATTRIBUTETYPE
    switch ($type) {
        case 7:
            return 64;
            break;
        case 8:
            return 128;
            break;
        case 9:
            return 256;
            break;
        case 10:
            return 1024;
            break;
        case 11:
            return 2048;
            break;
        case 12:
            return 7;
            break;
        // GIFT
        case 20:
            if ($typeOption == 20) {
                return 100;
            }
            // recipient name
            if ($typeOption == 21) {
                return 50;
            }
            // recipient email
            if ($typeOption == 22) {
                return 100;
            }
            // sender name
            if ($typeOption == 23) {
                $paramsC = PhocacartUtils::getComponentParameters();
                $gift_sender_message_length = $paramsC->get('gift_sender_message_length', 500);
                return (int) $gift_sender_message_length;
            }
            // sender message
            if ($typeOption == 24) {
                return 3;
            }
            // gift type
            return 0;
            break;
        default:
            return 0;
            break;
    }
    return 0;
}