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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00022         if ( $soxId != "-1" && isset( $soxId)) {
00023             // load object
00024             $oOrder = oxNew( "oxorder" );
00025             $oOrder->load( $soxId);
00026 
00027             $this->_aViewData["edit"] =  $oOrder;
00028         }
00029 
00030         $oCountryList = oxNew( "oxCountryList" );
00031         $oCountryList->loadActiveCountries( oxLang::getInstance()->getObjectTplLanguage() );
00032 
00033         $this->_aViewData["countrylist"] = $oCountryList;
00034 
00035         return "order_address.tpl";
00036     }
00037 
00043     public function save()
00044     {
00045 
00046         $soxId = $this->getEditObjectId();
00047         $aParams    = oxConfig::getParameter( "editval");
00048 
00049             //TODO check if shop id is realy necessary at this place.
00050             $sShopID = oxSession::getVar( "actshop");
00051             $aParams['oxorder__oxshopid'] = $sShopID;
00052 
00053         $oOrder = oxNew( "oxorder" );
00054         if ( $soxId != "-1")
00055             $oOrder->load( $soxId);
00056         else
00057             $aParams['oxorder__oxid'] = null;
00058 
00059         $oOrder->assign( $aParams);
00060         $oOrder->save();
00061 
00062         // set oxid if inserted
00063         $this->setEditObjectId( $oOrder->getId() );
00064     }
00065 }