00001 <?php
00002
00009 class Order_Package extends oxAdminDetails
00010 {
00019 public function myarray_search ($needle, $haystick)
00020 {
00021
00022 foreach ($haystick as $key => $val) {
00023 if ($needle === $key) {
00024 return($key);
00025 }
00026 }
00027
00028 return false;
00029 }
00030
00038 public function render()
00039 {
00040 $myConfig = $this->getConfig();
00041 parent::render();
00042
00043 $oDB = oxDb::getDb();
00044 $OldMode = $oDB->setFetchMode( ADODB_FETCH_ASSOC);
00045
00046 $sSelect = "select * from oxwrapping";
00047 $rs = $oDB->selectLimit( $sSelect, 5000, 0);
00048
00049 $aWrappings = array();
00050 if ($rs != false && $rs->recordCount() > 0) {
00051 while ( !$rs->EOF) {
00052 $key = $rs->fields['OXID'];
00053 $aWrappings[$key] = new oxStdClass();
00054 $aWrappings[$key]->fields = $rs->fields;
00055 $rs->moveNext();
00056 }
00057 }
00058
00059 $sSelect = "select oxorder.*, oxorderarticles.*, oxorder.oxid as orderid, oxorderarticles.oxid as orderartid from oxorder left join oxorderarticles on oxorder.oxid = oxorderarticles.oxorderid where oxorder.oxsenddate = '0000-00-00 00:00:00' and oxorder.oxshopid = '".$myConfig->getShopId()."' and oxorderarticles.oxstorno != '1' order by oxorder.oxorderdate asc";
00060 $rs = $oDB->selectLimit( $sSelect, 5000, 0);
00061
00062 $iCnt = 0;
00063
00064 $aOrders = array();
00065
00066 if ($rs != false && $rs->recordCount() > 0) {
00067 while ( !$rs->EOF) {
00068 $key = $rs->fields['orderid'];
00069
00070 $aOrders[$key] = new oxStdClass();
00071 $aOrders[$key]->fields = $rs->fields;
00072 $aOrders[$key]->articles[$rs->fields['orderartid']] = $rs->fields;
00073
00074 $sLangAppend = '';
00075 if ($rs->fields['OXLANG'])
00076 $sLangAppend = '_'.$rs->fields['OXLANG'];
00077
00078 if ($rs->fields['OXCARDID'] && isset($aWrappings[$rs->fields['OXCARDID']]))
00079 $aOrders[$key]->sPostCardName = $aWrappings[$rs->fields['OXCARDID']]->fields['OXNAME'.$sLangAppend];
00080 else
00081 $aOrders[$key]->oPostCard = "";
00082
00083 $aArticle = & $aOrders[$key]->articles[$rs->fields['orderartid']];
00084 if ($rs->fields['OXWRAPID'] && isset($aWrappings[$rs->fields['OXWRAPID']]))
00085 $aArticle['sPostCardName'] = $aWrappings[$rs->fields['OXWRAPID']]->fields['OXNAME'.$sLangAppend];
00086 else
00087 $aArticle['sPostCardName'] = '';
00088
00089 $rs->moveNext();
00090 $iCnt++;
00091 }
00092 }
00093
00094 $oDB->setFetchMode( $OldMode);
00095
00096 $this->_aViewData['resultset'] = @$aOrders;
00097
00098 return "order_package.tpl";
00099 }
00100 }