minicart.phtml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. /** @var $block \Magento\Checkout\Block\Cart\Sidebar */
  8. ?>
  9. <div data-block="minicart" class="minicart-wrapper">
  10. <a class="action showcart" href="<?= /* @escapeNotVerified */ $block->getShoppingCartUrl() ?>"
  11. data-bind="scope: 'minicart_content'">
  12. <span class="text"><?= /* @escapeNotVerified */ __('My Cart') ?></span>
  13. <span class="counter qty empty"
  14. data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
  15. <span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
  16. <span class="counter-label">
  17. <!-- ko if: getCartParam('summary_count') -->
  18. <!-- ko text: getCartParam('summary_count') --><!-- /ko -->
  19. <!-- ko i18n: 'items' --><!-- /ko -->
  20. <!-- /ko -->
  21. </span>
  22. </span>
  23. </a>
  24. <?php if ($block->getIsNeedToDisplaySideBar()): ?>
  25. <div class="block block-minicart"
  26. data-role="dropdownDialog"
  27. data-mage-init='{"dropdownDialog":{
  28. "appendTo":"[data-block=minicart]",
  29. "triggerTarget":".showcart",
  30. "timeout": "2000",
  31. "closeOnMouseLeave": false,
  32. "closeOnEscape": true,
  33. "triggerClass":"active",
  34. "parentClass":"active",
  35. "buttons":[]}}'>
  36. <div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
  37. <!-- ko template: getTemplate() --><!-- /ko -->
  38. </div>
  39. <?= $block->getChildHtml('minicart.addons') ?>
  40. </div>
  41. <?php else: ?>
  42. <script>
  43. require(['jquery'], function ($) {
  44. $('a.action.showcart').click(function() {
  45. $(document.body).trigger('processStart');
  46. });
  47. });
  48. </script>
  49. <?php endif ?>
  50. <script>
  51. window.checkout = <?= /* @escapeNotVerified */ $block->getSerializedConfig() ?>;
  52. </script>
  53. <script type="text/x-magento-init">
  54. {
  55. "[data-block='minicart']": {
  56. "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */ $block->getJsLayout() ?>
  57. },
  58. "*": {
  59. "Magento_Ui/js/block-loader": "<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>"
  60. }
  61. }
  62. </script>
  63. </div>