Jump to content

Overriding just one function from class


vasikgreif

Recommended Posts

Hi, I would need to do some minor change in setLastInvoiceNumber() function in Order.php class. Is there a way to override just this function? I mean, if I copy the whole Order.php to overrides/classes/order/Order.php, I will override the whole class, which is kind of overkill and makes updating PS harder I guess...

Link to comment
Share on other sites

I agree deeply with you and don't love overrides myself at all, anyway you can override just 1 function in your class, the rest will come from the parent

class Order extends OrderCore
{
   public function myOverriddenFunction() {
        return $myresult;
   }
}

this can be enough to cange the output of just one function, I don't know what you need to do but this example should help

Edited by misthero (see edit history)
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...