# Generelle Frage Modul-Programmierung

**URL:** <https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082>\
**Category:** Deutsches Forum\
**Tags:** basics\
**Created:** [February 10, 2015, 11:53am UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082 "2015-02-10T11:53:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 10, 2015, 11:53am UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/1 "2015-02-10T11:53:01Z")

</div>

Ich habe ein neues Modul erstellt und die Einbindung ins Template funktioniert auch.

Template “productmain.tpl”:

```php
[{assign var="ShowSymbols" value=$oViewConf->getSymbols()}]
            Ausgabe Symbole: [{$ShowSymbols}]

```

Modul:

```php
<?php
 
class displaySymbols_main extends displaySymbols_main_parent {
    
    public function getSymbols() {
        //SQL erstellen
        $sPc = "select count(*) from oxarticles where oxactive = '1'";
        //DB verbindung
        $oDb = oxDb::getDb()->getOne($sPc);
        //wert zurueckgeben
        return $oDb;
    }
}

```

(abgewandelt von [qrella.com/oxid-modul-erstellen/](http://qrella.com/oxid-modul-erstellen/))

Nun meine Frage… Worauf kann ich innerhalb des Moduls zugreifen? Welche Klassen und Funktionen sind dort nutzbar?  
Ich möchte im Modul eine Ausgabe neuer Datenbanken-Spalten zusammenführen (mit Lazy Loading innerhalb des Templates ist das zu frickelig). Wie komme ich dort ran innerhalb des Moduls?

---

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 10, 2015, 2:47pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/2 "2015-02-10T14:47:53Z")

</div>

Oder einfacher… Wie bekomme ich am einfachsten den Artikelnamen ausgegeben?

```php
<?php
 
class displaySymbols_main extends displaySymbols_main_parent {
    
    public function getSymbols() {
		return $this->oxarticles__oxtitle->value;
    }
}

```

Das funktioniert nicht 😕

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [February 10, 2015, 4:37pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/3 "2015-02-10T16:37:14Z")

</div>

da fehlen etwa 99% vom Modul, es muss irgendwie wissen von welchem Artikel du den Titel haben willst. Und dann muss es den Artikel finden und laden.  
Und $this referenziert in dem Fall auf oxViewConfig und oxViewConfig hat kein oxarticles\_\_oxtitle Feld, weswegen es auch nicht funktioniert.

---

<div class="post-metadata">

**Author:** ![adamweber](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/a/da6949/32.png) [@adamweber](https://forum.oxid-esales.com/u/adamweber)\
**Post date:** [February 10, 2015, 4:43pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/4 "2015-02-10T16:43:53Z")

</div>

So wie ich das verstanden habe: Mit dem ersten Code count(\*) zählst du nur und gibst mit getOne kein Objekt aus. Am einfachsten in der metadata oxarticles mit displaySymbols\_main extenden. Dann sollte mit folgendem eine Ausgabe erfolgen.

```auto
[{assign var="ShowSymbols" value=[B]$oView->getSymbols()[/B]}] 

```

---

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 10, 2015, 6:12pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/5 "2015-02-10T18:12:37Z")

</div>

Danke für die Antworten!

[QUOTE=adamweber;156003]Am einfachsten in der metadata oxarticles mit displaySymbols\_main extenden. Dann sollte mit folgendem eine Ausgabe erfolgen.

```auto
[{assign var="ShowSymbols" value=[B]$oView->getSymbols()[/B]}] 

```

[/QUOTE]

Es sieht nun so aus:

[B]metadata.php[/B]

```php
<?php
 
/**
* Metadata version
*/
$sMetadataVersion = '1.1';
/**
* Module information
*/
$aModule = array(
    'id' => 'displaySymbols',
    'title' => 'Produktsymbole',
    'description' => 'Ermöglicht es, Produkten spezielle Symbole zuzuordnen.',
    'thumbnail' => 'mig.jpg',
    'version' => '0.1',
    'author' => 'xxxxxxx',
    'url' => 'http://www.xxxxx.de',
    'email' => 'xxx@xxxx.de',
    'extend' => array(
        'oxarticles' => 'displaySymbols/displaysymbols_main',
    ),
);

```

[B]productmain.tpl[/B]

```php
[{assign var="ShowSymbols" value=$oView->getSymbols()}]
            Ausgabe Symbole: [{$ShowSymbols}]

```

[B]displaysymbols\_main.php[/B]

```php
<?php
 
class displaySymbols_main extends displaySymbols_main_parent {
    
    public function getSymbols() {
		return $this->oxarticles__oxtitle->value; 
    }
}

```

Das funktioniert leider nicht, ich komme beim Anschauen der Artikelseite wieder auf die Startseite. Modul habe ich deaktiviert und erneut aktiviert, TMP gelöscht.

Inhalt der [B]EXCEPTION\_LOG.txt[/B]

```php
oxSystemComponentException-oxException (time: 2015-02-10 18:10:34): [0]: Function 'getSymbols' does not exist or is not accessible! (oePayPalOxwArticleDetails)
 
 Stack Trace: #0 /www/htdocs/w012999f/www_beta/tmp/smarty/516f68add1dac66e0ce8134e21ae2e4d^%%5E^5E9^5E9B9D5B%%productmain.tpl.php(520): oxSuperCfg->__call('getSymbols', Array)
#1 /www/htdocs/w012999f/www_beta/tmp/smarty/516f68add1dac66e0ce8134e21ae2e4d^%%5E^5E9^5E9B9D5B%%productmain.tpl.php(520): oePayPalOxwArticleDetails->getSymbols()
#2 /www/htdocs/w012999f/www_beta/core/smarty/Smarty.class.php(1869): include('/www/htdocs/w01...')
#3 /www/htdocs/w012999f/www_beta/tmp/smarty/516f68add1dac66e0ce8134e21ae2e4d^%%A5^A59^A595DDB8%%fullproductinfo.tpl.php(7): Smarty->_smarty_include(Array)
#4 /www/htdocs/w012999f/www_beta/core/smarty/Smarty.class.php(1869): include('/www/htdocs/w01...')
#5 /www/htdocs/w012999f/www_beta/tmp/smarty/516f68add1dac66e0ce8134e21ae2e4d^%%79^790^7907FF72%%details.tpl.php(64): Smarty->_smarty_include(Array)
#6 /www/htdocs/w012999f/www_beta/core/smarty/Smarty.class.php(1263): include('/www/htdocs/w01...')
#7 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(508): Smarty->fetch('widget/product/...', 'ox|0|0|0|0')
#8 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(353): oxShopControl->_render(Object(oePayPalOxwArticleDetails))
#9 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(126): oxShopControl->_process('oxwarticledetai...', NULL, Array, Array)
#10 /www/htdocs/w012999f/www_beta/core/oxwidgetcontrol.php(73): oxShopControl->start('oxwarticledetai...', NULL, Array, Array)
#11 /www/htdocs/w012999f/www_beta/core/smarty/plugins/function.oxid_include_widget.php(55): oxWidgetControl->start('oxwarticledetai...', NULL, Array, Array)
#12 /www/htdocs/w012999f/www_beta/tmp/smarty/516f68add1dac66e0ce8134e21ae2e4d^%%08^08A^08ABD53A%%details.tpl.php(10): smarty_function_oxid_include_widget(Array, Object(Smarty))
#13 /www/htdocs/w012999f/www_beta/core/smarty/Smarty.class.php(1263): include('/www/htdocs/w01...')
#14 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(508): Smarty->fetch('page/details/de...', 'ox|0|0|0|0|1050...')
#15 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(353): oxShopControl->_render(Object(Details))
#16 /www/htdocs/w012999f/www_beta/modules/_d3modcfg/modules/controllers/d3_oxshopcontrol_modcfg_extension.php(146): oxShopControl->_process('details', NULL, NULL, NULL)
#17 /www/htdocs/w012999f/www_beta/core/oxshopcontrol.php(126): d3_oxshopcontrol_modcfg_extension->_process('details', NULL, NULL, NULL)
#18 /www/htdocs/w012999f/www_beta/modules/_d3modcfg/modules/controllers/d3_oxshopcontrol_modcfg_extension.php(61): oxShopControl->start(NULL, NULL, NULL, NULL)
#19 /www/htdocs/w012999f/www_beta/core/oxid.php(40): d3_oxshopcontrol_modcfg_extension->start()
#20 /www/htdocs/w012999f/www_beta/index.php(26): Oxid::run()
#21 /www/htdocs/w012999f/www_beta/oxseo.php(44): require('/www/htdocs/w01...')
#22 {main}

 Faulty component --> 
---------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![tabsl](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/tabsl/32/2468_2.png) [@tabsl](https://forum.oxid-esales.com/u/tabsl)\
**Post date:** [February 10, 2015, 9:12pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/6 "2015-02-10T21:12:59Z")

</div>

> oxarticles

die klasse heißt: oxarticle

> $oView-\>getSymbols()

hier rufst du eine methode des aktuellen view (z. b. details) auf, du willst aber die methode, und diese hängt am artikel objekt.

beispiel: $oDetailsProduct-\>getSymbols() (beispiel auf detailseite)

---

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 11, 2015, 8:06am UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/7 "2015-02-11T08:06:36Z")

</div>

[QUOTE=ProudCommerce;156015]die klasse heißt: oxarticle

hier rufst du eine methode des aktuellen view (z. b. details) auf, du willst aber die methode, und diese hängt am artikel objekt.

beispiel: $oDetailsProduct-\>getSymbols() (beispiel auf detailseite)[/QUOTE]

Super, danke - klappt! Das hilft mir auch, die Logik zu verstehen 🙂

---

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 11, 2015, 2:04pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/8 "2015-02-11T14:04:19Z")

</div>

```php
[{assign var="ShowSymbols" value=$oView->getSymbols()}]

```

Wie kann ich dort am einfachsten eine Variable an das Modul übergeben und im Modul auswerten?

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [February 11, 2015, 2:40pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/9 "2015-02-11T14:40:02Z")

</div>

```auto
[{assign var="ShowSymbols" value=$oView->getSymbols([b]$variable[/b])}]

```

---

<div class="post-metadata">

**Author:** ![hulpert](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/h/46a35a/32.png) [@hulpert](https://forum.oxid-esales.com/u/hulpert)\
**Post date:** [February 11, 2015, 2:48pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/10 "2015-02-11T14:48:23Z")

</div>

[QUOTE=vanilla thunder;156055]

```auto
[{assign var="ShowSymbols" value=$oView->getSymbols([b]$variable[/b])}]

```

[/QUOTE]  
Okay, also wie “normal”, danke!

---

<div class="post-metadata">

**Author:** ![system](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/system/32/4245_2.png) [@system](https://forum.oxid-esales.com/u/system)\
**Post date:** [July 13, 2026, 8:25pm UTC](https://forum.oxid-esales.com/t/generelle-frage-modul-programmierung/72082/11 "2026-07-13T20:25:46Z")

</div>

Closed on July 13, 2026, 8:25pm UTC


