45 $this->
init(
'oxattribute');
55 public function delete($sOXID = null)
58 $sOXID = $this->
getId();
67 $sOxidQuoted = $oDb->quote($sOXID);
68 $sDelete =
"delete from oxobject2attribute where oxattrid = " . $sOxidQuoted;
69 $rs = $oDb->execute($sDelete);
72 $sDelete =
"delete from oxcategory2attribute where oxattrid = " . $sOxidQuoted;
73 $rs = $oDb->execute($sDelete);
87 $aConfLanguages = $myLang->getLanguageIds();
92 foreach ($aMDVariants as $sVarId => $oValue) {
93 if (strpos($sVarId,
"mdvar_") === 0) {
94 foreach ($oValue as $sId) {
96 $sVarId = substr($sVarId, 6);
97 $oNewAssign =
oxNew(
"oxbase");
98 $oNewAssign->init(
"oxobject2attribute");
100 if ($oNewAssign->load($sId)) {
101 $oNewAssign->oxobject2attribute__oxobjectid =
new oxField($sVarId);
102 $oNewAssign->setId($sNewId);
107 $oNewAssign =
oxNew(
"oxi18n");
108 $oNewAssign->setEnableMultilang(
false);
109 $oNewAssign->init(
"oxobject2attribute");
110 $oNewAssign->oxobject2attribute__oxobjectid =
new oxField($sVarId);
111 $oNewAssign->oxobject2attribute__oxattrid =
new oxField($sAttrId);
112 foreach ($aConfLanguages as $sKey => $sLang) {
113 $sPrefix = $myLang->getLanguageTag($sKey);
114 $oNewAssign->{
'oxobject2attribute__oxvalue' . $sPrefix} =
new oxField($oValue[$sKey]->name);
128 protected function _getAttrId($sSelTitle)
130 $oDb = oxDb::getDB();
131 $sAttViewName = getViewName(
'oxattribute');
133 return $oDb->getOne(
"select oxid from $sAttViewName where LOWER(oxtitle) = " . $oDb->quote(
getStr()->strtolower($sSelTitle)));
143 protected function _createAttribute($aSelTitle)
146 $aConfLanguages = $myLang->getLanguageIds();
147 $oAttr =
oxNew(
'oxI18n');
148 $oAttr->setEnableMultilang(
false);
149 $oAttr->init(
'oxattribute');
150 foreach ($aConfLanguages as $sKey => $sLang) {
151 $sPrefix = $myLang->getLanguageTag($sKey);
152 $oAttr->{
'oxattribute__oxtitle' . $sPrefix} =
new oxField($aSelTitle[$sKey]);
156 return $oAttr->getId();
166 public function getAttributeAssigns($sArtId)
171 $sSelect =
"select o2a.oxid from oxobject2attribute as o2a ";
172 $sSelect .=
"where o2a.oxobjectid = " . $oDb->quote($sArtId) .
" order by o2a.oxpos";
175 $rs = $oDb->select($sSelect);
176 if ($rs !=
false && $rs->recordCount() > 0) {
178 $aIds[] = $rs->fields[0];
193 public function setTitle($sTitle)
195 $this->_sTitle =
getStr()->htmlspecialchars($sTitle);
203 public function getTitle()
205 return $this->_sTitle;
213 public function addValue($sValue)
215 $this->_aValues[] =
getStr()->htmlspecialchars($sValue);
223 public function setActiveValue($sValue)
225 $this->_sActiveValue =
getStr()->htmlspecialchars($sValue);
233 public function getActiveValue()
236 return $this->_sActiveValue;
244 public function getValues()
246 return $this->_aValues;