This question already has an answer here:
I am trying to create a simple task as follows:
1. Write a custom controller
2. create a cart if it is not created
3. add a product to the cart
came accross this code that is similar.
I need to know a few things:
1. In which folder should i place my custom controller?
2. Which parent controller class should my controller extend?
3. what will be the url for the controller?
</div>
It depends on when you want this action to happen. Like always with prestashop, you have 2 possibilities :
For example if you want to add a product to the cart everytime its created, you might want to override CartController. In that case here is the answers to your questions :
override/controllers
folder.I think this is the best choice if you want to have a real control over when you trigger this action.