44 $this->
init(
'oxattribute');
54 public function delete( $sOXID = null )
57 $sOXID = $this->
getId();
64 $sOxidQuoted = $oDb->quote($sOXID);
65 $sDelete =
"delete from oxobject2attribute where oxattrid = ".$sOxidQuoted;
66 $rs = $oDb->execute( $sDelete);
69 $sDelete =
"delete from oxcategory2attribute where oxattrid = ".$sOxidQuoted;
70 $rs = $oDb->execute( $sDelete);
86 $aConfLanguages = $myLang->getLanguageIds();
91 foreach ( $aMDVariants as $sVarId => $oValue ) {
92 if ( strpos( $sVarId,
"mdvar_" ) === 0 ) {
93 foreach ( $oValue as $sId ) {
95 $sVarId = substr($sVarId, 6);
96 $oNewAssign =
oxNew(
"oxbase" );
97 $oNewAssign->init(
"oxobject2attribute" );
99 if ($oNewAssign->load($sId)) {
100 $oNewAssign->oxobject2attribute__oxobjectid =
new oxField($sVarId);
101 $oNewAssign->setId($sNewId);
106 $oNewAssign =
oxNew(
"oxi18n" );
107 $oNewAssign->setEnableMultilang(
false );
108 $oNewAssign->init(
"oxobject2attribute" );
109 $oNewAssign->oxobject2attribute__oxobjectid =
new oxField($sVarId);
110 $oNewAssign->oxobject2attribute__oxattrid =
new oxField($sAttrId);
111 foreach ($aConfLanguages as $sKey => $sLang) {
112 $sPrefix = $myLang->getLanguageTag($sKey);
113 $oNewAssign->{
'oxobject2attribute__oxvalue'.$sPrefix} =
new oxField($oValue[$sKey]->name);
127 protected function _getAttrId( $sSelTitle )
129 $oDb = oxDb::getDB();
130 $sAttViewName = getViewName(
'oxattribute');
131 return $oDb->getOne(
"select oxid from $sAttViewName where LOWER(oxtitle) = " . $oDb->quote(
getStr()->strtolower($sSelTitle)));
141 protected function _createAttribute( $aSelTitle )
144 $aConfLanguages = $myLang->getLanguageIds();
145 $oAttr =
oxNew(
'oxI18n');
146 $oAttr->setEnableMultilang(
false );
147 $oAttr->init(
'oxattribute');
148 foreach ($aConfLanguages as $sKey => $sLang) {
149 $sPrefix = $myLang->getLanguageTag($sKey);
150 $oAttr->{
'oxattribute__oxtitle'.$sPrefix} =
new oxField($aSelTitle[$sKey]);
153 return $oAttr->getId();
163 public function getAttributeAssigns( $sArtId )
168 $sSelect =
"select o2a.oxid from oxobject2attribute as o2a ";
169 $sSelect .=
"where o2a.oxobjectid = ".$oDb->quote( $sArtId ).
" order by o2a.oxpos";
172 $rs = $oDb->select( $sSelect );
173 if ($rs !=
false && $rs->recordCount() > 0) {
175 $aIds[] = $rs->fields[0];
192 public function setTitle( $sTitle )
194 $this->_sTitle =
getStr()->htmlspecialchars( $sTitle );
202 public function getTitle()
204 return $this->_sTitle;
214 public function addValue( $sValue )
216 $this->_aValues[] =
getStr()->htmlspecialchars( $sValue );
226 public function setActiveValue( $sValue )
228 $this->_sActiveValue =
getStr()->htmlspecialchars( $sValue );
236 public function getActiveValue()
239 return $this->_sActiveValue;
247 public function getValues()
249 return $this->_aValues;