Hallo
benötige ein wenig Starthilfe um durchzublicken.
Habe erfolgreich ein Modul registriert nach dem Vorbild von Vanilla
https://forum.oxid-esales.com/showth...ge=3#post81559
1. Modul ist aktiv
2. Tab erscheint im Admin
Wenn ich auf den Tab klicke, dann kommt die Shop Startseite.
Mein Ziel ist es Daten aus meiner neuen Tabelle oxartextends2 auszulesen mit den Artikelzusatzinformationen.
Hier die article_customtab.php im Verzeichnis: /application/controllers/admin/
<?php
class Article_Customtab extends oxAdminDetails
{
/* settings */
protected $sMyAdminCl = "article_customtab"; // name of you'r admin class
protected $sMyField = "oxlongdexc"; // fieldname in oxartextends
protected $sMyDbField = Null;
public function render()
{
$myConfig = $this->getConfig();
parent::render();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$this->_aViewData['edit'] = $oArticle = oxNew( 'oxarticle' );
$soxId = $this->getEditObjectId();
$svoxId = oxConfig::getParameter( "voxid" );
$soxparentId = oxConfig::getParameter( "oxparentid" );
if ( $soxId && $soxId != "-1") {
// load object
$oArticle->loadInLang( $this->_iEditLang, $soxId );
$iDataType = oxField::T_TEXT;
$sValue = $oArticle->getOxArtExtended($this->sMyField);
$oArticle->{$this->sMyDbField} = new oxField($sValue, $iDataType);
// load object in other languages
$oOtherLang = $oArticle->getAvailableInLangs();
if (!isset($oOtherLang[$this->_iEditLang])) {
// echo "language entry doesn't exist! using: ".key($oOtherLang);
$oArticle->loadInLang( key($oOtherLang), $soxId );
}
$aLang = array_diff (oxLang::getInstance()->getLanguageNames(), $oOtherLang);
if ( count( $aLang))
$this->_aViewData["posslang"] = $aLang;
foreach ( $oOtherLang as $id => $language) {
$oLang= new oxStdClass();
$oLang->sLangDesc = $language;
$oLang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
}
$this->_aViewData["admincl"] = $this->sMyAdminCl;
$this->_aViewData["field"] = $this->sMyDbField;
$this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 445, $oArticle, $this->sMyDbField, "details.tpl.css");
$this->_aViewData["blUseTimeCheck"] = $myConfig->getConfigParam( 'blUseTimeCheck' );
return "article_customtab.tpl";
}
public function save()
{
$myConfig = $this->getConfig();
$soxId = $this->getEditObjectId();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$sValues = oxConfig::getParameter( "editval" );
$sParams = $sValues[$this->sMyDbField];
if (isset($sParams)) {
$oDB = oxDb::getDb();
$sFieldLang = ( $this->_iEditLang > "0" ) ? $this->sMyField.'_'.$this->_iEditLang : $this->sMyField;
$sParams = $oDB->quote($sParams);
$SQL = "UPDATE oxartextends2
SET ".$sFieldLang." = ".$sParams."
WHERE OXID = '".$soxId."'";
$oDB->execute($SQL);
}
}
public function delete()
{
$myConfig = $this->getConfig();
$soxId = $this->getEditObjectId();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$oDB = oxDb::getDb();
$sFieldLang = ( $this->_iEditLang > "0" ) ? $sthis->MyField.'_'.$this->_iEditLang : $this->sMyField;
$SQL = "UPDATE oxartextends2
SET ".$sFieldLang." = ''
WHERE OXID = '".$soxId."'";
$oDB->execute($SQL);
}
}
/application/views/admin/tpl/
benötige ein wenig Starthilfe um durchzublicken.
Habe erfolgreich ein Modul registriert nach dem Vorbild von Vanilla
https://forum.oxid-esales.com/showth...ge=3#post81559
1. Modul ist aktiv
2. Tab erscheint im Admin
Wenn ich auf den Tab klicke, dann kommt die Shop Startseite.
Mein Ziel ist es Daten aus meiner neuen Tabelle oxartextends2 auszulesen mit den Artikelzusatzinformationen.
Hier die article_customtab.php im Verzeichnis: /application/controllers/admin/
<?php
class Article_Customtab extends oxAdminDetails
{
/* settings */
protected $sMyAdminCl = "article_customtab"; // name of you'r admin class
protected $sMyField = "oxlongdexc"; // fieldname in oxartextends
protected $sMyDbField = Null;
public function render()
{
$myConfig = $this->getConfig();
parent::render();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$this->_aViewData['edit'] = $oArticle = oxNew( 'oxarticle' );
$soxId = $this->getEditObjectId();
$svoxId = oxConfig::getParameter( "voxid" );
$soxparentId = oxConfig::getParameter( "oxparentid" );
if ( $soxId && $soxId != "-1") {
// load object
$oArticle->loadInLang( $this->_iEditLang, $soxId );
$iDataType = oxField::T_TEXT;
$sValue = $oArticle->getOxArtExtended($this->sMyField);
$oArticle->{$this->sMyDbField} = new oxField($sValue, $iDataType);
// load object in other languages
$oOtherLang = $oArticle->getAvailableInLangs();
if (!isset($oOtherLang[$this->_iEditLang])) {
// echo "language entry doesn't exist! using: ".key($oOtherLang);
$oArticle->loadInLang( key($oOtherLang), $soxId );
}
$aLang = array_diff (oxLang::getInstance()->getLanguageNames(), $oOtherLang);
if ( count( $aLang))
$this->_aViewData["posslang"] = $aLang;
foreach ( $oOtherLang as $id => $language) {
$oLang= new oxStdClass();
$oLang->sLangDesc = $language;
$oLang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
}
$this->_aViewData["admincl"] = $this->sMyAdminCl;
$this->_aViewData["field"] = $this->sMyDbField;
$this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 445, $oArticle, $this->sMyDbField, "details.tpl.css");
$this->_aViewData["blUseTimeCheck"] = $myConfig->getConfigParam( 'blUseTimeCheck' );
return "article_customtab.tpl";
}
public function save()
{
$myConfig = $this->getConfig();
$soxId = $this->getEditObjectId();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$sValues = oxConfig::getParameter( "editval" );
$sParams = $sValues[$this->sMyDbField];
if (isset($sParams)) {
$oDB = oxDb::getDb();
$sFieldLang = ( $this->_iEditLang > "0" ) ? $this->sMyField.'_'.$this->_iEditLang : $this->sMyField;
$sParams = $oDB->quote($sParams);
$SQL = "UPDATE oxartextends2
SET ".$sFieldLang." = ".$sParams."
WHERE OXID = '".$soxId."'";
$oDB->execute($SQL);
}
}
public function delete()
{
$myConfig = $this->getConfig();
$soxId = $this->getEditObjectId();
$this->sMyDbField = "oxartextends2__".$this->sMyField;
$oDB = oxDb::getDb();
$sFieldLang = ( $this->_iEditLang > "0" ) ? $sthis->MyField.'_'.$this->_iEditLang : $this->sMyField;
$SQL = "UPDATE oxartextends2
SET ".$sFieldLang." = ''
WHERE OXID = '".$soxId."'";
$oDB->execute($SQL);
}
}
/application/views/admin/tpl/