00001 <?php 00002 00003 require_once 'oxerptype.php'; 00004 00008 class oxERPType_Category extends oxERPType 00009 { 00014 protected $_aFieldListVersions = array( 00015 '1' => array( 00016 'OXID' => 'OXID', 00017 'OXPARENTID' => 'OXPARENTID', 00018 'OXORDER' => 'OXORDER', 00019 'OXACTIV' => 'OXACTIV', 00020 'OXHIDDEN' => 'OXHIDDEN', 00021 'OXSHOPID' => 'OXSHOPID', 00022 'OXSHOPINCL' => 'OXSHOPINCL', 00023 'OXSHOPEXCL' => 'OXSHOPEXCL', 00024 'OXTITLE' => 'OXTITLE', 00025 'OXDESC' => 'OXDESC', 00026 'OXLONGDESC' => 'OXLONGDESC', 00027 'OXTHUMB' => 'OXTHUMB', 00028 'OXEXTLINK' => 'OXEXTLINK', 00029 'OXTEMPLATE' => 'OXTEMPLATE', 00030 'OXDEFSORT' => 'OXDEFSORT', 00031 'OXDEFSORTMODE' => 'OXDEFSORTMODE', 00032 'OXICON' => 'OXICON', 00033 'OXSKIPDISCOUNTS'=> 'OXSKIPDISCOUNTS', 00034 'OXACTIV_1' => 'OXACTIV_1', 00035 'OXTITLE_1' => 'OXTITLE_1', 00036 'OXDESC_1' => 'OXDESC_1', 00037 'OXLONGDESC_1' => 'OXLONGDESC_1', 00038 'OXACTIV_2' => 'OXACTIV_2', 00039 'OXTITLE_2' => 'OXTITLE_2', 00040 'OXDESC_2' => 'OXDESC_2', 00041 'OXLONGDESC_2' => 'OXLONGDESC_2', 00042 'OXACTIV_3' => 'OXACTIV_3', 00043 'OXTITLE_3' => 'OXTITLE_3', 00044 'OXDESC_3' => 'OXDESC_3', 00045 'OXLONGDESC_3' => 'OXLONGDESC_3', 00046 'OXPRICEFROM' => 'OXPRICEFROM', 00047 'OXPRICETO' => 'OXPRICETO', 00048 'OXTYPE' => 'OXTYPE', 00049 'OXSEOID' => 'OXSEOID', 00050 'OXSEOID_1' => 'OXSEOID_1', 00051 'OXSEOID_2' => 'OXSEOID_2', 00052 'OXSEOID_3' => 'OXSEOID_3' 00053 ), 00054 '2' => array( 00055 'OXID' => 'OXID', 00056 'OXPARENTID' => 'OXPARENTID', 00057 'OXLEFT' => 'OXLEFT', 00058 'OXRIGHT' => 'OXRIGHT', 00059 'OXROOTID' => 'OXROOTID', 00060 'OXSORT' => 'OXSORT', 00061 'OXACTIVE' => 'OXACTIVE', 00062 'OXHIDDEN' => 'OXHIDDEN', 00063 'OXSHOPID' => 'OXSHOPID', 00064 'OXSHOPINCL' => 'OXSHOPINCL', 00065 'OXSHOPEXCL' => 'OXSHOPEXCL', 00066 'OXTITLE' => 'OXTITLE', 00067 'OXDESC' => 'OXDESC', 00068 'OXLONGDESC' => 'OXLONGDESC', 00069 'OXTHUMB' => 'OXTHUMB', 00070 'OXEXTLINK' => 'OXEXTLINK', 00071 'OXTEMPLATE' => 'OXTEMPLATE', 00072 'OXDEFSORT' => 'OXDEFSORT', 00073 'OXDEFSORTMODE' => 'OXDEFSORTMODE', 00074 'OXPRICEFROM' => 'OXPRICEFROM', 00075 'OXPRICETO' => 'OXPRICETO', 00076 'OXACTIVE_1' => 'OXACTIVE_1', 00077 'OXTITLE_1' => 'OXTITLE_1', 00078 'OXDESC_1' => 'OXDESC_1', 00079 'OXLONGDESC_1' => 'OXLONGDESC_1', 00080 'OXACTIVE_2' => 'OXACTIVE_2', 00081 'OXTITLE_2' => 'OXTITLE_2', 00082 'OXDESC_2' => 'OXDESC_2', 00083 'OXLONGDESC_2' => 'OXLONGDESC_2', 00084 'OXACTIVE_3' => 'OXACTIVE_3', 00085 'OXTITLE_3' => 'OXTITLE_3', 00086 'OXDESC_3' => 'OXDESC_3', 00087 'OXLONGDESC_3' => 'OXLONGDESC_3', 00088 'OXICON' => 'OXICON', 00089 'OXVAT' => 'OXVAT', 00090 'OXSKIPDISCOUNTS' => 'OXSKIPDISCOUNTS', 00091 'OXSHOWSUFFIX' => 'OXSHOWSUFFIX', 00092 ), 00093 ); 00094 00100 public function __construct() 00101 { 00102 parent::__construct(); 00103 00104 $this->_sTableName = 'oxcategories'; 00105 $this->_sShopObjectName = 'oxcategory'; 00106 } 00107 00117 protected function getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1) 00118 { 00119 if ('1' == oxERPBase::getUsedDbFieldsVersion()) { 00120 switch ($sField) { 00121 case 'OXTYPE': 00122 return "'0' as $sField"; 00123 case 'OXSEOID': 00124 case 'OXSEOID_1': 00125 case 'OXSEOID_2': 00126 case 'OXSEOID_3': 00127 return "'' as $sField"; 00128 case 'OXACTIV': 00129 return "OXACTIVE as OXACTIV"; 00130 case 'OXACTIV_1': 00131 return "OXACTIVE_1 as OXACTIV_1"; 00132 case 'OXACTIV_2': 00133 return "OXACTIVE_2 as OXACTIV_2"; 00134 case 'OXACTIV_3': 00135 return "OXACTIVE_3 as OXACTIV_3"; 00136 case 'OXORDER': 00137 return "OXSORT as $sField"; 00138 } 00139 } 00140 return parent::getSqlFieldName($sField, $iLanguage, $iShopID); 00141 } 00142 00152 protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId) 00153 { 00154 $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId); 00155 if ('1' == oxERPBase::getUsedDbFieldsVersion()) { 00156 if (!$aData['OXPARENTID']) { 00157 $aData['OXPARENTID'] = 'oxrootid'; 00158 } 00159 $aData['OXSORT'] = $aData['OXORDER']; 00160 } 00161 return $aData; 00162 } 00163 00164 }