Metaversion 2.0 having issue with controller method while calling custom methods on view

module
oxid6

#1

while we are calling custom method through view using metadata version 2.0. our controller method not been supported.

we have tried with [{$oxView->customfunction()}] but certainly its not working. anyone know about that how can we call method on view using custom module controller to pull the result set on view?


#2

you need to pay attention on little things: its not $oxVIew, its $oView


#3

Through oView its also not working but when i am rending [{ $oView }] my custom model is rendering properly. when i tried with key its also not working.

do we need to overwrite $oViewConf to call that function?


#4

deepends on where you need your custom function:
if you need it only in one controller, its better to extend this controller.
if you need it everywhere across all controllers, then oxViewConfig is the only way

we need so see some code, at least metadata file and class inheritance + function definition of your extension class


#5

Metadata.php

/*
nothing

@category module
@package gkfilter
@author demo User
@link www.google.com
@copyright © gk20012018
/

/**

  • Metadata version
    /
    $sMetadataVersion = ‘2.0’;

/*
Module information
/
/**

  • TODO: Replace sample names and paths (like ‘[ParentClassName]’, ‘[your_template]’, etc.) with real ones You need.
    TODO: Uncomment lines You need, add more if needed, delete not required.
    TODO: Remove all this TODO comment.
    /
    $aModule = array(
    ‘id’ => ‘gkgkfilter’,
    ‘title’ => array(
    ‘de’ => ‘[TR - GK Gk Filter]’,
    ‘en’ => ‘GK Gk Filter’,
    ),
    ‘description’ => array(
    ‘de’ => ‘[TR - GK Gk Filter Module]’,
    ‘en’ => ‘GK Gk Filter Module’,
    ),
    ‘thumbnail’ => ‘out/pictures/picture.png’,
    ‘version’ => ‘1.0.0’,
    ‘author’ => ‘Hello User’,
    ‘url’ => ‘www.google.com’,
    ‘email’ => ‘[email protected]’,
    ‘extend’ => array(

    \OxidEsales\Eshop\Application\Model\Article::class => OxidEsales\Gk\AttributeFilter\Model\Gkarticle::class,
    \OxidEsales\Eshop\Application\Controller\FrontendController::class => OxidEsales\Gk\AttributeFilter\Controller\GkFrontendController::class
    ),
    ‘files’ => array(
    ‘gkgkfiltermodule’ => ‘gk/gkfilter/core/gkgkfiltermodule.php’,
    //’[your_class_name]’ => ‘gk/gkfilter/[appropriate_folder]/gkgkfilter[your_class_name].php’,
    ),
    ‘templates’ => array(
    //’[your_template].tpl’ => ‘gk/gkfilter/views/pages/[theme_folder_path]/gkgkfilter[your_template].tpl’,
    ),
    ‘blocks’ => array(

     array('template' => 'page/list/list.tpl', 'block' => 'page_list_listhead', 'file' => 'views/blocks/page_list_listhead.tpl')
     /*array(
         'template' => '[theme_folder]/[theme_template].tpl',
         'block' => 'gkgkfilter_[your_block_name]',
         'file' => 'views/blocks/gkgkfilter[your_block_name].tpl',
     ),/
    

    ),
    ‘settings’ => array(
    /*array(
    ‘group’ => ‘gkGkFilter[SettingsGroup]’,
    ‘name’ => ‘gkGkFilter[SettingName]’,
    //TODO: Change type to one You need: ‘bool’, ‘str’, ‘num’, ‘arr’, ‘aarr’, ‘select’. Remove this comment.
    ‘type’ => ‘str’,
    ‘value’ => ‘[initial_setting_value]’,
    ),
    ),
    ‘events’ => array(
    ‘onActivate’ => ‘gkGkFilterModule::onActivate’,
    ‘onDeactivate’ => ‘gkGkFilterModule::onDeactivate’,
    ),
    );


#6

@vanilla_thunder - Can you please take a look our metadata.php which I have pasted above.