I have custom module override product view. So in frontend I want to get action Save in Custom/Controller/Adminhtml/Custom/Save. How can I do this?


You cannot use controllers from the backend on frontend and the other way around.
In order to use a controlled from the backend you need a valid backend session and you cannot get that on the frontend.

I advice you to create a method (in a helper or something) that does all the heavy lifting for saving your entity and have 2 controllers (one for backend, one for frontend) that call this common method.

  • 2
    +1 for separate method. In Magneto 2 it is better to avoid helpers and create services instead, for CRUD operations some repository should be created (similar to \Magento\Catalog\Api\ProductRepositoryInterface) Nov 25 '15 at 9:17
  • @AlexP. I agree. I did say "in a helper or something". :) A helper is easier, but you are right. It should be avoided. A repository looks like the nice way to go.
    – Marius
    Nov 25 '15 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.