order_address.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Order_Address extends oxAdminDetails
00009 {
00017     public function render()
00018     {
00019         parent::render();
00020 
00021         $soxId = oxConfig::getParameter( "oxid");
00022         // check if we right now saved a new entry
00023         $sSavedID = oxConfig::getParameter( "saved_oxid");
00024         if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00025             $soxId = $sSavedID;
00026             oxSession::deleteVar( "saved_oxid");
00027             $this->_aViewData["oxid"] =  $soxId;
00028             // for reloading upper frame
00029             $this->_aViewData["updatelist"] =  "1";
00030         }
00031 
00032         if ( $soxId != "-1" && isset( $soxId)) {
00033             // load object
00034             $oOrder = oxNew( "oxorder" );
00035             $oOrder->load( $soxId);
00036 
00037             $this->_aViewData["edit"] =  $oOrder;
00038         }
00039 
00040         $oCountryList = oxNew( "oxCountryList" );
00041         $oCountryList->loadActiveCountries( oxLang::getInstance()->getObjectTplLanguage() );
00042 
00043         $this->_aViewData["countrylist"] = $oCountryList;
00044 
00045         return "order_address.tpl";
00046     }
00047 
00053     public function save()
00054     {
00055 
00056         $soxId      = oxConfig::getParameter( "oxid");
00057         $aParams    = oxConfig::getParameter( "editval");
00058 
00059             //TODO check if shop id is realy necessary at this place.
00060             $sShopID = oxSession::getVar( "actshop");
00061             $aParams['oxorder__oxshopid'] = $sShopID;
00062 
00063         $oOrder = oxNew( "oxorder" );
00064         if ( $soxId != "-1")
00065             $oOrder->load( $soxId);
00066         else
00067             $aParams['oxorder__oxid'] = null;
00068 
00069         $oOrder->assign( $aParams);
00070         $oOrder->save();
00071 
00072         // set oxid if inserted
00073         if ( $soxId == "-1" )
00074             oxSession::setVar( "saved_oxid", $oOrder->oxorder__oxid->value);
00075     }
00076 }