Reputation: 91
I'm currently working on a few modules connected to a ERP system. The ERP manages pretty much everything (customers, products, orders, order status...) but I'm having a bit of a hard time with the customer groups. I want to be able to add and update those same groups threw a module. Does anyone have any insight on this? Will I have to override the core class?
Upvotes: 2
Views: 646
Reputation: 91
Here is the solution to my own question. Feel free to write me in case you have questions.
private function validateGroup($group_name)
{
$group = new Group();
return $validation = $group->searchByName($group_name);
}
public function addGroup($groups)
{
$new_group = new Group();
foreach ($groups as $group) {
$new_group->name = $group->name;
$new_group->price_display_method = 1; //0 - Doesn't display price 1 - Display price
if (!$authentication = $this->validateGroup($group->name)) {
$new_group->add();
} else {
$new_group->update();
}
}
}
Cheers
Upvotes: 3