Hello,
i need some help please about adding a field in customers BO table.
the field or the column must be named "points" and his value is the number of points that the customer got in module loyalty.
what i did:
in the class customer.php i added a field named points and a function:
public $points;
public function pointOfCustumer($id_customer){
return Customer::getPoint($id_customer);
}
public static function getPoint($id_customer)
{
$sql='SELECT SUM(points) FROM `'._DB_PREFIX_.'loyalty` WHERE `id_customer`='.$id_customer.' AND `id_loyalty_state`=2';
return (int)Db::getInstance()->getValue($sql);
}
if the file AdminCustomersController.php on the constructor, i added
'points' => array(
'title' => $this->l('Points'),
'width' => 'auto'
),
i have to use somewhere maybe something like:
'totalPoints' => $this->context->customer->pointOfCustumer($this->context->customer->id),
and give the value to 'Points' in the constructor
yes, i'm a beginner and sorry for my bad english :s
thank's for reading this, and if you have any idea, SOS