Esempio n. 1
0
 public function __construct($registry)
 {
     parent::__construct($registry);
     $this->business = '';
     $this->sandbox = 1;
     $settings = $this->registry->core->loadModuleSettings('paypal', Helper::getViewId());
     if (!empty($settings)) {
         $this->business = $settings['business'];
         $this->apiusername = $settings['apiusername'];
         $this->apipassword = $settings['apipassword'];
         $this->apisignature = $settings['apisignature'];
         $this->sandbox = $settings['sandbox'];
     }
     $this->gatewayurl = "https://www.paypal.com/cgi-bin/webscr";
     if ($this->sandbox === 1) {
         $this->gatewayurl = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     }
     $this->returnurl = App::getURLAdress() . Seo::getSeo('payment') . '/confirm';
     $this->cancelurl = App::getURLAdress() . Seo::getSeo('payment') . '/cancel';
     $this->notifyurl = App::getURLAdress() . 'paypalreport';
     $this->ipnLogFile = ROOTPATH . 'logs/paypal.ipn_results.log';
     $this->lastError = '';
     $this->ipnData = array();
     $this->ipnResponse = '';
 }
Esempio n. 2
0
 public function index()
 {
     if (strlen($this->registry->core->getParam()) > 0) {
         $result = App::getModel('login')->authProccessSha($this->registry->core->getParam());
         if ($result == 1) {
             Session::setActiveLoginError(null);
             Session::setActiveUserid($result);
             App::getModel('login')->checkInstanceIsValid();
             App::getModel('login')->setLoginTime();
             App::getModel('login')->getUserData();
             App::getModel('login')->setDefaultView($result);
             App::redirect(__ADMINPANE__ . '/mainside');
         }
     }
     if (Session::getActiveUserid() != null) {
         App::redirect(__ADMINPANE__ . '/mainside');
     }
     $form = new FormEngine\Elements\Form(array('name' => 'login', 'action' => '', 'method' => 'post', 'class' => 'login-form', 'csrf' => false));
     $form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL_FORM_LOGIN'))))));
     $form->AddChild(new FormEngine\Elements\Password(array('name' => 'password', 'label' => _('TXT_LOGIN_FORM_PASSWORD'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_PASSWORD'))))));
     $form->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'autologin', 'label' => _('TXT_AUTOLOGIN'))));
     $form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_LOG_IN'))));
     $form->AddChild(new FormEngine\Elements\StaticText(array('text' => '<a href="' . App::getURLAdress() . 'forgotlogin">' . _('TXT_LOGIN_FORM_RESET_PASSWORD') . '</a>')));
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
         $result = App::getModel('login')->authProccess($loginValues['login'], $loginValues['password']);
         if ($result == 0) {
             Session::setVolatileLoginError(1, false);
         } else {
             if (isset($loginValues['autologin']) && $loginValues['autologin'] == 1) {
                 App::getModel('login')->setAdminAutologinKey($result);
             } else {
                 App::getModel('login')->destroyAdminAutologinKey();
             }
             Session::setActiveLoginError(null);
             Session::setActiveUserid($result);
             App::getModel('login')->checkInstanceIsValid();
             App::getModel('login')->setLoginTime();
             App::getModel('login')->getUserData();
             App::getModel('login')->setDefaultView($result);
             App::redirect(__ADMINPANE__ . '/mainside');
         }
     }
     $error = Session::getVolatileLoginError();
     if ($error[0] == 1) {
         $this->registry->template->assign('error', _('ERR_BAD_LOGIN_OR_PASSWORD'));
     }
     $languages = App::getModel('language')->getLanguages();
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->template->assign('form', $form->Render());
     $this->registry->template->assign('languages', json_encode($languages));
     $this->registry->template->display($this->loadTemplate('index.tpl'));
 }
 public function index()
 {
     $clientData = App::getModel('client')->getClient();
     $this->registry->xajax->registerFunction(array('addProductToCart', App::getModel('cart/cart'), 'addAJAXProductToCart'));
     $this->registry->xajax->registerFunction(array('addOpinion', $this->productModel, 'addAJAXOpinionAboutProduct'));
     $this->registry->xajax->registerFunction(array('addProductRangeOpinion', $this->productModel, 'addAJAXProductRangeOpinion'));
     if (isset($this->_boxAttributes['tabbed'])) {
         $tabbed = $this->_boxAttributes['tabbed'];
     } else {
         $tabbed = 1;
     }
     if (isset($this->product['idproduct'])) {
         $range = $this->productModel->getRangeType((int) $this->productid);
         $this->productModel->getPhotos($this->product);
         $this->productModel->getOtherPhotos($this->product);
         $selectAttributes = $this->productModel->getProductAttributeGroups($this->product);
         foreach ($selectAttributes as $key => $val) {
             natsort($val['attributes']);
             $selectAttributes[$key]['attributes'] = $val['attributes'];
         }
         $attset = $this->productModel->getProductVariant($this->product);
         $Data = array();
         foreach ($attset as $group => $data) {
             $Data[implode(',', array_keys($data['variant']))] = array('setid' => $group, 'stock' => $data['stock'], 'sellprice' => $this->registry->core->processPrice($data['sellprice']), 'sellpricenetto' => $this->registry->core->processPrice($data['sellpricenetto']));
         }
         $productreview = App::getModel('productreview')->getProductReviews((int) $this->productid);
         $delivery = App::getModel('delivery')->getDispatchmethodPriceForProduct($this->product['price'], $this->product['weight']);
         $deliverymin = PHP_INT_MAX;
         foreach ($delivery as $i) {
             $deliverymin = min($deliverymin, $i['dispatchmethodcost']);
         }
         $files = App::getModel('product')->getFilesByProductId((int) $this->productid);
         $tabs = $this->registry->template->assign('tabbed', $tabbed);
         $eventData = Event::filter($this, 'frontend.productbox.assign', array(), NULL);
         foreach ($eventData as $Data) {
             foreach ($Data as $tab => $values) {
                 $this->registry->template->assign($tab, $values);
             }
         }
         $this->registry->template->assign('range', $range);
         $this->registry->template->assign('files', $files);
         $this->registry->template->assign('variants', json_encode($Data));
         $this->registry->template->assign('product', $this->product);
         $this->registry->template->assign('attributes', $selectAttributes);
         $this->registry->template->assign('attset', $attset);
         $this->registry->template->assign('productreview', $productreview);
         $this->registry->template->assign('delivery', $delivery);
         $this->registry->template->assign('deliverymin', $deliverymin);
         $this->productModel->updateViewedCount((int) $this->productid);
     } else {
         App::redirectSeo(App::getURLAdress());
     }
     return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
 }
Esempio n. 4
0
 public function edit()
 {
     $PopulateData = $this->model->getProductAndAttributesById((int) $this->id);
     $groupPrice = App::getModel('product')->getProductGroupPrice($this->id, false);
     $CurrentViewData = array('basic_pane' => array('language_data' => $PopulateData['language'], 'ean' => $PopulateData['ean'], 'enable' => $PopulateData['enable'], 'delivelercode' => $PopulateData['delivelercode'], 'producerid' => $PopulateData['producerid'], 'delivererid' => $PopulateData['delivererid']), 'meta_data' => array('language_data' => $PopulateData['language']), 'category_pane' => array('category' => $PopulateData['category']), 'price_pane' => array('vatid' => $PopulateData['vatid'], 'buyprice' => $PopulateData['buyprice'], 'buycurrencyid' => $PopulateData['buycurrencyid'], 'sellcurrencyid' => $PopulateData['sellcurrencyid'], 'standard_price' => array('sellprice' => $PopulateData['sellprice'], 'promotion' => $PopulateData['promotion'], 'discountprice' => $PopulateData['discountprice'], 'promotionstart' => $PopulateData['promotionstart'], 'promotionend' => $PopulateData['promotionend'])), 'weight_pane' => array('weight' => $PopulateData['weight'], 'width' => $PopulateData['width'], 'height' => $PopulateData['height'], 'deepth' => $PopulateData['deepth'], 'unit' => $PopulateData['unit'], 'packagesize' => $PopulateData['packagesize']), 'stock_pane' => array('stock' => $PopulateData['standardstock'], 'trackstock' => $PopulateData['trackstock'], 'availablityid' => isset($PopulateData['availablityid']) ? $PopulateData['availablityid'] : 0, 'disableatstockenabled' => $PopulateData['disableatstockenabled'], 'disableatstock' => $PopulateData['disableatstock']), 'description_pane' => array('language_data' => $PopulateData['language']), 'crosssell_products' => array('crosssell' => App::getModel('crosssell')->getProductsDataGrid((int) $this->id)), 'upsell_products' => array('upsell' => App::getModel('upsell')->getProductsDataGrid((int) $this->id)), 'similar_products' => array('similar' => App::getModel('similarproduct')->getProductsDataGrid((int) $this->id)), 'photos_pane' => array('photo' => $PopulateData['photo'], 'mainphotoid' => $PopulateData['mainphotoid']), 'files_pane' => array('file' => $PopulateData['file']), 'warranty_pane' => array('warranty' => $PopulateData['warranty']), 'statusproduct_pane' => array('productstatuses' => $PopulateData['productstatuses'], 'newactive' => $PopulateData['productnew']['newactive'], 'new_data' => array('startnew' => $PopulateData['productnew']['startnew'], 'endnew' => $PopulateData['productnew']['endnew'])), 'variants_pane' => array('variants' => $PopulateData['variants']));
     foreach ($groupPrice as $key => $val) {
         $CurrentViewData['price_pane'][$key] = $val;
     }
     $this->formModel->setPopulateData($CurrentViewData);
     $form = $this->formModel->initForm();
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $this->model->productUpdateAll($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id);
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
         if (FormEngine\FE::IsAction('continue')) {
             App::redirect(__ADMINPANE__ . '/product/edit/' . $this->id);
         } else {
             App::redirect(__ADMINPANE__ . '/product');
         }
     }
     $this->renderLayout(array('form' => $form->Render(), 'productName' => isset($PopulateData['language'][Helper::getLanguageId()]['name']) ? $PopulateData['language'][Helper::getLanguageId()]['name'] : $PopulateData['language'][1]['name'], 'productLink' => App::getURLAdress() . Seo::getSeo('productcart') . '/' . (isset($PopulateData['language'][Helper::getLanguageId()]['seo']) ? $PopulateData['language'][Helper::getLanguageId()]['seo'] : $PopulateData['language'][1]['seo'])));
 }
Esempio n. 5
0
 public function getProductCartPhotos(&$productCart)
 {
     if (!is_array($productCart)) {
         throw new FrontendException('Wrong array given.');
     }
     foreach ($productCart as $index => $key) {
         if (isset($key['mainphotoid']) && $key['mainphotoid'] > 0) {
             $productCart[$index]['smallphoto'] = App::getModel('gallery')->getImagePath(App::getModel('gallery')->getSmallImageById($key['mainphotoid']), App::getURLAdress());
         }
         if (isset($key['attributes']) && $key['attributes'] != NULL) {
             foreach ($key['attributes'] as $attrindex => $attrkey) {
                 if ($attrkey['mainphotoid'] > 0) {
                     $productCart[$index]['attributes'][$attrindex]['smallphoto'] = App::getModel('gallery')->getImagePath(App::getModel('gallery')->getSmallImageById($attrkey['mainphotoid']), App::getURLAdress());
                 }
             }
         }
     }
     return $productCart;
 }
Esempio n. 6
0
 public function getProductListIntegration()
 {
     $sql = "SELECT\n\t\t\t\t  \tPC.categoryid AS id,\n\t\t\t\t  \tP.idproduct,\n\t\t\t\t  \tP.stock,\n\t\t\t\t  \tP.weight,\n\t\t\t\t  \tPT.name,\n\t\t\t\t  \t(P.sellprice * (1 + (V.value / 100)) * CR.exchangerate) AS sellprice,\n\t\t\t\t  \tIF(P.promotion = 1 AND IF(P.promotionstart IS NOT NULL, P.promotionstart <= CURDATE(), 1) AND IF(P.promotionend IS NOT NULL, P.promotionend >= CURDATE(), 1), P.discountprice * (1 + (V.value / 100)) * CR.exchangerate, NULL) AS discountprice,\n\t\t\t\t \tPT.shortdescription,\n\t\t\t\t  \tPhoto.photoid,\n\t\t\t\t  \tNC.name as ceneooriginal,\n\t\t\t\t  \tCN.categoryid,\n\t\t\t\t  \tNC.idceneo,\n\t\t\t\t  \tCN.ceneoid,\n\t\t\t\t  \tPT.seo,\n\t\t\t\t\tPRT.name AS producername,\n\t\t\t\t\tP.ean,\n\t\t\t\t\tNC.path\n\t\t\t\tFROM product P\n\t\t\t\tLEFT JOIN vat V ON P.vatid= V.idvat\n\t\t\t\tLEFT JOIN producttranslation PT ON PT.productid = P.idproduct AND PT.languageid=:languageid\n\t\t\t\tLEFT JOIN productcategory PC ON PC.productid = P.idproduct\n\t\t\t\tINNER JOIN viewcategory VC ON VC.categoryid = PC.categoryid AND VC.viewid = :viewid\n\t\t\t\tLEFT JOIN currencyrates CR ON CR.currencyfrom = P.sellcurrencyid AND CR.currencyto = :currencyto\n\t\t\t\tINNER JOIN productphoto Photo ON Photo.productid = P.idproduct AND Photo.mainphoto=1\n\t\t\t\tINNER JOIN categoryceneo CN ON CN.categoryid = PC.categoryid\n\t\t\t\tINNER JOIN ceneo NC ON NC.idorginal = CN.ceneoid\n\t\t\t\tLEFT JOIN producertranslation PRT ON PRT.producerid = P.producerid AND PRT.languageid = :languageid\n\t\t\t\tWHERE P.enable = 1\n\t            GROUP BY P.idproduct";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->bindValue('languageid', Helper::getLanguageId());
     $stmt->bindValue('currencyto', $this->registry->session->getActiveCurrencyId());
     $rs = $stmt->execute();
     $Data = array();
     while ($rs = $stmt->fetch()) {
         $Data[] = array('categoryid' => $rs['id'], 'producername' => $rs['producername'], 'ean' => $rs['ean'], 'productid' => $rs['idproduct'], 'stock' => $rs['stock'], 'avail' => $rs['stock'] > 0 ? 1 : 7, 'weight' => $rs['weight'], 'seo' => $rs['seo'], 'name' => $rs['name'], 'shortdescription' => $rs['shortdescription'], 'sellprice' => number_format(!is_null($rs['discountprice']) ? $rs['discountprice'] : $rs['sellprice'], 2, '.', ''), 'photoid' => $rs['photoid'], 'idproduct' => $rs['idproduct'], 'ceneo' => str_replace('|', '\\', $rs['path']));
     }
     foreach ($Data as $key => $Product) {
         $Image = App::getModel('gallery')->getOrginalImageById($Product['photoid']);
         $Data[$key]['photo'] = App::getModel('gallery')->getImagePath($Image, App::getURLAdress());
     }
     return $Data;
 }
Esempio n. 7
0
    public function Render()
    {
        $form = new FormEngine\Elements\Form(array('name' => 'install', 'action' => '', 'method' => 'post', 'csrf' => false));
        $checkDirLogs = $this->check_dir('logs');
        $checkDirCache = $this->check_dir('cache');
        $checkDirSerialization = $this->check_dir('serialization');
        $minPHP = '5.3';
        $checkPHPVersion = $this->checkPhpVersion($minPHP);
        $checkExtensionZlib = $this->checkExtension('zlib');
        $checkExtensionGd = $this->checkExtension('gd');
        $checkExtensionMysqli = $this->checkExtension('mysqli');
        $checkExtensionCurl = $this->checkExtension('curl');
        //if(ini_get('output_buffering')){
        $checkOB = true;
        //}else{
        //$checkOB = false;
        //}
        if ($checkOB == TRUE && $checkPHPVersion == TRUE && $checkExtensionZlib == TRUE && $checkExtensionMysqli == TRUE && $checkExtensionCurl == TRUE && ($checkExtensionGd = TRUE)) {
            $license = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'license', 'label' => 'Licencja')));
            $licenceFile = file_get_contents(ROOTPATH . 'LICENCE');
            $gpl = '<div style="height:20em; border:1px solid #ccc; margin-bottom:8px; padding:5px; background:#fff; overflow: auto; overflow-x:hidden; overflow-y:scroll;">
				' . $licenceFile . '
				</div>';
            $license->AddChild(new FormEngine\Elements\StaticText(array('text' => $gpl)));
            $license->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'accept_license', 'label' => 'Akceptuję licencję', 'rules' => array(new FormEngine\Rules\Required('Musisz zaakceptować licencję.')), 'default' => 0)));
            $store = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'store', 'label' => 'Dane administratora sklepu')));
            $store->AddChild(new FormEngine\Elements\TextField(array('name' => 'user_email', 'comment' => 'Używany jako login', 'label' => 'E-mail', 'rules' => array(new FormEngine\Rules\Required('Podaj login.')))));
            $store->AddChild(new FormEngine\Elements\Password(array('name' => 'user_password', 'label' => 'Hasło', 'rules' => array(new FormEngine\Rules\Required('Podaj hasło.')))));
            $database = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'database_settings', 'label' => 'Ustawienia bazy SQL')));
            $database->AddChild(new FormEngine\Elements\TextField(array('name' => 'hostspec', 'label' => 'Host', 'default' => 'localhost', 'rules' => array(new FormEngine\Rules\Required('Podaj host bazy SQL.')))));
            $database->AddChild(new FormEngine\Elements\TextField(array('name' => 'mysqlport', 'label' => 'Port', 'default' => 3306, 'rules' => array(new FormEngine\Rules\Required('Podaj port bazy SQL.')))));
            $database->AddChild(new FormEngine\Elements\TextField(array('name' => 'username', 'label' => 'Użytkownik', 'rules' => array(new FormEngine\Rules\Required('Podaj użytkownika bazy SQL.')))));
            $database->AddChild(new FormEngine\Elements\Password(array('name' => 'password', 'label' => 'Hasło')));
            $database->AddChild(new FormEngine\Elements\TextField(array('name' => 'database', 'label' => 'Nazwa bazy', 'rules' => array(new FormEngine\Rules\Required('Podaj nazwę bazy SQL.')))));
            $database->AddChild(new FormEngine\Elements\TextField(array('name' => 'client_data_encription_string', 'label' => 'Klucz szyfrujący dane', 'default' => substr(md5(uniqid(rand(), true)), 0, 32), 'rules' => array(new FormEngine\Rules\Required('Musisz podać klucz szyfrujący.')))));
            $installation = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'installation', 'label' => 'Instalacja')));
            $installation->AddChild(new FormEngine\Elements\StaticText(array('text' => '<a href="#" class="installButton">Zainstaluj Gekosale</a>')));
            $form->AddFilter(new FormEngine\Filters\Trim());
            if ($form->Validate(FormEngine\FE::SubmittedData())) {
                $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
                $conn = $this->testDBConnection($Data);
                if ($conn === TRUE) {
                    $this->importDatabase($Data);
                    $this->configWriter($Data);
                    header('Location: ' . $this->panelURL('admin'));
                } else {
                    $this->error = addslashes($conn);
                }
            }
        } else {
            $requirements = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'requirements', 'label' => 'Requirements')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkPHPVersion == TRUE ? '<p style="color: green;"><strong>PHP version</strong> - OK</p>' : '<p style="color: red"><strong>PHP version</strong> - ' . $minPHP . ' required, ' . phpversion() . ' available</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkExtensionZlib == TRUE ? '<p style="color: green;"><strong>Zlib extension</strong> - OK</p>' : '<p style="color: red"><strong>Zlib extension</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkExtensionMysqli == TRUE ? '<p style="color: green;"><strong>Mysqli extension</strong> - OK</p>' : '<p style="color: red"><strong>Mysqli extension</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkExtensionCurl == TRUE ? '<p style="color: green;"><strong>cURL extension</strong> - OK</p>' : '<p style="color: red"><strong>cURL extension</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkExtensionGd == TRUE ? '<p style="color: green;"><strong>GD extension</strong> - OK</p>' : '<p style="color: red"><strong>GD extension</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkDirLogs == TRUE ? '<p style="color: green;"><strong>"logs" dir writeable</strong> - OK</p>' : '<p style="color: red"><strong>"logs" dir writeable</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkDirCache == TRUE ? '<p style="color: green;"><strong>"cache" dir writeable</strong> - OK</p>' : '<p style="color: red"><strong>"cache" dir writeable</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkDirSerialization == TRUE ? '<p style="color: green;"><strong>"serialization" dir writeable</strong> - OK</p>' : '<p style="color: red"><strong>"serialization" dir writeable</strong> - No</p>')));
            $requirements->AddChild(new FormEngine\Elements\StaticText(array('text' => $checkOB == TRUE ? '<p style="color: green;"><strong>"output_buffering" is ON</strong> - OK</p>' : '<p style="color: red"><strong>"output_buffering" is OFF</strong> - No</p>')));
        }
        $this->template->display($this->tplFile, array('DESIGNPATH' => App::getURLAdress() . 'design/', 'form' => $form->Render('JS', '', false), 'error' => $this->error));
    }
Esempio n. 8
0
 public function index()
 {
     $clientData = App::getModel('client')->getClient();
     $this->registry->xajax->registerFunction(array('addOpinion', $this->productModel, 'addAJAXOpinionAboutProduct'));
     //$this->registry->xajax->registerFunction(array(
     //'addProductRangeOpinion',
     //$this->productModel,
     //'addAJAXProductRangeOpinion'
     //));
     if (isset($this->_boxAttributes['tabbed'])) {
         $tabbed = $this->_boxAttributes['tabbed'];
     } else {
         $tabbed = 1;
     }
     if (isset($this->product['idproduct'])) {
         $range = $this->productModel->getRangeType((int) $this->productid);
         $this->productModel->getPhotos($this->product);
         $this->productModel->getOtherPhotos($this->product);
         $selectAttributes = $this->productModel->getProductAttributeGroups($this->product);
         foreach ($selectAttributes as $key => $val) {
             natsort($val['attributes']);
             $selectAttributes[$key]['attributes'] = $val['attributes'];
         }
         $attset = $this->productModel->getProductVariant($this->product);
         $Data = array();
         foreach ($attset as $group => $data) {
             $keys = array_keys($data['variant']);
             natsort($keys);
             $Data[implode(',', $keys)] = array('setid' => $group, 'stock' => $data['stock'], 'sellprice' => $this->registry->core->processPrice($data['sellprice']), 'sellpricenetto' => $this->registry->core->processPrice($data['sellpricenetto']), 'sellpriceold' => $this->registry->core->processPrice($data['attributepricegrossbeforepromotion']), 'sellpricenettoold' => $this->registry->core->processPrice($data['attributepricenettobeforepromotion']), 'availablity' => $data['availablity'], 'photos' => $data['photos']);
         }
         $productreview = App::getModel('productreview')->getProductReviews((int) $this->productid);
         $delivery = App::getModel('delivery')->getDispatchmethodPriceForProduct($this->product['price'], $this->product['weight']);
         $deliverymin = PHP_INT_MAX;
         foreach ($delivery as $i) {
             $deliverymin = min($deliverymin, $i['dispatchmethodcost']);
         }
         $files = App::getModel('product')->getFilesByProductId((int) $this->productid);
         $warranty = App::getModel('product')->getWarrantyByProductId((int) $this->productid);
         $tabs = $this->registry->template->assign('tabbed', $tabbed);
         $eventData = Event::filter($this, 'frontend.productbox.assign', array(), NULL);
         foreach ($eventData as $Data) {
             foreach ($Data as $tab => $values) {
                 $this->registry->template->assign($tab, $values);
             }
         }
         $opinion = Session::getVolatileOpinionAdded();
         if ($opinion[0] == 1) {
             $this->registry->template->assign('opinionadded', _('TXT_CLIENT_OPINION_ADDED'));
         } elseif ($opinion[0] == 2) {
             $this->registry->template->assign('opinionadded', _('TXT_GUEST_OPINION_ADDED'));
         }
         if ($this->product['enable'] == 0 && (int) Session::getActiveUserid() > 0) {
             $this->registry->template->assign('draft', _('TXT_PRODUCT_DRAFT'));
         }
         $this->registry->template->assign('range', $range);
         $this->registry->template->assign('files', $files);
         $this->registry->template->assign('warranty', $warranty);
         $this->registry->template->assign('variants', json_encode($Data));
         $this->registry->template->assign('product', $this->product);
         $this->registry->template->assign('attributes', $selectAttributes);
         $this->registry->template->assign('attset', $attset);
         $this->registry->template->assign('humanProductReviewCount', App::getModel('productreview')->getHumanOpinionsCount(count($productreview)));
         $this->registry->template->assign('productreview', $productreview);
         $this->registry->template->assign('delivery', $delivery);
         $this->registry->template->assign('deliverymin', $deliverymin);
         $this->productModel->updateViewedCount((int) $this->productid);
     } else {
         App::redirectSeo(App::getURLAdress());
     }
     return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
 }
Esempio n. 9
0
 public function setStaticTemplateVariables()
 {
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $link = $this->_adminPane = '';
     } else {
         $link = $this->_adminPane = __ADMINPANE__ . '/';
     }
     $languageModel = App::getModel('language');
     $languages = $languageModel->getLanguages();
     $this->layer = $this->registry->loader->getCurrentLayer();
     if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
         $this->assign('SSLNAME', 'https://');
     } else {
         $this->assign('SSLNAME', 'http://');
     }
     $theme = App::getRegistry()->loader->getParam('theme');
     $this->assign('URL', App::getURLAdress() . $link);
     $this->assign('CURRENT_URL', App::getCurrentURLAdress());
     $this->assign('DESIGNPATH', DESIGNPATH);
     $this->assign('ASSETSPATH', App::getURLForAssetDirectory() . $theme . '/assets/');
     $this->assign('THEMESPATH', App::getURLForAssetDirectory());
     $this->assign('CURRENT_CONTROLLER', $this->registry->router->getCurrentController());
     $this->assign('CURRENT_ACTION', $this->registry->router->getAction());
     $this->assign('CURRENT_PARAM', $this->registry->core->getParam());
     $this->assign('SHOP_NAME', Session::getActiveShopName());
     $templateData = array();
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $cartModel = App::getModel('cart');
         $client = App::getModel('client')->getClient();
         $productCart = $cartModel->getShortCartList();
         $productCart = $cartModel->getProductCartPhotos($productCart);
         $this->assign('SHOP_LOGO', $this->layer['photoid']);
         $this->assign('FAVICON', $this->layer['favicon']);
         $this->assign('enableregistration', $this->layer['enableregistration']);
         $this->assign('client', $client);
         $this->assign('clientdata', $client);
         $this->assign('showtax', $this->layer['showtax']);
         $this->assign('currencySymbol', Session::getActiveCurrencySymbol());
         $this->assign('count', $cartModel->getProductAllCount());
         $this->assign('globalPrice', $cartModel->getGlobalPrice());
         $this->assign('productCart', $productCart);
         $this->assign('language', Session::getActiveLanguageId());
         $this->assign('languageCode', Session::getActiveLanguage());
         $this->assign('languageFlag', $languageModel->getLanguages());
         $this->assign('currencies', $languageModel->getAllCurrenciesForView());
         $this->assign('breadcrumb', App::getModel('breadcrumb')->getPageLinks());
         $this->assign('contentcategory', App::getModel('staticcontent')->getContentCategoriesTree());
         $this->assign('defaultcontact', App::getModel('contact')->getContactById($this->layer['contactid']));
         $this->assign('newsletterButton', App::getModel('newsletter')->isNewsletterButton());
         $this->assign('cartpreview', $cartModel->getCartPreviewTemplate());
         if ($this->layer['cartredirect'] != '') {
             $this->assign('cartredirect', App::getURLAdress() . Seo::getSeo($this->layer['cartredirect']));
         } else {
             $this->assign('cartredirect', '');
         }
         $this->assign('modulesettings', $this->registry->core->getModuleSettingsForView());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('categories', App::getModel('CategoriesBox')->getCategoriesTree(2));
         $methods = $this->getXajaxMethodsForFrontend();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     } else {
         $this->registry->core->setAdminStoreConfig();
         $templateData = array('user_name' => App::getModel('users')->getUserFullName(), 'user_id' => App::getModel('users')->getActiveUserid(), 'language' => Session::getActiveLanguageId(), 'languages' => json_encode($languages), 'globalsettings' => Session::getActiveGlobalSettings(), 'views' => App::getModel('view')->getViews(), 'vatvalues' => json_encode(App::getModel('vat/vat')->getVATValuesAll()), 'FRONTEND_URL' => Session::getActiveShopUrl() != '' ? 'http://' . Session::getActiveShopUrl() : App::getURLAdress(), 'appversion' => Session::getActiveAppVersion(), 'view' => Helper::getViewId(), 'viewid' => Helper::getViewId());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $templateData['message'] = $message[0];
         }
         $methods = $this->getXajaxMethodsForAdmin();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $Data = Event::dispatch($this, 'template.setStaticTemplateVariables', array('data' => $templateData));
         foreach ($Data as $param => $value) {
             $this->assign($param, $value);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     }
 }