shop_main.php

Go to the documentation of this file.
00001 <?php
00002 
00003 
00009 class Shop_Main extends oxAdminDetails
00010 {
00018     public function render()
00019     {
00020         $myConfig = $this->getConfig();
00021 
00022         parent::render();
00023 
00024         $soxId = oxConfig::getParameter( "oxid");
00025 
00026 
00027         if ( $soxId != "-1" && isset( $soxId)) {
00028             // load object
00029             $oShop = oxNew( "oxshop" );
00030             $isubjlang = oxConfig::getParameter("subjlang");
00031             if ( !isset($isubjlang))
00032                 $isubjlang = $this->_iEditLang;
00033 
00034             if ($isubjlang && $isubjlang > 0) {
00035                 $this->_aViewData["subjlang"] =  $isubjlang;
00036             }
00037 
00038             $oShop->loadInLang( $isubjlang, $soxId );
00039 
00040             $this->_aViewData["edit"] =  $oShop;
00041             //oxSession::setVar( "actshop", $soxId);//echo "<h2>$soxId</h2>";
00042             oxSession::setVar( "shp", $soxId);
00043         }
00044 
00045 
00046         $this->_aViewData['IsOXDemoShop'] = $myConfig->isDemoShop();
00047         if ( !isset( $this->_aViewData['updatenav'] ) ) {
00048             $this->_aViewData['updatenav']    = oxConfig::getParameter( 'updatenav' );
00049         }
00050 
00051         return "shop_main.tpl";
00052     }
00053 
00059     public function save()
00060     {
00061         $myConfig  = $this->getConfig();
00062 
00063 
00064         $soxId      = oxConfig::getParameter( "oxid");
00065         $aParams    = oxConfig::getParameter( "editval");
00066 
00067 
00068         //  #918 S
00069         // checkbox handling
00070         if ( isset( $aParams['oxshops__oxactive']) && $aParams['oxshops__oxactive'] == true)
00071             $aParams['oxshops__oxactive'] = 1;
00072         else
00073             $aParams['oxshops__oxactive'] = 0;
00074 
00075         if ( isset( $aParams['oxshops__oxproductive']) && $aParams['oxshops__oxproductive'] == true)
00076             $aParams['oxshops__oxproductive'] = 1;
00077         else
00078             $aParams['oxshops__oxproductive'] = 0;
00079 
00080         $oShop = oxNew( "oxshop" );
00081 
00082 
00083         $isubjlang = oxConfig::getParameter("subjlang");
00084         if ( $isubjlang && $isubjlang > 0 ) {
00085             $iLang = $isubjlang;
00086         } else {
00087             $iLang = 0;
00088         }
00089 
00090         if ( $soxId != "-1") {
00091             $oShop->loadInLang( $iLang, $soxId );
00092         } else {
00093                 $aParams['oxshops__oxid'] = null;
00094         }
00095 
00096         if ($aParams['oxshops__oxsmtp']) {
00097             $aParams['oxshops__oxsmtp'] = trim($aParams['oxshops__oxsmtp']);
00098         }
00099 
00100         $oShop->setLanguage(0);
00101         //$aParams = $oShop->ConvertNameArray2Idx( $aParams);
00102         $oShop->assign( $aParams);
00103         $oShop->setLanguage($iLang);
00104 
00105         $sNewSMPTPass = oxConfig::getParameter( "oxsmtppwd");
00106 
00107         if ($sNewSMPTPass) {
00108             $oShop->oxshops__oxsmtppwd->setValue($sNewSMPTPass);
00109         }
00110         //unsetting password
00111         if ($sNewSMPTPass == '-') {
00112             $oShop->oxshops__oxsmtppwd->setValue("");
00113         }
00114 
00115 
00116         $oShop->save();
00117 
00118 
00119         $this->_aViewData["updatelist"] =  "1";
00120 
00121         oxSession::setVar( "actshop", $soxId);
00122     }
00123 
00124 
00130     protected function _getShopIds()
00131     {
00132         //loading shop ids
00133         $sQ = "select oxid, oxname from oxshops";
00134         $aShopIds = array();
00135         $rs = oxDb::getDb()->execute($sQ);
00136         if ($rs != false && $rs->recordCount() > 0) {
00137             while (!$rs->EOF) {
00138                 $oShop = new stdClass();
00139                 $oShop->oxid = $rs->fields[0];
00140                 $oShop->oxname = $rs->fields[1];
00141                 $aShopIds[$rs->fields[0]] = $oShop;
00142                 $rs->moveNext();
00143             }
00144         }
00145 
00146         return $aShopIds;
00147     }
00148 
00149 }

Generated on Mon Oct 26 20:07:16 2009 for OXID eShop CE by  doxygen 1.5.5