Jump to content

Associate a shop to group upon creation


Recommended Posts

Hello,

My default shop is ID 7.

I have then two other shops ID 1 & 2.

A customer always belong to either 1 or 2.

When a guest is registrating a new account, he's then on Shop 7 during the process. The registration script will then select if he belongs to shop 1 or 2 according to some rules.

So, I'm creating a blank Group object, and associate it the group I chose for the user : 

$group = new Group();
$group->associateTo($ape_id_shop);

I define few other properties and then add the object to the database.

$group->add();

However, I found out, that it will always be registered with ID shop 7, that is the default shop. 

I tried to defined the shop in the constructor, same result.

The only way I found so far, is to execute a manual query after adding the group to the database, updating the id_shop to the one I want, but that's not really a beautiful way.

I couldn't find a native/correct way to do it.

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...