how override the discussion controller in my new addon using cs cart?

709 Views Asked by At

I need to override the discussion controller in my blog addon. how to do.

I have need to override the:

$discussion_settings = Registry::get('addons.discussion'); 

this to :

$blog_setting=Registry::get('addons.blog');
$discussion_object_types=array_merge($discussion_object_types,$blog_arr);
$discussion_settings=array_merge($discussion_settings,$blog_setting);

how to override the discussion controller in my blog addons.

1

There are 1 best solutions below

4
On

Please try to add file app/addons/blog/controllers/frontend/init.pre.php

<?php

use Tygh\Registry;

if (!defined('BOOTSTRAP')) { die('Access denied'); }

if (Registry::get('runtime.controller') == 'blog') {

    #get
    $discussion_settings = Registry::get('addons.discussion');

    $blog_setting=Registry::get('addons.blog');
    $discussion_object_types=array_merge($discussion_object_types,$blog_arr); //?????
    $discussion_settings=array_merge($discussion_settings,$blog_setting);   

    #set
    Registry::set('addons.discussion', $discussion_settings);

}