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 
00048         return "shop_main.tpl";
00049     }
00050 
00056     public function save()
00057     {
00058         $myConfig  = $this->getConfig();
00059 
00060 
00061         $soxId      = oxConfig::getParameter( "oxid");
00062         $aParams    = oxConfig::getParameter( "editval");
00063 
00064 
00065         //  #918 S
00066         // checkbox handling
00067         if ( isset( $aParams['oxshops__oxactive']) && $aParams['oxshops__oxactive'] == true)
00068             $aParams['oxshops__oxactive'] = 1;
00069         else
00070             $aParams['oxshops__oxactive'] = 0;
00071 
00072         if ( isset( $aParams['oxshops__oxproductive']) && $aParams['oxshops__oxproductive'] == true)
00073             $aParams['oxshops__oxproductive'] = 1;
00074         else
00075             $aParams['oxshops__oxproductive'] = 0;
00076 
00077         $oShop = oxNew( "oxshop" );
00078 
00079         if ( $soxId != "-1") {
00080             $oShop->loadInLang( 0, $soxId );
00081         } else {
00082                 $aParams['oxshops__oxid'] = null;
00083         }
00084 
00085         if ($aParams['oxshops__oxsmtp']) {
00086             $aParams['oxshops__oxsmtp'] = trim($aParams['oxshops__oxsmtp']);
00087         }
00088 
00089         //$aParams = $oShop->ConvertNameArray2Idx( $aParams);
00090         $oShop->assign( $aParams);
00091 
00092         $sNewSMPTPass = oxConfig::getParameter( "oxsmtppwd");
00093 
00094         if ($sNewSMPTPass)
00095             $oShop->oxshops__oxsmtppwd->setValue($sNewSMPTPass);
00096         //unsetting password
00097         if ($sNewSMPTPass == '-')
00098             $oShop->oxshops__oxsmtppwd->setValue("");
00099 
00100         $isubjlang = oxConfig::getParameter("subjlang");
00101         if ($isubjlang && $isubjlang > 0) {
00102             $oShop->setLanguage($isubjlang);
00103         }
00104 
00105 
00106         $oShop->save();
00107 
00108 
00109         $this->_aViewData["updatelist"] =  "1";
00110 
00111         oxSession::setVar( "actshop", $soxId);
00112     }
00113 
00114 
00120     protected function _getShopIds()
00121     {
00122         //loading shop ids
00123         $sQ = "select oxid, oxname from oxshops";
00124         $aShopIds = array();
00125         $rs = oxDb::getDb()->execute($sQ);
00126         if ($rs != false && $rs->recordCount() > 0) {
00127             while (!$rs->EOF) {
00128                 $oShop = new stdClass();
00129                 $oShop->oxid = $rs->fields[0];
00130                 $oShop->oxname = $rs->fields[1];
00131                 $aShopIds[$rs->fields[0]] = $oShop;
00132                 $rs->moveNext();
00133             }
00134         }
00135 
00136         return $aShopIds;
00137     }
00138 
00139 }

Generated on Tue Apr 21 15:45:44 2009 for OXID eShop CE by  doxygen 1.5.5