Jump to content

Problem to create a custom field


williamespindola

Recommended Posts

I create a simple code to add a new fiel on customer table. The code is this:

<?php

class Customer extends CustomerCore
{
    public function __construct($id = null)
    {
        $this->addCpfField();
        parent::__construct($id);
    }

    public function addCpfField()
    {
        return parent::$definition['fields']['cpf'] = array(
            'type' => self::TYPE_STRING, 
            'validate' => 'isGenericName', 
            'required' => true, 
            'size' => 14
        );
    }
}
ALTER TABLE ps_customer ADD cpf VARCHAR(14) NOT NULL AFTER lastname;

But, when open the your profile http://localhost/identity to edit your data I have the following error:

 

Notice: Undefined property: Customer::$cpf in /home/william/public_html/classes/ObjectModel.php on line 833

 

I looked this class ObjectModel.php and debug it, the cpf field exist on definition property but not as a property.  Some tip?

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...