News:

AbanteCart v1.4.2.1 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Loading resource scripts in hook function

Started by dhigz, September 03, 2020, 09:09:24 PM

Previous topic - Next topic

dhigz

Hi,

I am attempting to add image functionality to and existing controller by loading the resource_scripts though dispatch and dispatchGetOutput like other controllers. I can add the html using addChild with no problem. The script portion is throwing an error: Call to protected method AController::dispatch() from context '...

Here is the code which is included in function onController...._UpdateData().

$resources_scripts = $that->dispatch(
            'responses/common/resource_library/get_resources_scripts',
            array(
                'object_name' => 'collections',
                'object_id'   => $id,
                'types'       => array('image'),
            )
        );
        $that->view->assign('resources_scripts', $resources_scripts->dispatchGetOutput());



Any suggestions of how I can get around this error or a different method to add the resource scripts?

Don

abantecart

If you look into public_html/core/engine/controller.php:328
protected function dispatch(...
You can access/call this method.

Try to create a new instance of yourself


$resources_scripts = new ADispatcher(
            'responses/common/resource_library/get_resources_scripts',
            array(
                'object_name' => 'collections',
                'object_id'   => $id,
                'types'       => array('image'),
            )
        );


dhigz

Thanks. That worked.

that was the last issues I needed to resolve.

Forum Rules Code of conduct
AbanteCart.com 2010 -