Example #1
0
    public function loadView()
    {
        $sql = 'SELECT
					V.idview,
					V.name as shopname,
					V.namespace,
					C.idcurrency, 
					C.currencysymbol,
					C.decimalseparator,
					C.decimalcount,
					C.thousandseparator,
					C.positivepreffix,
					C.positivesuffix,
					C.negativepreffix,
					C.negativesuffix,
					S.countryid,
					V.taxes,
					V.showtax,
					V.offline,
					cartredirect,
          terms,
					photoid,
					favicon,
					forcelogin,
					apikey,
					watermark,
					confirmregistration,
					enableregistration,
					invoicenumerationkind,
					V.pageschemeid,
					V.contactid,
					PS.templatefolder
				FROM view V
				LEFT JOIN viewcategory VC ON VC.viewid = V.idview
				LEFT JOIN store S ON V.storeid = S.idstore
				LEFT JOIN pagescheme PS ON PS.idpagescheme = V.pageschemeid
				LEFT JOIN currency C ON C.idcurrency = IF(:currencyid > 0, :currencyid, V.currencyid)
				WHERE V.idview = :viewid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('viewid', $this->determineViewId());
        $stmt->bindValue('currencyid', Session::getActiveCurrencyId());
        $stmt->execute();
        $rs = $stmt->fetch();
        if ($rs) {
            $this->layer = array('terms' => $rs['terms'], 'idview' => $rs['idview'], 'namespace' => $rs['namespace'], 'cartredirect' => $rs['cartredirect'], 'offline' => $rs['offline'], 'taxes' => $rs['taxes'], 'showtax' => $rs['showtax'], 'shopname' => $rs['shopname'], 'photoid' => $rs['photoid'], 'favicon' => $rs['favicon'], 'watermark' => $rs['watermark'], 'idcurrency' => $rs['idcurrency'], 'currencysymbol' => $rs['currencysymbol'], 'decimalseparator' => $rs['decimalseparator'], 'decimalcount' => $rs['decimalcount'], 'thousandseparator' => $rs['thousandseparator'], 'positivepreffix' => $rs['positivepreffix'], 'positivesuffix' => $rs['positivesuffix'], 'negativepreffix' => $rs['negativepreffix'], 'negativesuffix' => $rs['negativesuffix'], 'countryid' => $rs['countryid'], 'forcelogin' => $rs['forcelogin'], 'confirmregistration' => $rs['confirmregistration'], 'enableregistration' => $rs['enableregistration'], 'apikey' => $rs['apikey'], 'invoicenumerationkind' => $rs['invoicenumerationkind'], 'pageschemeid' => $rs['pageschemeid'], 'theme' => $rs['templatefolder'], 'pageschemeid' => $rs['pageschemeid'], 'contactid' => $rs['contactid']);
            Session::setActiveShopName($this->layer['shopname']);
            if (is_null($this->layer['photoid'])) {
                $this->layer['photoid'] = 'logo.png';
            }
            if (is_null($this->layer['favicon'])) {
                $this->layer['favicon'] = 'favicon.ico';
            }
            Session::setActiveShopCurrencyId($this->layer['idcurrency']);
            Session::setActiveForceLogin($this->layer['forcelogin']);
            if (Session::getActiveBrowserData() == NULL) {
                $browser = new Browser();
                $Data = array('browser' => $browser->getBrowser(), 'platform' => $browser->getPlatform(), 'ismobile' => $browser->isMobile(), 'isbot' => $browser->isRobot());
                Session::setActiveBrowserData($Data);
            }
        }
    }