Jump to content

Call function in cart-detailed-product-line


13thjoker

Recommended Posts

If you want to call function by this way - you need to create static function

class ClassName {
	// need instance of class
	public function TestFunction()
    {
        $page = "hi"
        return $page;
    }
	// call staticaly by class name
	public static function TestFunctionStatic()
    {
        $page = "hi"
        return $page;
    }
}

this example help you to understand

// create object instance
$testObj = new ClassName();
// call public method
$testObj->TestFunction(); // will return "hi"


// call static method
$testObj = ClassName::TestFunctionStatic();
// $testObj now contains "hi"

 

  • Like 1
Link to comment
Share on other sites

Update: it gives me this now

UndefinedMethodException in smarty_internal_templatebase.php(171) : eval()'d code line 882: Attempted to call an undefined method named "TestFunctionStatic" of class "CartControllerCore".

    in smarty_internal_templatebase.php(171) : eval()'d code line 882

 

 

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