25 $oCategory =
oxNew(
"oxcategory");
29 $this->_aViewData[
"edit"] = $oCategory;
30 $this->_aViewData[
"oxid"] = $soxId;
32 if ($soxId !=
"-1" && isset($soxId)) {
38 $oCategory->loadInLang($this->_iEditLang, $soxId);
41 $oOtherLang = $oCategory->getAvailableInLangs();
42 if (!isset($oOtherLang[$this->_iEditLang])) {
44 $oCategory->loadInLang(key($oOtherLang), $soxId);
50 $this->_aViewData[
"posslang"] =
$aLang;
53 foreach ($oOtherLang as $id => $language) {
54 $oLang =
new stdClass();
55 $oLang->sLangDesc = $language;
57 $this->_aViewData[
"otherlang"][$id] = clone $oLang;
60 if ($oCategory->oxcategories__oxparentid->value ==
'oxrootid') {
61 $oCategory->oxcategories__oxparentid->setValue(
'');
64 $this->
_getCategoryTree(
"cattree", $oCategory->oxcategories__oxparentid->value, $oCategory->oxcategories__oxid->value,
true, $oCategory->oxcategories__oxshopid->value);
66 $this->_aViewData[
"defsort"] = $oCategory->oxcategories__oxdefsort->value;
71 $this->_aViewData[
"sortableFields"] = $this->getSortableFields();
75 $oCategoryMainAjax =
oxNew(
'category_main_ajax');
76 $this->_aViewData[
'oxajax'] = $oCategoryMainAjax->getColumns();
78 return "popups/category_main.tpl";
81 return "category_main.tpl";
89 public function getSortableFields()
91 $aSkipFields = array(
"OXID",
"OXSHOPID",
"OXMAPID",
"OXPARENTID",
"OXACTIVE",
"OXACTIVEFROM"
92 ,
"OXACTIVETO",
"OXSHORTDESC"
93 ,
"OXUNITNAME",
"OXUNITQUANTITY",
"OXEXTURL",
"OXURLDESC",
"OXURLIMG",
"OXVAT"
94 ,
"OXTHUMB",
"OXPIC1",
"OXPIC2",
"OXPIC3",
"OXPIC4",
"OXPIC5"
95 ,
"OXPIC6",
"OXPIC7",
"OXPIC8",
"OXPIC9",
"OXPIC10",
"OXPIC11",
"OXPIC12",
"OXSTOCKFLAG"
96 ,
"OXSTOCKTEXT",
"OXNOSTOCKTEXT",
"OXDELIVERY",
"OXFILE",
"OXSEARCHKEYS",
"OXTEMPLATE"
97 ,
"OXQUESTIONEMAIL",
"OXISSEARCH",
"OXISCONFIGURABLE",
"OXBUNDLEID",
"OXFOLDER",
"OXSUBCLASS"
98 ,
"OXREMINDACTIVE",
"OXREMINDAMOUNT",
"OXVENDORID",
"OXMANUFACTURERID",
"OXSKIPDISCOUNTS"
99 ,
"OXBLFIXEDPRICE",
"OXICON",
"OXVARSELECT",
"OXAMITEMID",
"OXAMTASKID",
"OXPIXIEXPORT",
"OXPIXIEXPORTED",
"OXSORT"
100 ,
"OXUPDATEPRICE",
"OXUPDATEPRICEA",
"OXUPDATEPRICEB",
"OXUPDATEPRICEC",
"OXUPDATEPRICETIME",
"OXISDOWNLOADABLE"
101 ,
"OXVARMAXPRICE",
"OXSHOWCUSTOMAGREEMENT"
104 $oDbHandler =
oxNew(
"oxDbMetaDataHandler");
105 $aFields = array_merge($oDbHandler->getMultilangFields(
'oxarticles'), array_keys($oDbHandler->getSinglelangFields(
'oxarticles', 0)));
106 $aFields = array_diff($aFields, $aSkipFields);
107 $aFields = array_unique($aFields);
117 public function save()
126 $myConfig->getRequestParameter(
"editval")
130 $oCategory =
oxNew(
"oxcategory");
132 if ($soxId !=
"-1") {
134 $oCategory->load($soxId);
135 $oCategory->loadInLang($this->_iEditLang, $soxId);
141 $myUtilsPic->overwritePic($oCategory,
'oxcategories',
'oxthumb',
'TC',
'0', $aParams,
$myConfig->getPictureDir(
false));
142 $myUtilsPic->overwritePic($oCategory,
'oxcategories',
'oxicon',
'CICO',
'icon', $aParams,
$myConfig->getPictureDir(
false));
143 $myUtilsPic->overwritePic($oCategory,
'oxcategories',
'oxpromoicon',
'PICO',
'icon', $aParams,
$myConfig->getPictureDir(
false));
147 $oCategory->setLanguage(0);
150 $oCategory->assign($aParams);
151 $oCategory->setLanguage($this->_iEditLang);
156 $oCategory = $oUtilsFile->processFiles($oCategory);
172 return str_replace(
'&lang=',
'&lang=', $sValue);
188 public function deletePicture()
195 $oEx->setMessage(
'CATEGORY_PICTURES_UPLOADISDISABLED');
200 $oUtilsView->addErrorToDisplay($oEx,
false);
207 if (empty($sField)) {
212 $oItem =
oxNew(
'oxCategory');
213 $oItem->load($sOxId);
214 $this->_deleteCatPicture($oItem, $sField);
225 protected function _deleteCatPicture(
oxCategory $oItem, $sField)
228 $sItemKey =
'oxcategories__' . $sField;
248 if ($sImgType !==
false) {
255 $myUtilsPic->safePictureDelete($oItem->$sItemKey->value, $sDir . $oUtilsFile->getImageDirByType($sImgType),
'oxcategories', $sField);
257 $oItem->$sItemKey =
new oxField();
272 if (!isset($aReqParams[
'oxcategories__oxactive'])) {
273 $aReqParams[
'oxcategories__oxactive'] = 0;
275 if (!isset($aReqParams[
'oxcategories__oxhidden'])) {
276 $aReqParams[
'oxcategories__oxhidden'] = 0;
278 if (!isset($aReqParams[
'oxcategories__oxdefsortmode'])) {
279 $aReqParams[
'oxcategories__oxdefsortmode'] = 0;
283 if ($aReqParams[
'oxcategories__oxvat'] ===
'') {
284 $aReqParams[
'oxcategories__oxvat'] = null;
294 $aReqParams[
'oxcategories__oxid'] = null;
297 if (isset($aReqParams[
"oxcategories__oxlongdesc"])) {
298 $aReqParams[
"oxcategories__oxlongdesc"] = $this->
_processLongDesc($aReqParams[
"oxcategories__oxlongdesc"]);
301 if (empty($aReqParams[
'oxcategories__oxpricefrom'])) {
302 $aReqParams[
'oxcategories__oxpricefrom'] = 0;
304 if (empty($aReqParams[
'oxcategories__oxpriceto'])) {
305 $aReqParams[
'oxcategories__oxpriceto'] = 0;