Jump to content

Edit History

vrobador

vrobador


Missed one part

I know this is an old topic, but i think i've found a solution, at least for PS Version 1.7.7.8

My situation is that I have to share customers within all the stores, but the stock only between store groups. Unfortunately this can't be done, because customers only are shared between groups, and while a costumer was regitered in one store, and he can sign up in other store of the same group, he can't sign up in other group's store.

Investigating about it, I discovered the problem was in the login process, so i looked for how login is done, and found it, in the costumer core class. On it, there is a function which is used for login, public function getByEmail($email, $plaintextPassword = null, $ignoreGuest = true)

On it I found the code that filters the id_shop or id_shop_group while login:

if (Shop::getContext() == Shop::CONTEXT_SHOP && $shopGroup['share_customer']) {
	$sql->where('c.`id_shop_group` = ' . (int) Shop::getContextShopGroupID());
} else {
	$sql->where('c.`id_shop` IN (' . implode(', ', Shop::getContextListShopID(Shop::SHARE_CUSTOMER)) . ')');
}

So, as I want is all costumers to be shared by all shop groups, I made a Override of hte CostumerCore class just with the functions getByEmail and customerExists, removing the id_shop and id_shop_group filters or adapting them to my specifications.

 

Be careful, as this code appears twice on the getByEmail Function

I've looking fo other id_shop and id_shop_group filters related with costumers, and is the only i've found. Now the project is under development, so some bugs may appear. Any thing related I found I'll promise to share

 

 

 

 

vrobador

vrobador

I know this is an old topic, but i think i've found a solution, at least for PS Version 1.7.7.8

My situation is that I have to share customers within all the stores, but the stock only between store groups. Unfortunately this can't be done, because customers only are shared between groups, and while a costumer was regitered in one store, and he can sign up in other store of the same group, he can't sign up in other group's store.

Investigating about it, I discovered the problem was in the login process, so i looked for how login is done, and found it, in the costumer core class. On it, there is a function which is used for login, public function getByEmail($email, $plaintextPassword = null, $ignoreGuest = true)

On it I found the code that filters the id_shop or id_shop_group while login:

if (Shop::getContext() == Shop::CONTEXT_SHOP && $shopGroup['share_customer']) {
	$sql->where('c.`id_shop_group` = ' . (int) Shop::getContextShopGroupID());
} else {
	$sql->where('c.`id_shop` IN (' . implode(', ', Shop::getContextListShopID(Shop::SHARE_CUSTOMER)) . ')');
}

So, as I want is all costumers to be shared by all shop groups, I made a Override of hte CostumerCore class jsut with this function, removing the id_shop and id_shop_group filters or adapting them to my specifications.

Be careful, as this code appears twice on the getByEmail Function

I've looking fo other id_shop and id_shop_group filters related with costumers, and is the only i've found. Now the project is under development, so some bugs may appear. Any thing related I found I'll promise to share

 

 

 

 

×
×
  • Create New...