Holiday Sale 30% OFF sitewide on all WordPress & WooCommerce plugins — use code Shop Now →
Back to all articles
Web Development Nov 30, 2026 9 min read
TECHRBUN // CODING

How to Override PrestaShop Controllers Easily

Want to tailor how your PrestaShop store handles pages, requests, or customer actions? PrestaShop controller overrides let you adjust existing behavior without editing core files, helping keep your customizations easier to maintain through updates.

In this guide, you’ll learn how PrestaShop controller overrides work and how to set them up with confidence. We’ll cover the key steps, common pitfalls, and practical tips so you can make changes safely and keep your store running smoothly.

Understand PrestaShop Controller Overrides

A small change to a controller can affect an entire customer journey, from opening a product page to submitting an order. Knowing what a controller handles—and when PrestaShop can use your replacement—helps you make targeted changes without disrupting unrelated features.

First, it helps to see controllers as the part of the application that responds to a particular request and coordinates what happens next.

What Controllers Do

When a shopper visits a page or submits a form, a controller processes the request. It can load data, apply business rules, call other application components, and prepare a response, such as rendering a page or redirecting the visitor.

PrestaShop has controllers for both the storefront and the Back Office. For example, a product controller handles product-page requests, while a cart controller responds to actions such as adding an item. The controller is not usually where I would put every bit of custom logic; its job is to coordinate the request.

With that role in mind, the next question is whether changing a controller is the right solution. An override is useful for some request-level changes, but it is not the best tool for every customization.

When to Use an Override

I consider an override when I need to change or extend behavior in an existing legacy controller and there is no suitable hook or module method for the task. For instance, a store might need a product page to prepare additional data before it is displayed.

Before choosing this route, I check whether a less intrusive option will work:

  • Use a hook when PrestaShop already provides an extension point for the action.
  • Use a module for self-contained features that should be easy to enable or remove.
  • Use an override only when the required controller behavior cannot be changed cleanly through those options.

Overrides can conflict if multiple modules try to replace the same class, so I keep them focused and document the change.

Once an override is justified, it is important to know how PrestaShop discovers it. The exact details depend on the controller type and PrestaShop version, especially as newer Back Office pages use Symfony-based architecture.

How PrestaShop Loads Overrides

For legacy controllers, PrestaShop looks for replacement classes in the override/controllers directory. The replacement generally uses the expected class name and extends the original controller, allowing me to replace selected methods while retaining inherited behavior.

PrestaShop also maintains class-loading information for overrides. After adding or changing one, I clear the appropriate cache so that this information can be rebuilt; otherwise, the old class may continue to load. I test the result on a staging store and check both the affected page and related flows.

Do not assume every controller follows this legacy process. Many newer Back Office controllers are managed through Symfony, so I first identify the controller type and check the guidance for the store’s PrestaShop version before implementing a replacement.

Create PrestaShop Controller Overrides

Once you have identified the controller and confirmed an override is appropriate, the work becomes a matter of precision. I start by locating the exact class, then change only the behavior the store needs.

Finding the matching controller prevents edits from landing in the wrong part of the request flow. I check the PrestaShop version and whether the page uses a legacy controller before creating any files.

Find the Right Controller

Reproduce the action you want to change, such as opening a product page or submitting a cart update, and note the page type and URL. Then search the relevant PrestaShop source directory for the controller class; storefront controllers are commonly under controllers/front, while legacy Back Office controllers are under controllers/admin.

For example, a product page may use ProductController. Check that its source class is a legacy controller before proceeding. If the page belongs to the newer Symfony-based Back Office, this override pattern may not apply, so use the extension approach supported by your version instead.

With the class confirmed, create a file that mirrors its location and name in the override directory. Matching the class correctly is essential: a filename that looks right but declares the wrong class will not replace the intended controller.

Build the Override File

For a legacy front controller, the path commonly looks like override/controllers/front/ProductController.php. The class usually extends the original controller’s Core class, as in this simplified example:

<?php
class ProductController extends ProductControllerCore
{
    // Add a focused change here.
}

Use the corresponding admin path for an eligible legacy Back Office controller. I also keep a copy of the original file outside the live store and avoid adding unrelated changes to the same override.

After the file is in place, choose the smallest method that can deliver the result. A narrow change is easier to test and less likely to interfere with other controller behavior.

Add or Change Controller Logic

Override only the method you need, and call the parent method when the original work should still happen. For example, if I add data during initContent(), I preserve the inherited setup with parent::initContent() where appropriate, then add the new behavior.

Before saving, compare the method signature with the original controller. Keep its parameters and visibility compatible, use existing services or tools where possible, and validate inputs before acting on them. These checks help avoid PHP errors and unexpected changes to the customer journey.

Finally, make PrestaShop rebuild its override lookup information so it can detect the new class. The exact cache location can vary by version and environment, so I use the store’s built-in controls first.

Clear the Cache and Refresh the Class Index

In the Back Office, open Advanced Parameters > Performance and clear the cache. If the override still does not load, check the relevant cache directory for the class index file; its location depends on the PrestaShop version and environment. Remove or rebuild it only when needed, then clear the cache again.

Test on staging before deploying. Confirm the changed page works, then check nearby flows—such as adding a product to the cart—and review the PHP error log if PrestaShop continues loading the original controller.

Test and Maintain Your Changes

A page that looks right once can still fail during checkout or after a routine update. I treat testing as part of the override work, not a final formality: it helps catch problems before customers or staff run into them.

Start by checking the experience from both sides of the store. A change that works for a visitor may still affect staff workflows or another request that uses the same controller.

Verify the Front and Back Office

On a staging store, repeat the exact action that the override changes, then test a few related flows. If you changed a product page, for example, check product variations, stock messages, and adding the item to the cart—not just the page’s initial display.

I also check the Back Office when the change could affect product, order, or customer data. Confirm that staff can still complete their usual tasks and that the right values appear where expected. A short checklist makes these checks easier to repeat:

  • Test as a guest and, where relevant, as a signed-in customer.
  • Try valid and invalid inputs, including empty or unusual values.
  • Check desktop and mobile layouts, redirects, and error messages.
  • Review logs for PHP errors or warnings after each test.

If a check fails, narrow down when the problem began and what request triggers it. That usually points me toward the override, its cache entry, or an interaction with another customization.

Troubleshoot Common Problems

If PrestaShop keeps using the original controller, I recheck the file path, declared class name, and parent class. I then clear the cache and refresh the class index as needed for that version. A syntax error or incompatible method signature can also prevent the replacement from loading, so I check the PHP error log rather than guessing.

When the issue appears only after another module is enabled, look for a conflict over the same controller. Disable changes one at a time on staging to identify the source; avoid deleting another module’s files as a first response. For newer Symfony-based Back Office pages, confirm that the legacy override approach is supported before troubleshooting it as a legacy controller.

Once the behavior is stable, keep the change understandable for the next maintenance cycle. PrestaShop updates can alter the original methods your override relies on.

Keep Overrides Compatible with Updates

Before upgrading PrestaShop, compare the updated controller with the version your override was based on. Check whether method signatures, parent behavior, or the request flow changed, then adjust and retest the override on staging before deploying.

I keep a brief record of the override’s purpose, affected class, tested version, and any related module dependencies. That makes future reviews quicker and helps me spot whether a hook or module extension has become a safer replacement. After each upgrade, repeat the key customer and staff checks instead of assuming the old tests still cover the new code.

Make PrestaShop Controller Overrides Work for You

PrestaShop controller overrides can help you adapt legacy controller behavior while keeping changes separate from core files. The best results come from confirming that an override is appropriate, targeting the correct controller, and keeping your change focused.

Test on staging, clear the relevant cache, and check related customer and staff workflows before deployment. With careful troubleshooting and a quick compatibility review after updates, you can make useful customizations with greater confidence—and keep your store running smoothly.

Discussion

0 Comments

Leave a comment ↓

No comments yet. Share your thoughts or questions below.

Leave a Comment

Your email address will not be published. Required fields are marked *