Jump to content

How to Identify function call in prestashop


NishantVadgama

Recommended Posts

I want to know from where the function call or identify function call such as I have situation as follows.

In my module development I have override cart's getOrderTotal() method to add some surcharges as my modules requirements, so I want to call that method only if its call by Payment Methods (or say in payment hook ) ONLY. so How can I do this ?

Thank You in advance. 

Edited by NishantVadgama (see edit history)
Link to comment
Share on other sites

Ii am afraid the only way is to run a debug backtrace and try to identify the module's name, like

		$dlist=debug_backtrace(false);
        $dlist=array_reverse($dlist);

        foreach($dlist AS $trace){
            if(isset($trace['file']) && stristr($trace['file'], 'modules')){
                $name=explode(DIRECTORY_SEPARATOR, $trace['file']);
                $names[]=pSQL($name[array_search('modules', $name)+1]);
            }
        }
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...