shop_main.php

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

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5