order_package.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Order_Package extends oxAdminDetails
00009 {
00018     public function myarray_search ($needle, $haystick)
00019     {    // uses key instead of value
00020 
00021         foreach ($haystick as $key => $val) {
00022             if ($needle === $key) {
00023                 return($key);
00024             }
00025         }
00026 
00027         return false;
00028     }
00029 
00037     public function render()
00038     {
00039         $myConfig = $this->getConfig();
00040         parent::render();
00041 
00042         $oDB = oxDb::getDb();
00043         $OldMode = $oDB->setFetchMode( ADODB_FETCH_ASSOC);
00044 
00045         $sSelect  = "select * from oxwrapping";
00046         $rs = $oDB->selectLimit( $sSelect, 5000, 0);
00047 
00048         $aWrappings = array();
00049         if ($rs != false && $rs->recordCount() > 0) {
00050             while ( !$rs->EOF) {
00051                 $key = $rs->fields['OXID'];
00052                 $aWrappings[$key] = new oxStdClass();
00053                 $aWrappings[$key]->fields = $rs->fields;
00054                 $rs->moveNext();
00055             }
00056         }
00057 
00058         $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";
00059         $rs = $oDB->selectLimit( $sSelect, 5000, 0);
00060 
00061         $iCnt = 0;
00062 
00063         $aOrders = array();
00064 
00065         if ($rs != false && $rs->recordCount() > 0) {
00066             while ( !$rs->EOF) {
00067                 $key = $rs->fields['orderid'];
00068 
00069                 if ( !$aOrders[$key] ) {
00070                     $aOrders[$key] = new oxStdClass();
00071                 }
00072                 $aOrders[$key]->fields = $rs->fields;
00073                 if ( !$aOrders[$key]->articles ) {
00074                     $aOrders[$key]->articles = array();
00075                 }
00076                 $aOrders[$key]->articles[$rs->fields['orderartid']] = $rs->fields;
00077 
00078                 $sLangAppend = '';
00079                 if ($rs->fields['OXLANG'])
00080                     $sLangAppend = '_'.$rs->fields['OXLANG'];
00081 
00082                 if ($rs->fields['OXCARDID'] && isset($aWrappings[$rs->fields['OXCARDID']]))
00083                     $aOrders[$key]->sPostCardName = $aWrappings[$rs->fields['OXCARDID']]->fields['OXNAME'.$sLangAppend];
00084                 else
00085                     $aOrders[$key]->oPostCard = "";
00086 
00087                 $aArticle =  & $aOrders[$key]->articles[$rs->fields['orderartid']];
00088                 if ($rs->fields['OXWRAPID'] && isset($aWrappings[$rs->fields['OXWRAPID']]))
00089                     $aArticle['sPostCardName'] = $aWrappings[$rs->fields['OXWRAPID']]->fields['OXNAME'.$sLangAppend];
00090                 else
00091                     $aArticle['sPostCardName'] = '';
00092 
00093                 $rs->moveNext();
00094                 $iCnt++;
00095             }
00096         }
00097 
00098         $oDB->setFetchMode( $OldMode);
00099 
00100         $this->_aViewData['resultset']     = @$aOrders;
00101 
00102         return "order_package.tpl";
00103     }
00104 }

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