diff --git a/bin/css/style.css b/bin/css/style.css index b0f2b2e32e586f3aec4113733c92c109b109eceb..48f88fc797a6120546ec659b922b6cce6b422a49 100644 --- a/bin/css/style.css +++ b/bin/css/style.css @@ -855,7 +855,6 @@ a.toTop:before { } /* user & basket container */ - .cologne-header-control { align-items: center; display: flex; @@ -868,6 +867,21 @@ a.toTop:before { width: 200px; } +.quiqqer-order-basketButton { + cursor: pointer; + padding-right: 5px; + position: relative; +} + +/* fix: without it jumping effect */ +/* todo bei Gelegenheit das fixen. Oder Basket Button wird php-seitig erstellt */ +/* dann wird das unnötigt */ +.tpl-btn.quiqqer-order-basketButton { + display: flex; + align-items: center; +} +/* end fix */ + .tpl-btn.quiqqer-order-basketButton { background: none; border: 1px solid #ddd; @@ -894,6 +908,11 @@ a.toTop:before { .basket-style-full .quiqqer-order-basketButton-sum { border-left: 1px solid #ddd; padding-left: 10px; + min-width: 80px; +} + +.tpl-btn.quiqqer-order-basketButton .quiqqer-order-basketButton-quantity { + margin-right: 20px; } /* style: compact */ diff --git a/bin/javascript/init.js b/bin/javascript/init.js index 059bb21e910c6ae0430d08e48e49b623c8732a05..f7cb65fafdb96a26c931aaef2a46866f7020b359 100644 --- a/bin/javascript/init.js +++ b/bin/javascript/init.js @@ -133,7 +133,7 @@ window.addEvent('domready', function () { 'package/quiqqer/order/bin/frontend/controls/basket/Button' ], function (Basket) { new Basket({ - open : basketOpen.toInt(), + open : BASKET_OPEN.toInt(), styles: { float: 'right' }, @@ -142,8 +142,8 @@ window.addEvent('domready', function () { var BasketNode = Basket.getElm(), basketStyleCss = ''; - if (basketStyle) { - basketStyleCss = 'basket-style-' + basketStyle; + if (BASKET_STYLE) { + basketStyleCss = 'basket-style-' + BASKET_STYLE; } // clear default content @@ -160,13 +160,14 @@ window.addEvent('domready', function () { html : '0' }).inject(BasketNode); - if (basketStyle && basketStyle === 'full') { + if (BASKET_STYLE && BASKET_STYLE === 'full') { new Element('span', { 'class': 'quiqqer-order-basketButton-sum', - html : '---', - styles : {} + html : INITAL_BASKET_PRICE }).inject(BasketNode); } + + document.getElement('.cologne-header-control-basket').set('html', ''); }, /** * onShowBasketBegin event diff --git a/index.html b/index.html index f8009b57966f1f4acc9e9d0c447520b0168de859..3f7db201c7c66ae4c088c337c82b349a9156fa12 100644 --- a/index.html +++ b/index.html @@ -27,9 +27,10 @@ {$settingsCSS} <script> - var basketStyle = "{$basketStyle}"; - var basketOpen = "{$basketOpen}"; - var COUNT_LANGUAGES = "{$countLanguages}"; + var BASKET_STYLE = "{$basketStyle}"; + var BASKET_OPEN = "{$basketOpen}"; + var INITAL_BASKET_PRICE = "{$initialBasketPrice}"; + var COUNT_LANGUAGES = "{$countLanguages}"; </script> </head> diff --git a/index.php b/index.php index 36e5fdabb1e0689b728bfbdaec4edbe66800049a..b06c8fb3a5127950a69cfbb4a1983d55ffc72d41 100644 --- a/index.php +++ b/index.php @@ -7,6 +7,14 @@ QUI\Utils\Site::setRecursiveAttribute($Site, 'image_emotion'); QUI\Utils\Site::setRecursiveAttribute($Site, 'layout'); +/** + * Template config + */ +$templateSettings = QUI\TemplateCologne\Utils::getConfig([ + 'Project' => $Project, + 'Site' => $Site, +]); + /** * Header */ @@ -16,13 +24,27 @@ 'Project' => $Site->getProject() ]); -// header logo +/** + * Basket button + */ $EngineForMenu = QUI::getTemplateManager()->getEngine(); +$Currency = QUI\ERP\Currency\Handler::getUserCurrency(); + +if (!$Currency) { + $Currency = QUI\ERP\Currency\Handler::getDefaultCurrency(); +} + +$InitialBasketPrice = new QUI\ERP\Money\Price(0, $Currency); + $EngineForMenu->assign([ - 'Logo' => $Project->getMedia()->getLogoImage() + 'Logo' => $Project->getMedia()->getLogoImage(), + 'basketStyle' => $templateSettings['basketStyle'], + 'InitialBasketPrice' => $InitialBasketPrice ]); +$templateSettings['initialBasketPrice'] = $InitialBasketPrice->getDisplayPrice(); + $Menu->prependHTML($EngineForMenu->fetch(\dirname(__FILE__) . '/template/menu/menuPrefix.html')); $Menu->appendHTML($EngineForMenu->fetch(\dirname(__FILE__) . '/template/menu/menuSuffix.html')); @@ -51,15 +73,6 @@ 'all' => true ]); -/** - * Template config - */ -$templateSettings = QUI\TemplateCologne\Utils::getConfig([ - 'Project' => $Project, - 'Site' => $Site, - 'Template' => $Template -]); - /** * Lang currency swtich control diff --git a/src/QUI/TemplateCologne/Utils.php b/src/QUI/TemplateCologne/Utils.php index d52f89dfb3daccefcc01fb3b0c68f32d01499efb..4d89234066d1a5e9abcd1ec5632f07624e1b8a1f 100644 --- a/src/QUI/TemplateCologne/Utils.php +++ b/src/QUI/TemplateCologne/Utils.php @@ -68,19 +68,15 @@ public static function getConfig($params) try { return QUI\Cache\Manager::get( - 'quiqqer/templateCologne/'.$Site->getId() + 'quiqqer/templateCologne/' . $Site->getId() ); } catch (QUI\Exception $Exception) { } - $config = []; /* @var $Project QUI\Projects\Project */ - /* @var $Template QUI\Template() */ - /* @var $Template QUI\Template() */ - $Project = $params['Project']; - $Template = $params['Template']; + $Project = $params['Project']; /** * no header? @@ -178,21 +174,19 @@ public static function getConfig($params) // predefined footer $config += self::getPredefinedFooter($Project); - $config += [ - 'header' => $header, - 'pageTitle' => $pageTitle, - 'showBreadcrumb' => $showBreadcrumb, - 'settingsCSS' => '<style>'.$settingsCSS.'</style>', - 'typeClass' => 'type-'.str_replace(['/', ':'], '-', $Site->getAttribute('type')), - 'siteType' => $siteType, - 'basketStyle' => $basketStyle, - 'basketOpen' => $basketOpen, - 'showCategoryMenu' => $showCategoryMenu - ]; + $config['header'] = $header; + $config['pageTitle'] = $pageTitle; + $config['showBreadcrumb'] = $showBreadcrumb; + $config['settingsCSS'] = '<style>' . $settingsCSS . '</style>'; + $config['typeClass'] = 'type-' . str_replace(['/', ':'], '-', $Site->getAttribute('type')); + $config['siteType'] = $siteType; + $config['basketStyle'] = $basketStyle; + $config['basketOpen'] = $basketOpen; + $config['showCategoryMenu'] = $showCategoryMenu; // set cache QUI\Cache\Manager::set( - 'quiqqer/templateCologne/'.$Site->getId(), + 'quiqqer/templateCologne/' . $Site->getId(), $config ); diff --git a/template/menu/menuSuffix.html b/template/menu/menuSuffix.html index 646aa6ff7d201d3aafa882c8232d7abb4c8a9775..20e1226bbcf3411c9264b4be07c1efbc972365df 100644 --- a/template/menu/menuSuffix.html +++ b/template/menu/menuSuffix.html @@ -1,3 +1,21 @@ <div class="cologne-header-control"> - <div class="cologne-header-control-basket"></div> + <div class="cologne-header-control-basket"> + {if $basketStyle == 'compact'} + <button disabled class="quiqqer-order-basketButton button--callToAction tpl-btn basket-style-{$basketStyle}" + data-quiid="jyr6toys" style="float: right;"><span class="quiqqer-order-basketButton-icon-custom"><span + class="fa fa-shopping-basket"></span></span><span + class="quiqqer-order-basketButton-quantity quiqqer-order-basketButton-batch-custom">0</span></button> + {else} + <button disabled class="quiqqer-order-basketButton button--callToAction tpl-btn basket-style-full" data-quiid="jyr7g3hr" + style="float: right;"> + <span class="quiqqer-order-basketButton-icon-custom"> + <span class="fa fa-shopping-basket"></span> + </span> + <span class="quiqqer-order-basketButton-quantity quiqqer-order-basketButton-batch-custom">0</span> + <span class="quiqqer-order-basketButton-sum"> + {$InitialBasketPrice->getDisplayPrice()} + </span> + </button> + {/if} + </div> </div> \ No newline at end of file