Jump to content

Edit History

knacky

knacky

public function install()
{
    if (Shop::isFeatureActive()) {
        Shop::setContext(Shop::CONTEXT_ALL);
    }

   return (
        parent::install() 
        && $this->registerHook('actionObjectCustomerUpdateAfter')
    ); 
}

public function uninstall()
{
    return (
        parent::uninstall() 
        && $this->unregisterHook('actionObjectCustomerUpdateAfter')
    );
}

public function hookActionObjectCustomerUpdateAfter($params)
{
	$idCustomer = (int)$params['object']->id;
	$customer = new Customer((int)$idCustomer);
	$customerFirstname = $customer->firstname;
	$customerLastname = $customer->lastname;

	/* deactive customer, add siret, add ape */
	$db = Db::getInstance();
	$db->update('customer', 
		array(
			'active' => 0,
			'ape' => pSQL('12345678'),
			'siret' => pSQL('XA123456')
		), 
		'id_customer = '.(int)$idCustomer
	);
}

 

knacky

knacky

public function install()
{
    if (Shop::isFeatureActive()) {
        Shop::setContext(Shop::CONTEXT_ALL);
    }

   return (
        parent::install() 
        && $this->registerHook('actionObjectCustomerUpdateBefore')
    ); 
}

public function uninstall()
{
    return (
        parent::uninstall() 
        && $this->unregisterHook('actionObjectCustomerUpdateBefore')
    );
}

public function hookActionObjectCustomerUpdateBefore($params)
{
	$idCustomer = (int)$params['object']->id;
	$customer = new Customer((int)$idCustomer);
	$customerFirstname = $customer->firstname;
	$customerLastname = $customer->lastname;

	/* deactive customer, add siret, add ape */
	$db = Db::getInstance();
	$db->update('customer', 
		array(
			'active' => 0,
			'ape' => pSQL('12345678'),
			'siret' => pSQL('XA123456')
		), 
		'id_customer = '.(int)$idCustomer
	);
}

 

×
×
  • Create New...