sidebar.phtml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. /**
  8. * Last ordered items sidebar
  9. *
  10. * @var $block \Magento\Sales\Block\Reorder\Sidebar
  11. */
  12. ?>
  13. <div class="block block-reorder" data-bind="scope: 'lastOrderedItems'">
  14. <div class="block-title no-display"
  15. data-bind="css: {'no-display': !lastOrderedItems().items || lastOrderedItems().items.length === 0}">
  16. <strong id="block-reorder-heading" role="heading" aria-level="2"><?= /* @escapeNotVerified */ __('Recently Ordered') ?></strong>
  17. </div>
  18. <div class="block-content no-display"
  19. data-bind="css: {'no-display': !lastOrderedItems().items || lastOrderedItems().items.length === 0}"
  20. aria-labelledby="block-reorder-heading">
  21. <form method="post" class="form reorder"
  22. action="<?= /* @escapeNotVerified */ $block->getFormActionUrl() ?>" id="reorder-validate-detail">
  23. <strong class="subtitle"><?= /* @escapeNotVerified */ __('Last Ordered Items') ?></strong>
  24. <ol id="cart-sidebar-reorder" class="product-items product-items-names"
  25. data-bind="foreach: lastOrderedItems().items">
  26. <li class="product-item">
  27. <div class="field item choice">
  28. <label class="label" data-bind="attr: {'for': 'reorder-item-' + id}">
  29. <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
  30. </label>
  31. <div class="control">
  32. <input type="checkbox" name="order_items[]"
  33. data-bind="attr: {
  34. id: 'reorder-item-' + id,
  35. value: id,
  36. title: is_saleable ? '<?= /* @escapeNotVerified */ __('Add to Cart') ?>' : '<?= /* @escapeNotVerified */ __('Product is not salable.') ?>'
  37. },
  38. disable: !is_saleable"
  39. class="checkbox" data-validate='{"validate-one-checkbox-required-by-name": true}'/>
  40. </div>
  41. </div>
  42. <strong class="product-item-name">
  43. <a data-bind="attr: {href: url}" class="product-item-link">
  44. <span data-bind="text: name"></span>
  45. </a>
  46. </strong>
  47. </li>
  48. </ol>
  49. <div id="cart-sidebar-reorder-advice-container"></div>
  50. <div class="actions-toolbar">
  51. <div class="primary"
  52. data-bind="visible: isShowAddToCart">
  53. <button type="submit" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" class="action tocart primary">
  54. <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
  55. </button>
  56. </div>
  57. <div class="secondary">
  58. <a class="action view" href="<?= /* @escapeNotVerified */ $block->getUrl('customer/account') ?>">
  59. <span><?= /* @escapeNotVerified */ __('View All') ?></span>
  60. </a>
  61. </div>
  62. </div>
  63. </form>
  64. </div>
  65. <script>
  66. require(["jquery", "mage/mage"], function(jQuery){
  67. jQuery('#reorder-validate-detail').mage('validation', {
  68. errorPlacement: function(error, element) {
  69. error.appendTo('#cart-sidebar-reorder-advice-container');
  70. }
  71. });
  72. });
  73. </script>
  74. </div>
  75. <script type="text/x-magento-init">
  76. {
  77. "*": {
  78. "Magento_Ui/js/core/app": {
  79. "components": {
  80. "lastOrderedItems": {
  81. "component": "Magento_Sales/js/view/last-ordered-items"
  82. }
  83. }
  84. }
  85. }
  86. }
  87. </script>