Oxid6 Basic module - Creation and Testing

Hey Guys,

I have started building basic module but I have a doubt on controller. Please have a look at my below code and please correct me. I want to print “hello world” when I clicked on submenu of menu item.

<?php 

class Shield extends oxAdminView
{
    /**
     * Executes parent method parent::render() and returns name of template
     * file "theme.tpl".
     *
     * @return string
     */
    public function render()
    {
        parent::render();
        
		ini_set('display_errors','On');
        return "shield.tpl";
    }
}

Also when I tested, it is loading me, home page of website.

Thanks,
Wasim

Hey Wasim :slight_smile:

what does your metadata.php look like?

You mean submenu in admin?
To add your own menu item in the admin create menu.xml file in your modul directory. The structure of menu.xml you can see in core menu.xml https://github.com/OXID-eSales/oxideshop_ce/tree/master/source/Application/views/admin

1 Like

Hey Bro,

metadata.php:

<?php $sMetadataVersion = '1.1'; /** * This Software is the property of KMUdo AG - it is NOT Freeware. * * Shop versions 4.8.x and 4.9.x CE * * @link http://www.kmudo.ch/ * @author KMUdo(CGE) * @email [email protected] * @copyright 2015© KMUdo AG * @version 2.0 */ $aModule = array( 'id' => 'shield', 'title' => 'avenger - shield', 'description' => 'Powerful team for OXID', 'thumbnail' => 'shield.png', 'version' => '2.0', 'author' => 'shield - Natasha', 'email' => '[email protected]', 'url' => 'http://www.avenger.ch', 'extend' => array( 'navigation' => 'avenger/shield/extends/navigation_extended', ), 'files' => array( 'shield' => 'avenger/shield/controllers/admin/shield.php', ), 'events' =>array( ), 'blocks' => array( ), 'templates' => array( 'shield.tpl' => 'avenger/shield/views/admin/tpl/shield.tpl', ), 'settings' => array( //array('group' => 'main', 'name' => 'KMUdoHeaderExtend', 'type' => 'bool', 'value' => 'true'), ), );

Which version you use? OXID5 or OXID6?
To extend the navigation controller is own solution, how does this look like?
Maybe easier is to create own menu.xml with new admin submenu item.

I am using oxid 6.0.5 and I have created menu.xml but the issue is, I am getting home page of website instead of hello world and I am not able to figure out the issue. Also in controller.php, instead of file name, I also passed ‘hello world’ in return type.

<?xml version="1.0" encoding="UTF-8"?>
  </SUBMENU>
</MAINMENU>

First I think your code look like OXID5, maybe you have to refactor it e.g. you use in your metadata.php version equal 2.0 and in your Shield controller you use oxAdminView I think this is your error.

Two solutions

  1. Change your version in metadata.php to 1.0

  2. Change your extends to \OxidEsales\Eshop\Application\Controller\Admin\AdminController and work with namespaces

1 Like

Sir,

I tried with your inputs and some effort from myside but still I have failed. Could you please check the below github link and correct me, where I am wrong…

Thank you,
Wasim

Hi Wasim :slight_smile:

there is a lack of basic knowledge for OXID6 module development.

Wait I have a look on your code.

Thank you Mr. Indianer3c :slight_smile:

I create a pull request with my solution https://github.com/wasim1108/oxid605/pull/1/commits/a08dedf047f8c455776fb339c8c01261ee741717 :slight_smile:

Hint when you see an error, have a look into the directory/source/log/ and search for a file with the name oxideshop.log

Thank you :slight_smile: Will check and let you know…

1 Like

Folks,

  • This Software is the property of KMUdo AG - it is NOT Freeware.

I’m not really sure what’s going on here. For me, it looks like a module which was written for an older OXID version shall be updated. This seems to be not programmed from scratch.

Also it seems that the author of this module is somebody different than @wasim. The above entry in meteadata.php actually makes it clear that this module is not open source but under a commercial license. Did you talk to the vendor before? Are you really allowed to use it this way and to upload it in GitHub?

Please be very careful with lax handling like that. The author of the module would in doubt have any right to kick your arse :wink:

Dear Marco,

It is already bought by us and I didn`t modified it. I wanted to worked on test module. So copied the data and pasted it to test metadata file. So chill :wink:

1 Like

Hi Marco thanks for the advice. I deleted the Repository and close the Pull-Request https://github.com/wasim1108/oxid605/pull/1 :slight_smile:

Hey Wasim :slight_smile:

I thought KMUdo AG is your employer. Please be careful in the future.