Override Class - Prestashop

Locate original class – /classes/Product.php → method public static function getProductPrice(...) inside ProductCore .

The override class must extend the *Core version of the original class (e.g., ProductCore ). 4. How the Override System Works (Flow) graph TD A[Request calls e.g. 'new Cart()'] --> B[Autoloader looks for class Cart] B --> CExists in /override/classes/ ? C -->|Yes| D[Load /override/classes/Cart.php] C -->|No| E[Load /classes/Cart.php] D --> F[Class Cart extends CartCore] F --> G[Execute override methods] E --> H[Execute original CartCore methods] PrestaShop uses a custom Autoload class that scans /override/ at runtime (or caches the mapping). When a class is instantiated, the autoloader loads the override version if present. 5. Creating an Override (Example) Goal: Modify the getProductPrice method in Product class to apply a special discount for VIP customers. prestashop override class

public static function getProductPrice( $id_product, $quantity, $id_product_attribute = null, $id_customization = null, $id_cart = null, $only_reduc = false, $use_tax = true, $id_shop = null, $use_reduc = true, $with_eco_tax = false ) // Call original method first $price = parent::getProductPrice( $id_product, $quantity, $id_product_attribute, $id_customization, $id_cart, $only_reduc, $use_tax, $id_shop, $use_reduc, $with_eco_tax ); Locate original class – /classes/Product

return $price;

| Original Core Path | Override Path | Class Name (Override) | |-------------------|---------------|------------------------| | /classes/Cart.php | /override/classes/Cart.php | class Cart extends CartCore | | /controllers/front/OrderController.php | /override/controllers/front/OrderController.php | class OrderController extends OrderControllerCore | | /core/Foundation/IoC/Container.php | /override/core/Foundation/IoC/Container.php | class Container extends ContainerCore | How the Override System Works (Flow) graph TD

// Apply VIP discount (example logic) if (Context::getContext()->customer->isLogged() && Customer::getInstance()->isVip()) $price = $price * 0.90; // 10% off

© 2026 Fillserv
Los Angeles, CA, USA

Brand names, logos and trademarks are used for descriptive purposes only and remain the property of their respective owners.
Their use by us does not imply endorsement by or association with the brand name owners.

Our ink and toner cartridges are either professionally remanufactured or compatible cartridges made and tested to work perfectly in your inkjet printer or laser toner printer. We offer our customers substantial savings over buying original inkjet cartridges and laser toner cartridges, with savings often up to 85% off the OEM cartridge cost. We also offer our customers alternative options - you can buy remanufactured cartridges or compatible cartridges, or you can refill your own cartridges with our inkjet and toner refill kits.