2

I was created "specialist" as custom customer attribute,while my development time it was working fine, now i move the files to server and doing the optimization(catch enable, compilation and etc..).

Now the front end is showing error "Source model "Federallawyer_Customer_Model_Entity_specialist" not found for attribute "specialist" ",

May i know what is the solution to rectify the problem, thanks in advance for your idea and help.

enter image description here

Code for add new attribure

$this->addAttribute('customer', 'specialist', array(
    'type'      => 'int',
    'label'     => 'Practice Area',
    'input'     => 'multiselect',
    'global' => true,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'source' => 'Federallawyer_Customer_Model_Entity_specialist',
));
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'specialist');
$attribute->setData('used_in_forms', array(
    'adminhtml_customer',
    'customer_account_edit',
));
$attribute->setData('is_user_defined',1);
$attribute->save();
  • Does that class exist? And is the lowercase word "specialist" a typo or is it actually trying to load that class? If it does, that might be your problem. – Arjen Miedema Jan 15 '16 at 14:02
  • Can you please explain briefly, i can not able to catch what you trying to convey – senthil Jan 18 '16 at 9:23
  • The thing is, your attribute has a source model. Can you send us the exact syntax of the source model as it's said in the database and can you send the path and code of the source model you want to load. – Arjen Miedema Jan 19 '16 at 21:07
  • i added the specialist attribute code and db screen for your further reference in my question – senthil Jan 20 '16 at 7:57
1

Maybe, problem is in the name of class, you need to use 'Federallawyer_Customer_Model_Entity_Specialist' instead of 'Federallawyer_Customer_Model_Entity_specialist' ? And always You ought to check resources models for attributes:

protected function _getAttributeOptions($attributeCode)
{
    if ($attributeCode) {

        /** @var Mage_Customer_Model_Attribute $attribute*/
        $attribute = Mage::getModel('eav/config')->getAttribute('customer', $attributeCode);
        $options = [];
        if ($attribute->usesSource()) {
            try {

                /** @var Mage_Eav_Model_Entity_Attribute_Source_Table $source */
                $source = $attribute->getSource();
                if ($source) {
                    foreach ($source->getAllOptions(false, true) as $option) {
                        $options[$option['value']] = $option['label'];
                    }

                    return $options;
                }
            } catch (Exception $e) {
                Mage::logException($e->getMessage());
            }
        }
    }

    return [];
}
  • i was try with the class name 'Federallawyer_Customer_Model_Entity_specialist' , but even this throw the same error,have any other way to fix the issue – senthil Jan 21 '16 at 7:50
1

How about adding your source model a little different. I don't know which namespace you're using for your extension's blocks, but if it's federallawyer_customer, you should set the source model to federallawyer_customer/entity_specialist.

Does that fix your issue?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.