oxerptype_article.php

Go to the documentation of this file.
00001 <?php
00002 
00003 require_once 'oxerptype.php';
00004 
00008 class oxERPType_Article extends oxERPType
00009 {
00014     protected $_aFieldListVersions = array (
00015         '1' => array(
00016             'OXSHOPID'         => 'OXSHOPID',
00017             'OXSHOPINCL'       => 'OXSHOPINCL',
00018             'OXSHOPEXCL'       => 'OXSHOPEXCL',
00019             'OXPARENTID'       => 'OXPARENTID',
00020             'OXACTIV'          => 'OXACTIV',
00021             'OXACTIVFROM'      => 'OXACTIVFROM',
00022             'OXACTIVTO'        => 'OXACTIVTO',
00023             'OXARTNUM'         => 'OXARTNUM',
00024             'OXEAN'            => 'OXEAN',
00025             'OXDISTEAN'        => 'OXDISTEAN',
00026             'OXTITLE'          => 'OXTITLE',
00027             'OXSHORTDESC'      => 'OXSHORTDESC',
00028             'OXLONGDESC'       => 'OXLONGDESC',
00029             'OXPRICE'          => 'OXPRICE',
00030             'OXBLFIXEDPRICE'   => 'OXBLFIXEDPRICE',
00031             'OXPRICEA'         => 'OXPRICEA',
00032             'OXPRICEB'         => 'OXPRICEB',
00033             'OXPRICEC'         => 'OXPRICEC',
00034             'OXBPRICE'         => 'OXBPRICE',
00035             'OXTPRICE'         => 'OXTPRICE',
00036             'OXUNITNAME'       => 'OXUNITNAME',
00037             'OXUNITQUANTITY'   => 'OXUNITQUANTITY',
00038             'OXEXTURL'         => 'OXEXTURL',
00039             'OXURLDESC'        => 'OXURLDESC',
00040             'OXURLIMG'         => 'OXURLIMG',
00041             'OXVAT'            => 'OXVAT',
00042             'OXTHUMB'          => 'OXTHUMB',
00043             'OXICON'         => 'OXICON',
00044             'OXPIC1'         => 'OXPIC1',
00045             'OXPIC2'         => 'OXPIC2',
00046             'OXPIC3'         => 'OXPIC3',
00047             'OXPIC4'         => 'OXPIC4',
00048             'OXPIC5'         => 'OXPIC5',
00049             'OXPIC6'         => 'OXPIC6',
00050             'OXPIC7'         => 'OXPIC7',
00051             'OXPIC8'         => 'OXPIC8',
00052             'OXPIC9'         => 'OXPIC9',
00053             'OXPIC10'         => 'OXPIC10',
00054             'OXPIC11'         => 'OXPIC11',
00055             'OXPIC12'         => 'OXPIC12',
00056             'OXZOOM1'         => 'OXZOOM1',
00057             'OXZOOM2'         => 'OXZOOM2',
00058             'OXZOOM3'         => 'OXZOOM3',
00059             'OXZOOM4'         => 'OXZOOM4',
00060             'OXWEIGHT'        => 'OXWEIGHT',
00061             'OXSTOCK'         => 'OXSTOCK',
00062             'OXSTOCKFLAG'     => 'OXSTOCKFLAG',
00063             'OXSTOCKTEXT'     => 'OXSTOCKTEXT',
00064             'OXNOSTOCKTEXT'   => 'OXNOSTOCKTEXT',
00065             'OXDELIVERY'     => 'OXDELIVERY',
00066             'OXINSERT'       => 'OXINSERT', //always now()
00067             'OXTIMESTAMP'    => 'OXTIMESTAMP',
00068             'OXLENGTH'       => 'OXLENGTH',
00069             'OXWIDTH'        => 'OXWIDTH',
00070             'OXHEIGHT'       => 'OXHEIGHT',
00071             'OXAKTION'       => 'OXAKTION',
00072             'OXFILE'         => 'OXFILE',
00073             'OXSEARCHKEYS'   => 'OXSEARCHKEYS',
00074             'OXTEMPLATE'     => 'OXTEMPLATE',
00075             'OXQUESTIONEMAIL'=> 'OXQUESTIONEMAIL',
00076             'OXISSEARCH'     => 'OXISSEARCH',
00077             'OXVARNAME'      => 'OXVARNAME',
00078             'OXVARSTOCK'     => 'OXVARSTOCK',
00079             'OXVARCOUNT'     => 'OXVARCOUNT',
00080             'OXVARSELECT'    => 'OXVARSELECT',
00081             'OXVARNAME_1'    => 'OXVARNAME_1',
00082             'OXVARSELECT_1'  => 'OXVARSELECT_1',
00083             'OXVARNAME_2'   =>'OXVARNAME_2',
00084             'OXVARSELECT_2' =>'OXVARSELECT_2',
00085             'OXVARNAME_3'   =>'OXVARNAME_3',
00086             'OXVARSELECT_3' =>'OXVARSELECT_3',
00087             'OXTITLE_1'     =>'OXTITLE_1',
00088             'OXSHORTDESC_1' =>'OXSHORTDESC_1',
00089             'OXLONGDESC_1'  =>'OXLONGDESC_1',
00090             'OXURLDESC_1'   =>'OXURLDESC_1',
00091             'OXSEARCHKEYS_1'=>'OXSEARCHKEYS_1',
00092             'OXTITLE_2'     =>'OXTITLE_2',
00093             'OXSHORTDESC_2' =>'OXSHORTDESC_2',
00094             'OXLONGDESC_2'  =>'OXLONGDESC_2',
00095             'OXURLDESC_2'   =>'OXURLDESC_2',
00096             'OXSEARCHKEYS_2'=>'OXSEARCHKEYS_2',
00097             'OXTITLE_3'     =>'OXTITLE_3',
00098             'OXSHORTDESC_3' =>'OXSHORTDESC_3',
00099             'OXLONGDESC_3'  =>'OXLONGDESC_3',
00100             'OXURLDESC_3'   =>'OXURLDESC_3',
00101             'OXSEARCHKEYS_3'=>'OXSEARCHKEYS_3',
00102             'OXFOLDER'      =>'OXFOLDER',
00103             'OXSUBCLASS'    =>'OXSUBCLASS',
00104             'OXSTOCKTEXT_1' =>'OXSTOCKTEXT_1',
00105             'OXSTOCKTEXT_2' =>'OXSTOCKTEXT_2',
00106             'OXSTOCKTEXT_3' =>'OXSTOCKTEXT_3',
00107             'OXNOSTOCKTEXT_1'=>'OXNOSTOCKTEXT_1',
00108             'OXNOSTOCKTEXT_2'=>'OXNOSTOCKTEXT_2',
00109             'OXNOSTOCKTEXT_3'=>'OXNOSTOCKTEXT_3',
00110             'OXSORT'         => 'OXSORT',
00111             'OXSOLDAMOUNT'   => 'OXSOLDAMOUNT',
00112             'OXNONMATERIAL'  => 'OXNONMATERIAL',
00113             'OXFREESHIPPING' => 'OXFREESHIPPING',
00114             'OXREMINDACTIV'  => 'OXREMINDACTIV',
00115             'OXREMINDAMOUNT' => 'OXREMINDAMOUNT',
00116             'OXAMITEMID'    =>'OXAMITEMID',
00117             'OXAMTASKID'    =>'OXAMTASKID',
00118             'OXVENDORID'    =>'OXVENDORID',
00119             'OXSKIPDISCOUNTS'=> 'OXSKIPDISCOUNTS',
00120             'OXORDERINFO'   =>'OXORDERINFO',
00121             'OXSEOID'       =>'OXSEOID',
00122             'OXSEOID_1'     =>'OXSEOID_1',
00123             'OXSEOID_2'     =>'OXSEOID_2',
00124             'OXSEOID_3'     =>'OXSEOID_3',
00125             'OXPIXIEXPORT'   => 'OXPIXIEXPORT',
00126             'OXPIXIEXPORTED' => 'OXPIXIEXPORTED',
00127             'OXVPE'          => 'OXVPE',
00128             'OXID'           => 'OXID',
00129         ),
00130         '2' => array(
00131             'OXID' => 'OXID',
00132             'OXSHOPID' => 'OXSHOPID',
00133             'OXSHOPINCL' => 'OXSHOPINCL',
00134             'OXSHOPEXCL' => 'OXSHOPEXCL',
00135             'OXPARENTID' => 'OXPARENTID',
00136             'OXACTIVE' => 'OXACTIVE',
00137             'OXACTIVEFROM' => 'OXACTIVEFROM',
00138             'OXACTIVETO' => 'OXACTIVETO',
00139             'OXARTNUM' => 'OXARTNUM',
00140             'OXEAN' => 'OXEAN',
00141             'OXDISTEAN' => 'OXDISTEAN',
00142             'OXTITLE' => 'OXTITLE',
00143             'OXSHORTDESC' => 'OXSHORTDESC',
00144             'OXPRICE' => 'OXPRICE',
00145             'OXBLFIXEDPRICE' => 'OXBLFIXEDPRICE',
00146             'OXPRICEA' => 'OXPRICEA',
00147             'OXPRICEB' => 'OXPRICEB',
00148             'OXPRICEC' => 'OXPRICEC',
00149             'OXBPRICE' => 'OXBPRICE',
00150             'OXTPRICE' => 'OXTPRICE',
00151             'OXUNITNAME' => 'OXUNITNAME',
00152             'OXUNITQUANTITY' => 'OXUNITQUANTITY',
00153             'OXEXTURL' => 'OXEXTURL',
00154             'OXURLDESC' => 'OXURLDESC',
00155             'OXURLIMG' => 'OXURLIMG',
00156             'OXVAT' => 'OXVAT',
00157             'OXTHUMB' => 'OXTHUMB',
00158             'OXICON' => 'OXICON',
00159             'OXPIC1' => 'OXPIC1',
00160             'OXPIC2' => 'OXPIC2',
00161             'OXPIC3' => 'OXPIC3',
00162             'OXPIC4' => 'OXPIC4',
00163             'OXPIC5' => 'OXPIC5',
00164             'OXPIC6' => 'OXPIC6',
00165             'OXPIC7' => 'OXPIC7',
00166             'OXPIC8' => 'OXPIC8',
00167             'OXPIC9' => 'OXPIC9',
00168             'OXPIC10' => 'OXPIC10',
00169             'OXPIC11' => 'OXPIC11',
00170             'OXPIC12' => 'OXPIC12',
00171             'OXZOOM1' => 'OXZOOM1',
00172             'OXZOOM2' => 'OXZOOM2',
00173             'OXZOOM3' => 'OXZOOM3',
00174             'OXZOOM4' => 'OXZOOM4',
00175             'OXWEIGHT' => 'OXWEIGHT',
00176             'OXSTOCK' => 'OXSTOCK',
00177             'OXSTOCKFLAG' => 'OXSTOCKFLAG',
00178             'OXSTOCKTEXT' => 'OXSTOCKTEXT',
00179             'OXNOSTOCKTEXT' => 'OXNOSTOCKTEXT',
00180             'OXDELIVERY' => 'OXDELIVERY',
00181             'OXINSERT' => 'OXINSERT',
00182             'OXTIMESTAMP' => 'OXTIMESTAMP',
00183             'OXLENGTH' => 'OXLENGTH',
00184             'OXWIDTH' => 'OXWIDTH',
00185             'OXHEIGHT' => 'OXHEIGHT',
00186             'OXFILE' => 'OXFILE',
00187             'OXSEARCHKEYS' => 'OXSEARCHKEYS',
00188             'OXTEMPLATE' => 'OXTEMPLATE',
00189             'OXQUESTIONEMAIL' => 'OXQUESTIONEMAIL',
00190             'OXISSEARCH' => 'OXISSEARCH',
00191             'OXVARNAME' => 'OXVARNAME',
00192             'OXVARSTOCK' => 'OXVARSTOCK',
00193             'OXVARCOUNT' => 'OXVARCOUNT',
00194             'OXVARSELECT' => 'OXVARSELECT',
00195             'OXVARMINPRICE' => 'OXVARMINPRICE',
00196             'OXVARNAME_1' => 'OXVARNAME_1',
00197             'OXVARSELECT_1' => 'OXVARSELECT_1',
00198             'OXVARNAME_2' => 'OXVARNAME_2',
00199             'OXVARSELECT_2' => 'OXVARSELECT_2',
00200             'OXVARNAME_3' => 'OXVARNAME_3',
00201             'OXVARSELECT_3' => 'OXVARSELECT_3',
00202             'OXTITLE_1' => 'OXTITLE_1',
00203             'OXSHORTDESC_1' => 'OXSHORTDESC_1',
00204             'OXURLDESC_1' => 'OXURLDESC_1',
00205             'OXSEARCHKEYS_1' => 'OXSEARCHKEYS_1',
00206             'OXTITLE_2' => 'OXTITLE_2',
00207             'OXSHORTDESC_2' => 'OXSHORTDESC_2',
00208             'OXURLDESC_2' => 'OXURLDESC_2',
00209             'OXSEARCHKEYS_2' => 'OXSEARCHKEYS_2',
00210             'OXTITLE_3' => 'OXTITLE_3',
00211             'OXSHORTDESC_3' => 'OXSHORTDESC_3',
00212             'OXURLDESC_3' => 'OXURLDESC_3',
00213             'OXSEARCHKEYS_3' => 'OXSEARCHKEYS_3',
00214             'OXFOLDER' => 'OXFOLDER',
00215             'OXSUBCLASS' => 'OXSUBCLASS',
00216             'OXSTOCKTEXT_1' => 'OXSTOCKTEXT_1',
00217             'OXSTOCKTEXT_2' => 'OXSTOCKTEXT_2',
00218             'OXSTOCKTEXT_3' => 'OXSTOCKTEXT_3',
00219             'OXNOSTOCKTEXT_1' => 'OXNOSTOCKTEXT_1',
00220             'OXNOSTOCKTEXT_2' => 'OXNOSTOCKTEXT_2',
00221             'OXNOSTOCKTEXT_3' => 'OXNOSTOCKTEXT_3',
00222             'OXSORT' => 'OXSORT',
00223             'OXSOLDAMOUNT' => 'OXSOLDAMOUNT',
00224             'OXNONMATERIAL' => 'OXNONMATERIAL',
00225             'OXFREESHIPPING' => 'OXFREESHIPPING',
00226             'OXREMINDACTIV' => 'OXREMINDACTIV',
00227             'OXREMINDAMOUNT' => 'OXREMINDAMOUNT',
00228             'OXAMITEMID' => 'OXAMITEMID',
00229             'OXAMTASKID' => 'OXAMTASKID',
00230             'OXVENDORID' => 'OXVENDORID',
00231             'OXSKIPDISCOUNTS' => 'OXSKIPDISCOUNTS',
00232             'OXORDERINFO' => 'OXORDERINFO',
00233             'OXPIXIEXPORT' => 'OXPIXIEXPORT',
00234             'OXPIXIEXPORTED' => 'OXPIXIEXPORTED',
00235             'OXVPE' => 'OXVPE',
00236             'OXRATING' => 'OXRATING',
00237             'OXRATINGCNT' => 'OXRATINGCNT',
00238             'OXLONGDESC'       => 'OXLONGDESC',
00239             'OXLONGDESC_1'     => 'OXLONGDESC_1',
00240             'OXLONGDESC_2'     => 'OXLONGDESC_2',
00241             'OXLONGDESC_3'     => 'OXLONGDESC_3',
00242         ),
00243     );
00244 
00250     public function __construct()
00251     {
00252 
00253         parent::__construct();
00254 
00255         $this->_sTableName      = 'oxarticles';
00256         $this->_sShopObjectName = 'oxarticle';
00257 
00258     }
00259 
00269     protected function getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
00270     {
00271         switch ($sField) {
00272             // oxlongdesc is valid in all versions
00273             case 'OXLONGDESC':
00274             case 'OXLONGDESC_1':
00275             case 'OXLONGDESC_2':
00276             case 'OXLONGDESC_3':
00277                 // take from oxartextends
00278                 return "(select $sField from oxartextends where ".$this->getTableName($iShopID).".oxid = oxartextends.oxid limit 1) as $sField";
00279         }
00280 
00281         if ('1' == oxERPBase::getUsedDbFieldsVersion()) {
00282             switch ($sField) {
00283                 case 'OXAKTION':
00284                 case 'OXSEOID':
00285                 case 'OXSEOID_1':
00286                 case 'OXSEOID_2':
00287                 case 'OXSEOID_3':
00288                     return "'' as $sField";
00289                 case 'OXACTIV':
00290                     return "OXACTIVE as OXACTIV";
00291                 case 'OXACTIVFROM':
00292                     return "OXACTIVEFROM as OXACTIVFROM";
00293                 case 'OXACTIVTO':
00294                     return "OXACTIVETO as OXACTIVTO";
00295             }
00296         }
00297 
00298         return parent::getSqlFieldName($sField, $iLanguage, $iShopID);
00299     }
00300 
00310     protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00311     {
00312         $oCompat = oxNew('OXERPCompatability');
00313         if ( !$oCompat->isArticleNullLongDescComatable() ) {
00314 
00315             $aLongDescriptionFields = array('OXLONGDESC_1','OXLONGDESC_2','OXLONGDESC_3');
00316 
00317             foreach ( $aLongDescriptionFields as $iKey => $sField ) {
00318                 if ( in_array($sField,$this->_aFieldList ) ) {
00319                     unset($aLongDescriptionFields[$iKey]);
00320                 }
00321             }
00322 
00323             if ( count($aLongDescriptionFields ) ) {
00324                 $oArtExt = oxNew('oxbase');
00325                 $oArtExt->init('oxartextends');
00326 
00327                 if ( $oArtExt->load($aData['OXID']) ) {
00328                     foreach ($aLongDescriptionFields as $sField) {
00329                         $sFieldName = $oArtExt->getCoreTableName()."__".strtolower( $sField );
00330                         $sLongDesc  = null;
00331 
00332                         if ($oArtExt->$sFieldName instanceof oxField) {
00333                             $sLongDesc = $oArtExt->$sFieldName->getRawValue();
00334                         } elseif (is_object($oArtExt->$sFieldName)) {
00335                             $sLongDesc = $oArtExt->$sFieldName->value;
00336                         }
00337 
00338                         if ( isset($sLongDesc) ) {
00339                             $aData[$sField] = $sLongDesc;
00340                         }
00341                     }
00342                 }
00343             }
00344         }
00345 
00346         return parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00347     }
00348 }

Generated on Wed Apr 22 12:26:30 2009 for OXID eShop CE by  doxygen 1.5.5