init
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/** @var \Magento\Checkout\Block\Cart\Sidebar $block */
|
||||
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
|
||||
?>
|
||||
<div data-block="minicart" class="minicart-wrapper esun-cart-wrapper">
|
||||
<button type="button"
|
||||
class="action showcart"
|
||||
data-bind="scope: 'minicart_content'"
|
||||
aria-haspopup="dialog"
|
||||
aria-expanded="false"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Open shopping cart')) ?>">
|
||||
<span class="text"><?= $block->escapeHtml(__('My Cart')) ?></span>
|
||||
<span class="counter qty empty"
|
||||
data-bind="css: { empty: !getCartParam('summary_count') && !isLoading() }, blockLoader: isLoading">
|
||||
<span class="counter-number">
|
||||
<!-- ko if: getCartParam('summary_count') -->
|
||||
<!-- ko text: getCartParam('summary_count').toLocaleString(window.LOCALE) --><!-- /ko -->
|
||||
<!-- /ko -->
|
||||
</span>
|
||||
<span class="counter-label">
|
||||
<!-- ko i18n: 'items' --><!-- /ko -->
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
|
||||
<button type="button"
|
||||
class="esun-cart-backdrop"
|
||||
data-role="esun-cart-backdrop"
|
||||
aria-label="<?= $block->escapeHtmlAttr(__('Close shopping cart')) ?>"></button>
|
||||
<div class="block block-minicart esun-cart-drawer"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="esun-cart-title"
|
||||
data-role="dropdownDialog"
|
||||
data-mage-init='{"dropdownDialog":{"appendTo":"[data-block=minicart]","triggerTarget":".showcart","timeout":"2000","closeOnMouseLeave":false,"closeOnEscape":true,"triggerClass":"active","parentClass":"active","buttons":[]}}'>
|
||||
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
<?= $block->getChildHtml('minicart.addons') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$scriptString = <<<script
|
||||
require(['jquery'], function ($) {
|
||||
$('a.action.showcart').on('click', function () {
|
||||
$(document.body).trigger('processStart');
|
||||
});
|
||||
});
|
||||
script;
|
||||
?>
|
||||
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= /* @noEscape */ $secureRenderer->renderTag(
|
||||
'script',
|
||||
[],
|
||||
'window.checkout = ' . $block->getSerializedConfig(),
|
||||
false
|
||||
) ?>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"[data-block='minicart']": {
|
||||
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
|
||||
},
|
||||
"*": {
|
||||
"Magento_Ui/js/block-loader": "<?= $block->escapeJs(
|
||||
$block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))
|
||||
) ?>"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
Reference in New Issue
Block a user