Jump to content

CartController could not be overridden


kronos88

Recommended Posts

Hello,

i've got a strange behavior and don't now where the cause is.
I override the CartController class from /controllers/front/CartController.php
This modified class i've got in my module under /override/controllers/front/CartController.php and also copied to /override/controllers/front/CartController.php

My code simply looks like this:

class CartController extends CartControllerCore
{
  public function processChangeProductInCart()
  {
    $query = 'INSERT INTO `ps_customized_data` (`id_customization`, `type`, `index`, `price`, `value`)
    VALUES (' . 1 . ', ' . 1 . ', ' . 2 . ', ' . 3 . ', \'Tedst\')';
    Db::getInstance()->execute($query);

    parent::processChangeProductInCart();
  }
}

It should only write a new entry in ps_customized_data (for testing).
But if i add a product into cart, the entry will not be writte to the database.

So if i add this code snipped to the real CartController and add new product to cart, the entry will be written to database.

What i'm doing wrong?
I'm using no cache, all overrides in settings are active.

grafik.thumb.png.44de997c74fc50b085ec8fb5b15b8bf6.png

Thanks for all your help.

Tobias

Link to comment
Share on other sites

Testing can be done by just echoing some string too.

Did you check whether the things that you do call this function processChangeProductInCart()at all?

Sometimes code works a bit differently than you would expect. 

It is also possible that this part of the code has been replaced with Symfony based code. 

Try activating Profiling to see from where relevant queries are called.

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...