Jump to content

Override Controllers Would Effect Multiple Shops?


phpaddicted

Recommended Posts

Hi Team,

 

I really loved override feature of modules and controllers and I am enjoying working with it, But I have one question. I am working on project  in which we will have Multiple Shops,So for one shop if I will override IndexController.php then will it effect to other shops too? If yes, then is there any method by which I can override controller for particular shops only?

 

Please let me know I am stuck here.

 

Ankur

Link to comment
Share on other sites

So for one shop if I will override IndexController.php then will it effect to other shops too?

 

 

Yes it would effect all Shops

 

If yes, then is there any method by which I can override controller for particular shops only?

 

Yes, research the Context and Shop classes. 

 

In your controller, you would get the Shop object contained in the Context

$shop = $this->context->shop;

Then you could check the Shops ID and decide what needs to be done

if ($shop->id_shop == 1)
   do something
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...